v1.14: usage history chart + threshold notifications
Add an in-app 7-day history chart and opt-in usage alerts, the two features requested from the macOS Claude-Usage-Tracker that map cleanly to an Android widget app. History: - UsageSnapshot model; PreferencesManager records session/weekly utilization on every refresh (7-day retention, <=600 points, collapses readings under 2 min apart to avoid worker+manual double-logging). - HistoryChartView: dependency-free Canvas line chart (session/weekly, 0/50/100% gridlines), breaks the line across >35-min gaps. - New HISTORY card with chart + legend. Notifications: - Notifier posts when session/weekly crosses a user threshold, at most once per limit window (keyed on reset-epoch, re-arms on rollover). - USAGE ALERTS card: enable switch + session/weekly sliders (50-100%, defaults 90/85). POST_NOTIFICATIONS permission + runtime request. - Wired into the existing 5-min background worker. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
package me.khodak.claudeusage.data
|
||||
|
||||
/**
|
||||
* A single point-in-time reading of usage, stored for the in-app history chart.
|
||||
* Percentages are 0-100; -1 means "no reading for this metric at this time".
|
||||
*/
|
||||
data class UsageSnapshot(
|
||||
val epochMs: Long = 0L,
|
||||
val sessionPct: Float = -1f,
|
||||
val weeklyPct: Float = -1f
|
||||
)
|
||||
Reference in New Issue
Block a user