feat: notify user when claude.ai session expires (tap to re-auth)
Build APK / build (push) Successful in 1m35s
Build APK / build (push) Successful in 1m35s
Detection already cleared the session after 3x 401/403 but did so silently — the widget would just go stale. Now fires a one-time HIGH-priority notification on its own 'Sign-in alerts' channel that opens LoginActivity for re-paste.
This commit is contained in:
@@ -31,10 +31,16 @@ class UsageUpdateWorker(
|
||||
val animJob = launch { rotateRefreshIcon() }
|
||||
try {
|
||||
val data = UsageRepository(prefs).fetchUsage()
|
||||
// Preserve last-good data so a failed/partial fetch never blanks the widget.
|
||||
prefs.saveUsageData(data.mergedWith(prefs.getUsageData()))
|
||||
prefs.recordHistory(data) // history records only fresh readings
|
||||
Notifier.checkAndNotify(context, prefs, data)
|
||||
// We passed the isLoggedIn() guard above, so if the session is gone now the
|
||||
// cookie just expired this cycle — tell the user once (next cycle returns early).
|
||||
if (!prefs.isLoggedIn()) {
|
||||
Notifier.notifySessionExpired(context)
|
||||
} else {
|
||||
// Preserve last-good data so a failed/partial fetch never blanks the widget.
|
||||
prefs.saveUsageData(data.mergedWith(prefs.getUsageData()))
|
||||
prefs.recordHistory(data) // history records only fresh readings
|
||||
Notifier.checkAndNotify(context, prefs, data)
|
||||
}
|
||||
} catch (_: Exception) {}
|
||||
animJob.cancel()
|
||||
animJob.join()
|
||||
|
||||
Reference in New Issue
Block a user