mirror of
https://git.selfprivacy.org/kherel/selfprivacy.org.app.git
synced 2025-01-09 01:21:14 +00:00
refactor: Remove unused Users Hive box
This commit is contained in:
parent
81f4f93d7c
commit
16d1c8a918
|
@ -32,16 +32,6 @@ class HiveConfig {
|
||||||
await getEncryptedKey(BNames.serverInstallationEncryptionKey),
|
await getEncryptedKey(BNames.serverInstallationEncryptionKey),
|
||||||
);
|
);
|
||||||
|
|
||||||
await Hive.openBox<User>(BNames.usersDeprecated);
|
|
||||||
await Hive.openBox<User>(BNames.usersBox, encryptionCipher: cipher);
|
|
||||||
|
|
||||||
final Box<User> deprecatedUsers = Hive.box<User>(BNames.usersDeprecated);
|
|
||||||
if (deprecatedUsers.isNotEmpty) {
|
|
||||||
final Box<User> users = Hive.box<User>(BNames.usersBox);
|
|
||||||
await users.addAll(deprecatedUsers.values.toList());
|
|
||||||
await deprecatedUsers.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
await Hive.openBox(BNames.serverInstallationBox, encryptionCipher: cipher);
|
await Hive.openBox(BNames.serverInstallationBox, encryptionCipher: cipher);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,7 +62,7 @@ class BNames {
|
||||||
/// A boolean field of [appSettingsBox] box.
|
/// A boolean field of [appSettingsBox] box.
|
||||||
static String isOnboardingShowing = 'isOnboardingShowing';
|
static String isOnboardingShowing = 'isOnboardingShowing';
|
||||||
|
|
||||||
/// Encryption key to decrypt [serverInstallationBox] and [usersBox] box.
|
/// Encryption key to decrypt [serverInstallationBox] box.
|
||||||
static String serverInstallationEncryptionKey = 'key';
|
static String serverInstallationEncryptionKey = 'key';
|
||||||
|
|
||||||
/// Server installation box. Contains server details and provider tokens.
|
/// Server installation box. Contains server details and provider tokens.
|
||||||
|
@ -131,10 +121,4 @@ class BNames {
|
||||||
|
|
||||||
/// A boolean field of [serverInstallationBox] box.
|
/// A boolean field of [serverInstallationBox] box.
|
||||||
static String isRecoveringServer = 'isRecoveringServer';
|
static String isRecoveringServer = 'isRecoveringServer';
|
||||||
|
|
||||||
/// Deprecated users box as it is unencrypted
|
|
||||||
static String usersDeprecated = 'users';
|
|
||||||
|
|
||||||
/// Box with users
|
|
||||||
static String usersBox = 'usersEncrypted';
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,6 @@ class ServerAuthorizationException implements Exception {
|
||||||
|
|
||||||
class ServerInstallationRepository {
|
class ServerInstallationRepository {
|
||||||
Box box = Hive.box(BNames.serverInstallationBox);
|
Box box = Hive.box(BNames.serverInstallationBox);
|
||||||
Box<User> usersBox = Hive.box(BNames.usersBox);
|
|
||||||
|
|
||||||
Future<ServerInstallationState> load() async {
|
Future<ServerInstallationState> load() async {
|
||||||
final String? providerApiToken = getIt<ApiConfigModel>().serverProviderKey;
|
final String? providerApiToken = getIt<ApiConfigModel>().serverProviderKey;
|
||||||
|
@ -177,7 +176,6 @@ class ServerInstallationRepository {
|
||||||
|
|
||||||
void clearAppConfig() {
|
void clearAppConfig() {
|
||||||
box.clear();
|
box.clear();
|
||||||
usersBox.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<ServerHostingDetails> startServer(
|
Future<ServerHostingDetails> startServer(
|
||||||
|
|
Loading…
Reference in a new issue