fix(app): re-check connectivity on foreground resume to clear false-offline banner
When backgrounded, the periodic TCP ping times out causing isOnline=false. On resume, immediately re-check so the banner clears as soon as the app is foregrounded rather than waiting up to 30s for the next scheduled check. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
947a47869e
commit
0aac693b5d
|
|
@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
|
|||
import 'package:go_router/go_router.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import '../updater/update_service.dart';
|
||||
import '../network/connectivity_provider.dart';
|
||||
import '../widgets/offline_banner.dart';
|
||||
import '../../features/auth/data/providers/auth_provider.dart';
|
||||
import '../../features/auth/presentation/pages/login_page.dart';
|
||||
|
|
@ -120,6 +121,8 @@ class _ScaffoldWithNavState extends ConsumerState<ScaffoldWithNav>
|
|||
@override
|
||||
void didChangeAppLifecycleState(AppLifecycleState state) {
|
||||
if (state == AppLifecycleState.resumed) {
|
||||
// Re-check connectivity immediately on foreground to clear false-offline banner
|
||||
ref.read(connectivityProvider.notifier).check();
|
||||
_checkForUpdateIfNeeded();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue