mirror of
https://github.com/Ujwal223/FocusGram.git
synced 2026-07-17 14:07:22 +02:00
Added Notification Bridge.
Added an onboarding screen. Fixed problem wherebottom bar blocked sending message. added a option to go to instagram's settings page in our settings page. added a notifications icon in bottombar. Other few Improvements and Bug fixes.
This commit is contained in:
+18
-8
@@ -3,6 +3,7 @@ import 'package:flutter/services.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'services/session_manager.dart';
|
||||
import 'services/settings_service.dart';
|
||||
import 'screens/onboarding_page.dart';
|
||||
import 'screens/main_webview_page.dart';
|
||||
import 'screens/breath_gate_screen.dart';
|
||||
import 'screens/app_session_picker.dart';
|
||||
@@ -59,10 +60,11 @@ class FocusGramApp extends StatelessWidget {
|
||||
}
|
||||
|
||||
/// Flow on every cold open:
|
||||
/// 1. Cooldown Gate (if app-open cooldown active)
|
||||
/// 2. Breath Gate (if enabled in settings)
|
||||
/// 3. App Session Picker (always)
|
||||
/// 4. Main WebView
|
||||
/// 1. Onboarding (if first run)
|
||||
/// 2. Cooldown Gate (if app-open cooldown active)
|
||||
/// 3. Breath Gate (if enabled in settings)
|
||||
/// 4. App Session Picker (always)
|
||||
/// 5. Main WebView
|
||||
class InitialRouteHandler extends StatefulWidget {
|
||||
const InitialRouteHandler({super.key});
|
||||
|
||||
@@ -73,32 +75,40 @@ class InitialRouteHandler extends StatefulWidget {
|
||||
class _InitialRouteHandlerState extends State<InitialRouteHandler> {
|
||||
bool _breathCompleted = false;
|
||||
bool _appSessionStarted = false;
|
||||
bool _onboardingCompleted = false;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final sm = context.watch<SessionManager>();
|
||||
final settings = context.watch<SettingsService>();
|
||||
|
||||
// Step 1: Cooldown gate — if too soon since last session
|
||||
// Step 1: Onboarding
|
||||
if (settings.isFirstRun && !_onboardingCompleted) {
|
||||
return OnboardingPage(
|
||||
onFinish: () => setState(() => _onboardingCompleted = true),
|
||||
);
|
||||
}
|
||||
|
||||
// Step 2: Cooldown gate — if too soon since last session
|
||||
if (sm.isAppOpenCooldownActive) {
|
||||
return const CooldownGateScreen();
|
||||
}
|
||||
|
||||
// Step 2: Breath gate
|
||||
// Step 3: Breath gate
|
||||
if (settings.showBreathGate && !_breathCompleted) {
|
||||
return BreathGateScreen(
|
||||
onFinish: () => setState(() => _breathCompleted = true),
|
||||
);
|
||||
}
|
||||
|
||||
// Step 3: App session picker
|
||||
// Step 4: App session picker
|
||||
if (!_appSessionStarted) {
|
||||
return AppSessionPickerScreen(
|
||||
onSessionStarted: () => setState(() => _appSessionStarted = true),
|
||||
);
|
||||
}
|
||||
|
||||
// Step 4: Main app
|
||||
// Step 5: Main app
|
||||
return const MainWebViewPage();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user