mirror of
https://github.com/dz0ny/meshcore-sar.git
synced 2026-08-12 08:50:30 +00:00
feat: Add welcome wizard for new users
- Implemented a multi-page welcome wizard to introduce new users to the app's features. - Added localization support for the wizard in English, Spanish, French, Croatian, Italian, and Slovenian. - Integrated wizard completion state management using SharedPreferences. - Updated main app flow to show the wizard if it hasn't been completed. - Added a settings option to view the welcome tutorial again.
This commit is contained in:
@@ -15,8 +15,10 @@ import 'services/tile_cache_service.dart';
|
||||
import 'services/notification_service.dart';
|
||||
import 'services/locale_preferences.dart';
|
||||
import 'services/update_checker_service.dart';
|
||||
import 'services/wizard_preferences.dart';
|
||||
import 'widgets/update_dialog.dart';
|
||||
import 'screens/home_screen.dart';
|
||||
import 'screens/welcome_wizard_screen.dart';
|
||||
import 'theme/app_theme.dart';
|
||||
import 'l10n/app_localizations.dart';
|
||||
|
||||
@@ -36,6 +38,7 @@ class _MeshCoreSarAppState extends State<MeshCoreSarApp> {
|
||||
Locale? _locale;
|
||||
bool _isInitialized = false;
|
||||
bool _shouldShowPermissionDialog = false;
|
||||
bool _wizardCompleted = true; // Will be updated in _initializeApp()
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -46,6 +49,10 @@ class _MeshCoreSarAppState extends State<MeshCoreSarApp> {
|
||||
Future<void> _initializeApp() async {
|
||||
await _loadThemePreference();
|
||||
await _loadLocalePreference();
|
||||
|
||||
// Check if welcome wizard has been completed
|
||||
final wizardCompleted = await WizardPreferences.isWizardCompleted();
|
||||
|
||||
// Initialize notification service
|
||||
await NotificationService().initialize();
|
||||
|
||||
@@ -57,6 +64,7 @@ class _MeshCoreSarAppState extends State<MeshCoreSarApp> {
|
||||
_checkForUpdates();
|
||||
|
||||
setState(() {
|
||||
_wizardCompleted = wizardCompleted;
|
||||
_isInitialized = true;
|
||||
});
|
||||
}
|
||||
@@ -102,6 +110,12 @@ class _MeshCoreSarAppState extends State<MeshCoreSarApp> {
|
||||
});
|
||||
}
|
||||
|
||||
void _handleWizardCompleted() {
|
||||
setState(() {
|
||||
_wizardCompleted = true;
|
||||
});
|
||||
}
|
||||
|
||||
/// Check for app updates on Android only
|
||||
/// Shows dialog if update is available
|
||||
Future<void> _checkForUpdates() async {
|
||||
@@ -224,13 +238,17 @@ class _MeshCoreSarAppState extends State<MeshCoreSarApp> {
|
||||
GlobalCupertinoLocalizations.delegate,
|
||||
],
|
||||
supportedLocales: LocalePreferences.supportedLocales,
|
||||
home: HomeScreen(
|
||||
onThemeChanged: _handleThemeChanged,
|
||||
onLocaleChanged: _handleLocaleChanged,
|
||||
currentTheme: _themeMode,
|
||||
currentLocale: _locale,
|
||||
shouldShowPermissionDialog: _shouldShowPermissionDialog,
|
||||
),
|
||||
home: _wizardCompleted
|
||||
? HomeScreen(
|
||||
onThemeChanged: _handleThemeChanged,
|
||||
onLocaleChanged: _handleLocaleChanged,
|
||||
currentTheme: _themeMode,
|
||||
currentLocale: _locale,
|
||||
shouldShowPermissionDialog: _shouldShowPermissionDialog,
|
||||
)
|
||||
: WelcomeWizardScreen(
|
||||
onCompleted: _handleWizardCompleted,
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user