push registration no longer depends on notification permission, reporting effective opt-in and os permission

This commit is contained in:
2026-09-26 23:38:24 +02:00
parent e6f74ca6fe
commit 2aed3d104c
6 changed files with 129 additions and 81 deletions
-9
View File
@@ -48,11 +48,9 @@ class _AppState extends State<App> with WidgetsBindingObserver {
int _knownTotalTabs = 1;
int _lastTabIndex = 0;
bool _userOnLastTab = false;
DateTime? _lastTelemetryAt;
static const Duration _chatListActiveInterval = Duration(seconds: 15);
static const Duration _chatListIdleInterval = Duration(seconds: 60);
static const Duration _telemetryInterval = Duration(minutes: 15);
void _onTabControllerChanged() {
final newIndex = Main.bottomNavigator.index;
@@ -81,15 +79,8 @@ class _AppState extends State<App> with WidgetsBindingObserver {
}
}
// Wall-clock throttle rather than Debouncer.throttle: a Timer does not tick
// reliably while the app is suspended, so the window would still be open on
// the resume it is supposed to let through.
void _reportTelemetry() {
if (!mounted) return;
final now = DateTime.now();
final last = _lastTelemetryAt;
if (last != null && now.difference(last) < _telemetryInterval) return;
_lastTelemetryAt = now;
TelemetryHeartbeat.report(
notificationsEnabled: context
.read<SettingsCubit>()