updateTimezoneOrOffsetIfChanged abstract method
Updates timezone and/or offset in Firestore if changed.
Performs a fast local check first (no network if unchanged and within throttle window). Only syncs to server when:
- Timezone IANA string changed (user traveled)
- Timezone offset changed (DST transition)
- Forced refresh interval exceeded (safety net for missed DST)
Throttling
- Change debounce: 10 minutes (prevents rapid flapping near borders)
- Unchanged throttle: 48 hours (avoids resume spam)
- Forced refresh: 48 hours (catches missed DST transitions)
When Called
- On app resume from background (via AppLifecycleService)
- Throttled automatically
Returns
Right(true)if server was updatedRight(false)if unchanged or throttled (no update needed)Left(RepositoryFailure)on failure
DST Safety
The system computes offset using DateTime.now().timeZoneOffset.inMinutes,
which correctly handles half-hour and 45-minute offsets (India, Nepal, etc).
DST transitions are detected because offset changes even when the IANA
timezone string doesn't.
Implementation
Future<Either<RepositoryFailure, bool>> updateTimezoneOrOffsetIfChanged();