feat: Migrate to go_router

This commit is contained in:
Anton Stubenbord
2023-07-30 23:51:00 +02:00
parent 61336d9527
commit f1398e6d4c
78 changed files with 2206 additions and 1756 deletions

View File

@@ -21,7 +21,7 @@ class GlobalSettings with HiveObjectMixin {
bool showOnboarding;
@HiveField(4)
String? currentLoggedInUser;
String? loggedInUserId;
@HiveField(5)
FileDownloadType defaultDownloadType;
@@ -37,7 +37,7 @@ class GlobalSettings with HiveObjectMixin {
this.preferredThemeMode = ThemeMode.system,
this.preferredColorSchemeOption = ColorSchemeOption.classic,
this.showOnboarding = true,
this.currentLoggedInUser,
this.loggedInUserId,
this.defaultDownloadType = FileDownloadType.alwaysAsk,
this.defaultShareType = FileDownloadType.alwaysAsk,
this.enforceSinglePagePdfUpload = false,

View File

@@ -20,16 +20,16 @@ class LocalUserAccount extends HiveObject {
@HiveField(7)
UserModel paperlessUser;
@HiveField(8, defaultValue: 2)
int apiVersion;
LocalUserAccount({
required this.id,
required this.serverUrl,
required this.settings,
required this.paperlessUser,
required this.apiVersion,
});
static LocalUserAccount get current =>
Hive.box<LocalUserAccount>(HiveBoxes.localUserAccount).get(
Hive.box<GlobalSettings>(HiveBoxes.globalSettings)
.getValue()!
.currentLoggedInUser)!;
bool get hasMultiUserSupport => apiVersion >= 3;
}

View File

@@ -43,7 +43,7 @@ class LocalUserAppState extends HiveObject {
final currentLocalUserId =
Hive.box<GlobalSettings>(HiveBoxes.globalSettings)
.getValue()!
.currentLoggedInUser!;
.loggedInUserId!;
return Hive.box<LocalUserAppState>(HiveBoxes.localUserAppState)
.get(currentLocalUserId)!;
}