Skip to content

Commit 6fdd75a

Browse files
committed
improve how warning shows
1 parent 89ab3fc commit 6fdd75a

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

Habitica/src/main/java/com/habitrpg/android/habitica/ui/activities/TaskFormActivity.kt

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -883,6 +883,9 @@ class TaskFormActivity : BaseActivity() {
883883
}
884884

885885
private fun checkIfShowNotifLayout() {
886+
887+
val alarmManager = this.getSystemService(Context.ALARM_SERVICE) as? AlarmManager
888+
var warnAboutInexact = false
886889
if (!pushNotificationManager.notificationPermissionEnabled() && Build.VERSION.SDK_INT >= 33) {
887890
binding.notificationsDisabledLayout.visibility = View.VISIBLE
888891
binding.remindersContainer.shouldShowNotifPermission = true
@@ -894,13 +897,11 @@ class TaskFormActivity : BaseActivity() {
894897
} else {
895898
binding.remindersContainer.shouldShowNotifPermission = false
896899
binding.notificationsDisabledLayout.visibility = View.GONE
897-
}
898900

899-
val alarmManager = this.getSystemService(Context.ALARM_SERVICE) as? AlarmManager
900-
var warnAboutInexact = false
901-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
902-
if (alarmManager?.canScheduleExactAlarms() == false) {
903-
warnAboutInexact = true
901+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
902+
if (alarmManager?.canScheduleExactAlarms() == false) {
903+
warnAboutInexact = true
904+
}
904905
}
905906
}
906907
if (warnAboutInexact) {

0 commit comments

Comments
 (0)