Streak counter
mrvivacious opened this issue · comments
Would showing a streak counter be helpful? Personally, the GitHub commit chart does make me feel like coding and commuting something when I see a streak going.
How would I ask users if they'd like a feature ?
as a person who wants to watch less porn
i want a streak counter to give me a little boost of motivation when I see how long I've lived my best life without porn
so that I can keep living my best life
work description
- chrome extension, show streak above the emergency button
- Android app, show below the intro message at top of screen
Streak calculation:
Get user history of redirect data
Get last item from list (most recent redirection)
Streak = current time in ms - latest redirection event
Pretty print streak (ex: 4 days, 3 hours, 21 minutes, 23 seconds)
Typed this on my phone disregard any odd formatting
Streak calculation state machine
If there is a redirect event in storage, streak = currentTimeMillis - latestRedirectEvent
If there isn't a redirect event in storage (the user has never been redirected since download), then
streak = currentTimeMillis - timeWhenAppWasInstalled
So,
ChrEx: on app install, chrome.storage.sync.set { timeWhenInstalled : currentTimeMillis }
Android: on app install, set in shared prefs, { timeWhenInstalled : currentTimeMillis }
Potential copy paste stack overflow heehee