Fixed requesting permissions

pull/208/head
M66B 3 years ago
parent 1046865429
commit 468659aa54

@ -74,7 +74,7 @@ public class FragmentDialogPermissions extends FragmentDialogBase {
boolean hasContactPermissions = boolean hasContactPermissions =
Helper.hasPermission(context, Manifest.permission.READ_CONTACTS); Helper.hasPermission(context, Manifest.permission.READ_CONTACTS);
boolean hasNotificationPermissions = boolean hasNotificationPermissions =
(Helper.getTargetSdk(context) < Build.VERSION_CODES.TIRAMISU || (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU ||
Helper.hasPermission(context, Manifest.permission.POST_NOTIFICATIONS)); Helper.hasPermission(context, Manifest.permission.POST_NOTIFICATIONS));
boolean isIgnoring = !Boolean.FALSE.equals(Helper.isIgnoringOptimizations(context)); boolean isIgnoring = !Boolean.FALSE.equals(Helper.isIgnoringOptimizations(context));
boolean canScheduleExact = AlarmManagerCompatEx.canScheduleExactAlarms(getContext()); boolean canScheduleExact = AlarmManagerCompatEx.canScheduleExactAlarms(getContext());

@ -623,14 +623,8 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
tvNotifications.setOnClickListener(new View.OnClickListener() { tvNotifications.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
Intent intent; Intent intent = new Intent(v.getContext(), ActivitySetup.class)
if (Helper.getTargetSdk(v.getContext()) < Build.VERSION_CODES.TIRAMISU) .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
intent = new Intent(
Settings.ACTION_APPLICATION_DETAILS_SETTINGS,
Uri.parse("package:" + BuildConfig.APPLICATION_ID));
else
intent = new Intent(v.getContext(), ActivitySetup.class)
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
v.getContext().startActivity(intent); v.getContext().startActivity(intent);
} }
}); });

@ -491,7 +491,7 @@ public class FragmentOptions extends FragmentBase {
boolean hasContactPermissions = boolean hasContactPermissions =
hasPermission(Manifest.permission.READ_CONTACTS); hasPermission(Manifest.permission.READ_CONTACTS);
boolean hasNotificationPermissions = boolean hasNotificationPermissions =
(Helper.getTargetSdk(context) < Build.VERSION_CODES.TIRAMISU || (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU ||
hasPermission(Manifest.permission.POST_NOTIFICATIONS)); hasPermission(Manifest.permission.POST_NOTIFICATIONS));
boolean isIgnoring = !Boolean.FALSE.equals(Helper.isIgnoringOptimizations(context)); boolean isIgnoring = !Boolean.FALSE.equals(Helper.isIgnoringOptimizations(context));

@ -394,7 +394,7 @@ public class Helper {
static String[] getDesiredPermissions(Context context) { static String[] getDesiredPermissions(Context context) {
List<String> permissions = new ArrayList<>(); List<String> permissions = new ArrayList<>();
permissions.add(Manifest.permission.READ_CONTACTS); permissions.add(Manifest.permission.READ_CONTACTS);
if (getTargetSdk(context) >= Build.VERSION_CODES.TIRAMISU) if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU)
permissions.add(Manifest.permission.POST_NOTIFICATIONS); permissions.add(Manifest.permission.POST_NOTIFICATIONS);
return permissions.toArray(new String[0]); return permissions.toArray(new String[0]);
} }

Loading…
Cancel
Save