From 78b026ed42f37548eede3e19521a940eec0af0e1 Mon Sep 17 00:00:00 2001 From: Inex Code Date: Tue, 25 Jun 2024 18:06:50 +0300 Subject: [PATCH] chore: Post-merge cleanup --- lib/config/get_it_config.dart | 1 - lib/config/hive_config.dart | 36 ++++++++++--------- lib/logic/get_it/api_config.dart | 10 ------ .../flutter/generated_plugin_registrant.cc | 3 ++ windows/flutter/generated_plugins.cmake | 1 + 5 files changed, 23 insertions(+), 28 deletions(-) diff --git a/lib/config/get_it_config.dart b/lib/config/get_it_config.dart index 5732346d..d570e005 100644 --- a/lib/config/get_it_config.dart +++ b/lib/config/get_it_config.dart @@ -19,7 +19,6 @@ Future getItSetup() async { getIt.registerSingleton(WizardDataModel()..init()); final apiConfigModel = ApiConfigModel(); - await apiConfigModel.init(); getIt.registerSingleton(apiConfigModel); getIt.registerSingleton( diff --git a/lib/config/hive_config.dart b/lib/config/hive_config.dart index c6337ecb..261c6450 100644 --- a/lib/config/hive_config.dart +++ b/lib/config/hive_config.dart @@ -41,45 +41,48 @@ class HiveConfig { await getEncryptedKey(BNames.serverInstallationEncryptionKey), ); - await Hive.openBox(BNames.serverInstallationBox, encryptionCipher: cipher); + await Hive.openBox(BNames.serverInstallationBox, + encryptionCipher: cipher); await Hive.openBox(BNames.resourcesBox, encryptionCipher: cipher); await Hive.openBox(BNames.wizardDataBox, encryptionCipher: cipher); final Box resourcesBox = Hive.box(BNames.resourcesBox); if (resourcesBox.isEmpty) { - final Box serverInstallationBox = Hive.box(BNames.serverInstallationBox); + final Box serverInstallationBox = + Hive.box(BNames.serverInstallationBox); final String? serverProviderKey = - serverInstallationBox.get(BNames.hetznerKey); + serverInstallationBox.get(BNames.hetznerKey); final String? serverLocation = - serverInstallationBox.get(BNames.serverLocation); + serverInstallationBox.get(BNames.serverLocation); final String? dnsProviderKey = - serverInstallationBox.get(BNames.cloudFlareKey); + serverInstallationBox.get(BNames.cloudFlareKey); final BackupsCredential? backblazeCredential = - serverInstallationBox.get(BNames.backblazeCredential); + serverInstallationBox.get(BNames.backblazeCredential); final ServerDomain? serverDomain = - serverInstallationBox.get(BNames.serverDomain); + serverInstallationBox.get(BNames.serverDomain); final ServerHostingDetails? serverDetails = - serverInstallationBox.get(BNames.serverDetails); + serverInstallationBox.get(BNames.serverDetails); final BackblazeBucket? backblazeBucket = - serverInstallationBox.get(BNames.backblazeBucket); + serverInstallationBox.get(BNames.backblazeBucket); final String? serverType = - serverInstallationBox.get(BNames.serverTypeIdentifier); + serverInstallationBox.get(BNames.serverTypeIdentifier); final ServerProviderType? serverProvider = - serverInstallationBox.get(BNames.serverProvider); + serverInstallationBox.get(BNames.serverProvider); final DnsProviderType? dnsProvider = - serverInstallationBox.get(BNames.dnsProvider); + serverInstallationBox.get(BNames.dnsProvider); if (serverProviderKey != null && (serverProvider != null || (serverDetails != null && serverDetails.provider != ServerProviderType.unknown))) { final ServerProviderCredential serverProviderCredential = - ServerProviderCredential( + ServerProviderCredential( tokenId: null, token: serverProviderKey, provider: serverProvider ?? serverDetails!.provider, - associatedServerIds: serverDetails != null ? [serverDetails.id] : [], + associatedServerIds: + serverDetails != null ? [serverDetails.id] : [], ); await resourcesBox @@ -91,12 +94,12 @@ class HiveConfig { (serverDomain != null && serverDomain.provider != DnsProviderType.unknown))) { final DnsProviderCredential dnsProviderCredential = - DnsProviderCredential( + DnsProviderCredential( tokenId: null, token: dnsProviderKey, provider: dnsProvider ?? serverDomain!.provider, associatedDomainNames: - serverDomain != null ? [serverDomain.domainName] : [], + serverDomain != null ? [serverDomain.domainName] : [], ); await resourcesBox @@ -128,7 +131,6 @@ class HiveConfig { print('HiveConfig: Error while opening boxes: $e'); rethrow; } - } static Future getEncryptedKey(final String encKey) async { diff --git a/lib/logic/get_it/api_config.dart b/lib/logic/get_it/api_config.dart index 43271204..65c64a3e 100644 --- a/lib/logic/get_it/api_config.dart +++ b/lib/logic/get_it/api_config.dart @@ -5,8 +5,6 @@ import 'package:selfprivacy/logic/models/hive/backblaze_bucket.dart'; class ApiConfigModel { final Box _box = Hive.box(BNames.serverInstallationBox); - String? get localeCode => _localeCode; - static const localeCodeFallback = 'en'; String? _localeCode; @@ -17,12 +15,4 @@ class ApiConfigModel { Future setBackblazeBucket(final BackblazeBucket value) async { await _box.put(BNames.backblazeBucket, value); } - - // TODO: Remove it - void clear() { - } - - // TODO: Remove it - void init() { - } } diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc index a01f420e..4ff4b899 100644 --- a/windows/flutter/generated_plugin_registrant.cc +++ b/windows/flutter/generated_plugin_registrant.cc @@ -9,6 +9,7 @@ #include #include #include +#include #include void RegisterPlugins(flutter::PluginRegistry* registry) { @@ -18,6 +19,8 @@ void RegisterPlugins(flutter::PluginRegistry* registry) { registry->GetRegistrarForPlugin("DynamicColorPluginCApi")); FlutterSecureStorageWindowsPluginRegisterWithRegistrar( registry->GetRegistrarForPlugin("FlutterSecureStorageWindowsPlugin")); + LocalAuthPluginRegisterWithRegistrar( + registry->GetRegistrarForPlugin("LocalAuthPlugin")); UrlLauncherWindowsRegisterWithRegistrar( registry->GetRegistrarForPlugin("UrlLauncherWindows")); } diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index 258f1683..ae5ef358 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -6,6 +6,7 @@ list(APPEND FLUTTER_PLUGIN_LIST connectivity_plus dynamic_color flutter_secure_storage_windows + local_auth_windows url_launcher_windows )