Skip to content

Commit

Permalink
Merge pull request #276 from amberin/fix-getcurrentactivity-npe
Browse files Browse the repository at this point in the history
Fix NPE during permission check introduced in 67ccf2f
  • Loading branch information
amberin committed Jun 10, 2024
2 parents d019b7a + 3b30a8b commit bb71453
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,14 @@ class RemindersScheduler @Inject constructor(val context: Application, val logs:
val alarmManager = context.getAlarmManager()

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
if (!AppPermissions.isGrantedOrRequest(
App.getCurrentActivity(), AppPermissions.Usage.POST_NOTIFICATIONS
)
) {
if (!AppPermissions.isGranted(context, AppPermissions.Usage.POST_NOTIFICATIONS)) {
val activity = App.getCurrentActivity()
if (activity != null) {
AppPermissions.isGrantedOrRequest(
App.getCurrentActivity(),
AppPermissions.Usage.POST_NOTIFICATIONS
)
}
return
}
}
Expand Down

0 comments on commit bb71453

Please sign in to comment.