simplified loadable state logic by removing connectivity debouncing and inlining indicator helpers; updated error bar visibility and chat list polling behavior

This commit is contained in:
2026-08-02 08:21:25 +02:00
parent 4c2e9b47e7
commit 246cb0f527
7 changed files with 36 additions and 195 deletions
+9 -2
View File
@@ -62,7 +62,7 @@ class _AppState extends State<App> with WidgetsBindingObserver {
_syncChatListPolling();
}
void _syncChatListPolling() {
void _syncChatListPolling({bool refresh = true}) {
if (!mounted) return;
final modules = AppModule.getBottomBarModules(context);
final talkSlot = modules.indexWhere((m) => m.module == Modules.talk);
@@ -72,7 +72,7 @@ class _AppState extends State<App> with WidgetsBindingObserver {
bloc.setAutoRefreshInterval(
talkIsActive ? _chatListActiveInterval : _chatListIdleInterval,
);
if (talkIsActive) bloc.refresh();
if (talkIsActive && refresh) bloc.refresh();
}
// Wall-clock throttle rather than Debouncer.throttle: a Timer does not tick
@@ -103,7 +103,14 @@ class _AppState extends State<App> with WidgetsBindingObserver {
log('Refreshing due to LifecycleChange');
NotificationTasks.updateProviders(context);
});
// updateProviders already refreshes the chat list; only re-arm the poll.
_syncChatListPolling(refresh: false);
_handlePendingWidgetNavigation();
} else if (mounted) {
// Stop polling while backgrounded: a silent refresh failing in the
// background would otherwise leave an error that flashes on the next
// resume before the foreground refetch replaces it.
context.read<ChatListBloc>().setAutoRefreshInterval(null);
}
}