feat: Initialize NetworkService in main.dart and add OfflineIndicator to HomeShell
This commit is contained in:
parent
7f618bcdf2
commit
70d4bc5140
|
|
@ -16,6 +16,7 @@ import 'services/secure_chat_service.dart';
|
||||||
import 'services/simple_e2ee_service.dart';
|
import 'services/simple_e2ee_service.dart';
|
||||||
import 'services/key_vault_service.dart';
|
import 'services/key_vault_service.dart';
|
||||||
import 'services/sync_manager.dart';
|
import 'services/sync_manager.dart';
|
||||||
|
import 'services/network_service.dart';
|
||||||
import 'package:google_fonts/google_fonts.dart';
|
import 'package:google_fonts/google_fonts.dart';
|
||||||
import 'theme/app_theme.dart';
|
import 'theme/app_theme.dart';
|
||||||
import 'providers/theme_provider.dart' as theme_provider;
|
import 'providers/theme_provider.dart' as theme_provider;
|
||||||
|
|
@ -129,6 +130,9 @@ class _sojornAppState extends ConsumerState<sojornApp> with WidgetsBindingObserv
|
||||||
if (kDebugMode) debugPrint('[APP] initState start ${DateTime.now().toIso8601String()}');
|
if (kDebugMode) debugPrint('[APP] initState start ${DateTime.now().toIso8601String()}');
|
||||||
_initDeepLinks();
|
_initDeepLinks();
|
||||||
_listenForAuth();
|
_listenForAuth();
|
||||||
|
// Initialize network monitoring
|
||||||
|
NetworkService().initialize();
|
||||||
|
|
||||||
if (kDebugMode) debugPrint('[APP] initState sync complete — deferring heavy init');
|
if (kDebugMode) debugPrint('[APP] initState sync complete — deferring heavy init');
|
||||||
// Defer heavy work with real delays to avoid jank on first paint
|
// Defer heavy work with real delays to avoid jank on first paint
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ import '../secure_chat/secure_chat_full_screen.dart';
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
import '../../widgets/radial_menu_overlay.dart';
|
import '../../widgets/radial_menu_overlay.dart';
|
||||||
import '../../widgets/onboarding_modal.dart';
|
import '../../widgets/onboarding_modal.dart';
|
||||||
|
import '../../widgets/offline_indicator.dart';
|
||||||
import '../../providers/quip_upload_provider.dart';
|
import '../../providers/quip_upload_provider.dart';
|
||||||
import '../../providers/notification_provider.dart';
|
import '../../providers/notification_provider.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
|
|
@ -116,14 +117,19 @@ class _HomeShellState extends ConsumerState<HomeShell> with WidgetsBindingObserv
|
||||||
final currentIndex = widget.navigationShell.currentIndex;
|
final currentIndex = widget.navigationShell.currentIndex;
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
backgroundColor: AppTheme.scaffoldBg,
|
||||||
appBar: _buildAppBar(),
|
appBar: _buildAppBar(),
|
||||||
body: Stack(
|
body: Column(
|
||||||
children: [
|
children: [
|
||||||
NavigationShellScope(
|
const OfflineIndicator(),
|
||||||
currentIndex: currentIndex,
|
Expanded(
|
||||||
child: widget.navigationShell,
|
child: Stack(
|
||||||
),
|
children: [
|
||||||
RadialMenuOverlay(
|
NavigationShellScope(
|
||||||
|
currentIndex: currentIndex,
|
||||||
|
child: widget.navigationShell,
|
||||||
|
),
|
||||||
|
RadialMenuOverlay(
|
||||||
isVisible: _isRadialMenuVisible,
|
isVisible: _isRadialMenuVisible,
|
||||||
onDismiss: () => setState(() => _isRadialMenuVisible = false),
|
onDismiss: () => setState(() => _isRadialMenuVisible = false),
|
||||||
onPostTap: () {
|
onPostTap: () {
|
||||||
|
|
@ -147,6 +153,9 @@ class _HomeShellState extends ConsumerState<HomeShell> with WidgetsBindingObserv
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue