Skip to content

feat(reminders): persistent logs - #21396

Draft
ericli3690 wants to merge 4 commits into
ankidroid:mainfrom
ericli3690:ericli3690-reminder-logs
Draft

feat(reminders): persistent logs#21396
ericli3690 wants to merge 4 commits into
ankidroid:mainfrom
ericli3690:ericli3690-reminder-logs

Conversation

@ericli3690

@ericli3690 ericli3690 commented Jul 26, 2026

Copy link
Copy Markdown
Member

Important

Note

Assisted-by: Claude Opus 4.5

Purpose / Description

Creates a small persistent logger service for review reminders in a new Shared Preferences file.

Many review reminder events like "notification fired" and "notification attempted" are difficult to test (may need to wait a whole day to test again) or fire at non-deterministic times due to OS intervention. Bugs such as missing notifications may be noticed by developers long after logs have been rotated out of memory. Users may find describing issues on forums difficult beyond "I didn't get a notification." Creating a small rotating buffer of the most recent notifications activity should help with this.

Below: new "copy debug info" button on the troubleshooting screen:
Screenshot_20260726_002659_AnkiDroid

Example of dump:

2026-07-26 00:29:28.224:: skip: 7: data-val-fail-true
2026-07-26 00:29:28.214:: skip: 7: retrieve-delivered-38418302
2026-07-26 00:29:28.197:: log: -: on-receive
2026-07-26 00:29:28.141:: skip: 10: data-val-fail-true
2026-07-26 00:29:28.133:: skip: 10: retrieve-delivered-9131834
2026-07-26 00:29:28.119:: log: -: on-receive
2026-07-26 00:29:27.854:: skip: 7: data-val-fail-true
2026-07-26 00:29:27.847:: skip: 7: retrieve-delivered-38417936
2026-07-26 00:29:27.840:: log: -: on-receive
2026-07-26 00:29:27.186:: skip: 10: data-val-fail-true
2026-07-26 00:29:27.169:: skip: 10: retrieve-delivered-9130871
2026-07-26 00:29:27.151:: log: -: on-receive
2026-07-26 00:29:26.884:: log: 7: schedule-success
2026-07-26 00:29:26.880:: log: 7: attempt-immediate
2026-07-26 00:29:26.876:: log: 10: schedule-success
2026-07-26 00:29:26.873:: log: 10: attempt-immediate
2026-07-26 00:29:26.867:: log: -: schedule-all
2026-07-26 00:29:26.809:: log: 7: schedule-success
2026-07-26 00:29:26.803:: log: 7: attempt-immediate
2026-07-26 00:29:26.801:: log: 10: schedule-success
2026-07-26 00:29:26.795:: log: 10: attempt-immediate
2026-07-26 00:29:26.759:: log: -: schedule-all

app_wide -> {"version":3,"remindersMapJson":"{\"10\":{\"id\":10,\"time\":{\"hour\":21,\"minute\":53},\"cardTriggerThreshold\":1,\"scope\":{\"type\":\"com.ichi2.anki.reviewreminders.ReviewReminderScope.Global\"},\"enabled\":true,\"latestNotifTime\":1785031036298,\"profileID\":\"\",\"onlyNotifyIfNoReviews\":false}}"}
deck_1 -> {"version":3,"remindersMapJson":"{\"7\":{\"id\":7,\"time\":{\"hour\":3,\"minute\":16},\"cardTriggerThreshold\":1,\"scope\":{\"type\":\"com.ichi2.anki.reviewreminders.ReviewReminderScope.DeckSpecific\",\"did\":1},\"enabled\":true,\"latestNotifTime\":1785001749911,\"profileID\":\"\",\"onlyNotifyIfNoReviews\":false}}"}

Fixes

  • Better logging for review reminders to aid in bug reporting and diagnosis once we move review reminders to beta.

Approach

I noticed SearchHistory accomplishes something very similar and abstracted out its functionality into PrefsStore. Open to different names if someone doesn't like this name. Then, I inherit from it in ReminderLogger, which is a wrapper around Timber._ that also writes to a SharedPreferences file. A separate SharedPreferences file is used so that we don't clog up the main one, and because SharedPrefs is designed so that it rewrites the entire file on each edit. Best to keep it separate.

How Has This Been Tested?

  • Builds, unit tests pass.
  • Review reminder logs are created, can be copied and viewed.
  • Tested on a physical Lenovo Tab M11, API 35.
  • Tested on a physical Samsung S23, API 36.

Checklist

  • You have a descriptive commit message with a short title (first line, max 50 chars).
  • You have commented your code, particularly in hard-to-understand areas
  • You have performed a self-review of your own code
  • UI changes: include screenshots of all affected screens (in particular showing any new or changed strings)
  • UI Changes: You have tested your change using the Google Accessibility Scanner

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Blocked by dependency Currently blocked by some other dependent / related change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants