Compare commits

...

2 Commits

Author SHA1 Message Date
Inex Code 16d1c8a918 refactor: Remove unused Users Hive box 2024-04-12 15:41:32 +03:00
Inex Code 81f4f93d7c refactor: Fix typos in variable names 2024-04-12 15:13:30 +03:00
5 changed files with 8 additions and 26 deletions

View File

@ -32,16 +32,6 @@ class HiveConfig {
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);
}
@ -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';
}

View File

@ -34,7 +34,6 @@ class ServerAuthorizationException implements Exception {
class ServerInstallationRepository {
Box box = Hive.box(BNames.serverInstallationBox);
Box<User> usersBox = Hive.box(BNames.usersBox);
Future<ServerInstallationState> load() async {
final String? providerApiToken = getIt<ApiConfigModel>().serverProviderKey;
@ -177,7 +176,6 @@ class ServerInstallationRepository {
void clearAppConfig() {
box.clear();
usersBox.clear();
}
Future<ServerHostingDetails> startServer(

View File

@ -49,11 +49,11 @@ abstract class ServerInstallationState extends Equatable {
bool get isPrimaryUserFilled => rootUser != null;
bool get isServerCreated => serverDetails != null;
bool get isFullyInitilized => _fulfilementList.every((final el) => el!);
bool get isFullyInitialized => _fulfillmentList.every((final el) => el!);
ServerSetupProgress get progress => ServerSetupProgress
.values[_fulfilementList.where((final el) => el!).length];
.values[_fulfillmentList.where((final el) => el!).length];
int get porgressBar {
int get progressBar {
if (progress.index < 6) {
return progress.index;
} else if (progress.index < 10) {
@ -63,7 +63,7 @@ abstract class ServerInstallationState extends Equatable {
}
}
List<bool?> get _fulfilementList {
List<bool?> get _fulfillmentList {
final List<bool> res = [
isServerProviderApiKeyFilled,
isServerTypeFilled,
@ -118,7 +118,7 @@ class TimerState extends ServerInstallationNotFinished {
enum ServerSetupProgress {
nothingYet,
serverProviderFilled,
servertTypeFilled,
serverTypeFilled,
dnsProviderFilled,
backblazeFilled,
domainFilled,

View File

@ -11,7 +11,7 @@ class Price {
enum CurrencyType {
eur,
usd,
unkown,
unknown,
}
class Currency {

View File

@ -112,7 +112,7 @@ class InitializingPage extends StatelessWidget {
'Server',
'Installation',
],
activeIndex: cubit.state.porgressBar,
activeIndex: cubit.state.progressBar,
),
),
),