From 16d1c8a9186b372f7e34057f58f42538ff6c44e4 Mon Sep 17 00:00:00 2001 From: Inex Code Date: Fri, 12 Apr 2024 15:41:32 +0300 Subject: [PATCH] refactor: Remove unused Users Hive box --- lib/config/hive_config.dart | 18 +----------------- .../server_installation_repository.dart | 2 -- 2 files changed, 1 insertion(+), 19 deletions(-) diff --git a/lib/config/hive_config.dart b/lib/config/hive_config.dart index 55b35e9e..dbd5a2a3 100644 --- a/lib/config/hive_config.dart +++ b/lib/config/hive_config.dart @@ -32,16 +32,6 @@ class HiveConfig { await getEncryptedKey(BNames.serverInstallationEncryptionKey), ); - await Hive.openBox(BNames.usersDeprecated); - await Hive.openBox(BNames.usersBox, encryptionCipher: cipher); - - final Box deprecatedUsers = Hive.box(BNames.usersDeprecated); - if (deprecatedUsers.isNotEmpty) { - final Box users = Hive.box(BNames.usersBox); - await users.addAll(deprecatedUsers.values.toList()); - await deprecatedUsers.clear(); - } - await Hive.openBox(BNames.serverInstallationBox, encryptionCipher: cipher); } @@ -72,7 +62,7 @@ class BNames { /// A boolean field of [appSettingsBox] box. static String isOnboardingShowing = 'isOnboardingShowing'; - /// Encryption key to decrypt [serverInstallationBox] and [usersBox] box. + /// Encryption key to decrypt [serverInstallationBox] box. static String serverInstallationEncryptionKey = 'key'; /// Server installation box. Contains server details and provider tokens. @@ -131,10 +121,4 @@ class BNames { /// A boolean field of [serverInstallationBox] box. static String isRecoveringServer = 'isRecoveringServer'; - - /// Deprecated users box as it is unencrypted - static String usersDeprecated = 'users'; - - /// Box with users - static String usersBox = 'usersEncrypted'; } diff --git a/lib/logic/cubit/server_installation/server_installation_repository.dart b/lib/logic/cubit/server_installation/server_installation_repository.dart index 90035fea..28f6bd2f 100644 --- a/lib/logic/cubit/server_installation/server_installation_repository.dart +++ b/lib/logic/cubit/server_installation/server_installation_repository.dart @@ -34,7 +34,6 @@ class ServerAuthorizationException implements Exception { class ServerInstallationRepository { Box box = Hive.box(BNames.serverInstallationBox); - Box usersBox = Hive.box(BNames.usersBox); Future load() async { final String? providerApiToken = getIt().serverProviderKey; @@ -177,7 +176,6 @@ class ServerInstallationRepository { void clearAppConfig() { box.clear(); - usersBox.clear(); } Future startServer(