mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-09 22:57:21 +00:00
changed project class to use shared preference
This commit is contained in:
19
lib/pages/common/bloc/project_manager.dart
Normal file
19
lib/pages/common/bloc/project_manager.dart
Normal file
@ -0,0 +1,19 @@
|
||||
import 'package:syncrow_web/utils/constants/strings_manager.dart';
|
||||
import 'package:syncrow_web/utils/helpers/shared_preferences_helper.dart';
|
||||
|
||||
class ProjectManager {
|
||||
static Future<String?> getProjectUUID() async {
|
||||
final projectUuid = await SharedPreferencesHelper.readStringFromSP(
|
||||
StringsManager.projectKey);
|
||||
return projectUuid.isNotEmpty ? projectUuid : null;
|
||||
}
|
||||
|
||||
static Future<void> setProjectUUID(String newUUID) async {
|
||||
await SharedPreferencesHelper.saveStringToSP(
|
||||
StringsManager.projectKey, newUUID);
|
||||
}
|
||||
|
||||
static Future<void> clearProjectUUID() async {
|
||||
await SharedPreferencesHelper.removeValueFromSP(StringsManager.projectKey);
|
||||
}
|
||||
}
|
@ -40,4 +40,5 @@ class StringsManager {
|
||||
static const String firstLaunch = "firstLaunch";
|
||||
static const String deleteScene = 'Delete Scene';
|
||||
static const String deleteAutomation = 'Delete Automation';
|
||||
static const String projectKey = 'selected_project_uuid';
|
||||
}
|
||||
|
Reference in New Issue
Block a user