You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Streak freeze: one day to save a missed reading streak
#817
I built a streak freeze for CrossInk and have it running on my X3. Since the repo doesn't take pull requests, I'm sharing it here in case it's useful, and you're welcome to pull it in if you like it.
What it does
Today, missing one day resets the reading streak to 0 the next day. With this change you get one day to save it.
Freeze: after exactly one missed day, the streak keeps its previous value the next day instead of dropping to 0.
Restore: read 2 hours in total on that frozen day and the streak is restored. The missed day does not add to the count; the day you restore on does.
Limit: one restore every 7 days. A second missed day inside that window ends the streak as before, and two missed days in a row always end it.
Display: a normal streak shows the fire icon. A frozen streak shows a snowflake with the restore progress, e.g. 25/120m (3 days). This appears in the Dashboard and Minimal home footers, the stats sleep screens, and the streak cell on the Reading Stats screen.
Example
Day
Read
Streak shown
Mon
20m
🔥 1
Tue
15m
🔥 2
Wed
30m
🔥 3
Thu
nothing
🔥 3
Fri, before reading
nothing yet
❄ 0/120m (3 days)
Fri, after 2 hours
120m
🔥 4
How it works
The reading history bitmap is unchanged, so a missed day stays recorded as missed. Restored gaps are tracked as a small count next to it.
global_stats.bin goes from version 3 to version 4 (159 to 171 bytes) to store the freeze state. Version 3 files still load.
Nearby Stats Sync still accepts stats from older firmware. A reader on older firmware will reject stats sent from this version, so both readers need it to sync both ways.
Freeze progress and restores stay on the reader that earned them; reading days from other devices are combined as before.
The 2-hour target and 7-day limit are two constants in ReadingStatsUtils.h.
13 native tests in test/reading_streak_freeze cover freeze, partial progress, restore, failed restore, two missed days, the 7-day limit, reading across midnight, and merging stats from another device. All pass.
pio run -e default and pio run -e x4-pro-simulator build on the branch.
Checked on screen in the X3 simulator: the Reading Stats screen in frozen, restored and limit states, and the Dashboard footer changing from fire to snowflake across a midnight rollover.
Flashed to my X3 and running with my existing stats. I haven't yet seen a freeze happen on the device across a real missed day.
Not checked on screen: the Minimal home theme and the sleep screens. They use the same label code as the Dashboard footer.
Things to know
The snowflake icon header was generated with a different SVG rasteriser than the documented rsvg-convert, so regenerating it may shift a few pixels.
Restore progress updates when you leave the book, not live while reading.
Happy to adjust the rules, the wording or the icon if you'd want it done differently.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
I built a streak freeze for CrossInk and have it running on my X3. Since the repo doesn't take pull requests, I'm sharing it here in case it's useful, and you're welcome to pull it in if you like it.
What it does
Today, missing one day resets the reading streak to 0 the next day. With this change you get one day to save it.
25/120m (3 days). This appears in the Dashboard and Minimal home footers, the stats sleep screens, and the streak cell on the Reading Stats screen.Example
How it works
global_stats.bingoes from version 3 to version 4 (159 to 171 bytes) to store the freeze state. Version 3 files still load.ReadingStatsUtils.h.Code
Branch, rebased on
development, one commit:https://github.com/augieafr/CrossInk/tree/feat/streak-freeze
Diff against
development:development...augieafr:CrossInk:feat/streak-freeze
Testing
test/reading_streak_freezecover freeze, partial progress, restore, failed restore, two missed days, the 7-day limit, reading across midnight, and merging stats from another device. All pass.pio run -e defaultandpio run -e x4-pro-simulatorbuild on the branch.Things to know
rsvg-convert, so regenerating it may shift a few pixels.Happy to adjust the rules, the wording or the icon if you'd want it done differently.
All reactions