Skip to content

Commit e8b030c

Browse files
committed
feat(reminders): request notification permissions from review reminders
GSoC 2025: Review Reminders Request notification permissions when the user first creates a review reminder. Involves a simple edit to AddEditReminderDialog.
1 parent fc2edbb commit e8b030c

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

AnkiDroid/src/main/java/com/ichi2/anki/reviewreminders/AddEditReminderDialog.kt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,11 @@ import com.ichi2.anki.launchCatchingTask
4949
import com.ichi2.anki.libanki.Consts
5050
import com.ichi2.anki.libanki.DeckId
5151
import com.ichi2.anki.model.SelectableDeck
52+
import com.ichi2.anki.settings.Prefs
5253
import com.ichi2.anki.snackbar.showSnackbar
5354
import com.ichi2.anki.utils.ext.showDialogFragment
5455
import com.ichi2.utils.DisplayUtils.resizeWhenSoftInputShown
56+
import com.ichi2.utils.Permissions
5557
import com.ichi2.utils.customView
5658
import com.ichi2.utils.negativeButton
5759
import com.ichi2.utils.neutralButton
@@ -343,6 +345,14 @@ class AddEditReminderDialog : DialogFragment() {
343345
putParcelable(ScheduleReminders.ADD_EDIT_DIALOG_RESULT_REQUEST_KEY, reminderToBeReturned)
344346
},
345347
)
348+
349+
// Request notification permissions from the user if they have not been requested ever before
350+
if (!Prefs.reminderNotifsRequestShown) {
351+
Permissions.requestNotificationsPermissionIfNeeded(requireContext(), parentFragmentManager) {
352+
Prefs.reminderNotifsRequestShown = true
353+
}
354+
}
355+
346356
dismiss()
347357
}
348358

0 commit comments

Comments
 (0)