1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-26 09:47:13 +00:00

Fixed requesting permissions

This commit is contained in:
M66B 2022-06-11 19:30:05 +02:00
parent 1046865429
commit 468659aa54
4 changed files with 5 additions and 11 deletions

View file

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

View file

@ -623,14 +623,8 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
tvNotifications.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent;
if (Helper.getTargetSdk(v.getContext()) < Build.VERSION_CODES.TIRAMISU)
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);
Intent intent = new Intent(v.getContext(), ActivitySetup.class)
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
v.getContext().startActivity(intent);
}
});

View file

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

View file

@ -394,7 +394,7 @@ public class Helper {
static String[] getDesiredPermissions(Context context) {
List<String> permissions = new ArrayList<>();
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);
return permissions.toArray(new String[0]);
}