feat: MeshCore SAR - Flutter BLE mesh radio companion app

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Janez T
2026-02-28 10:11:33 +01:00
commit baf49d27d8
313 changed files with 101770 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
import 'package:shared_preferences/shared_preferences.dart';
/// Service to manage welcome wizard preferences and state
class WizardPreferences {
static const String _wizardCompletedKey = 'wizard_completed';
static const String _wizardVersionKey = 'wizard_version';
static const int _currentWizardVersion = 1;
/// Check if the welcome wizard has been completed
static Future<bool> isWizardCompleted() async {
final prefs = await SharedPreferences.getInstance();
final completed = prefs.getBool(_wizardCompletedKey) ?? false;
final version = prefs.getInt(_wizardVersionKey) ?? 0;
// Re-show wizard if version has changed (for major updates)
return completed && version >= _currentWizardVersion;
}
/// Mark the welcome wizard as completed
static Future<void> setWizardCompleted(bool completed) async {
final prefs = await SharedPreferences.getInstance();
await prefs.setBool(_wizardCompletedKey, completed);
if (completed) {
// Store current version when wizard is completed
await prefs.setInt(_wizardVersionKey, _currentWizardVersion);
}
}
/// Get the wizard version last shown to the user
static Future<int> getWizardVersion() async {
final prefs = await SharedPreferences.getInstance();
return prefs.getInt(_wizardVersionKey) ?? 0;
}
/// Reset wizard state (useful for testing or re-showing tutorial)
static Future<void> resetWizard() async {
final prefs = await SharedPreferences.getInstance();
await prefs.setBool(_wizardCompletedKey, false);
await prefs.setInt(_wizardVersionKey, 0);
}
}