chore: Post-merge cleanup

This commit is contained in:
Inex Code 2024-06-25 18:06:50 +03:00
parent 4ce7b0bcdb
commit 78b026ed42
5 changed files with 23 additions and 28 deletions

View file

@ -19,7 +19,6 @@ Future<void> getItSetup() async {
getIt.registerSingleton<WizardDataModel>(WizardDataModel()..init()); getIt.registerSingleton<WizardDataModel>(WizardDataModel()..init());
final apiConfigModel = ApiConfigModel(); final apiConfigModel = ApiConfigModel();
await apiConfigModel.init();
getIt.registerSingleton<ApiConfigModel>(apiConfigModel); getIt.registerSingleton<ApiConfigModel>(apiConfigModel);
getIt.registerSingleton<ApiConnectionRepository>( getIt.registerSingleton<ApiConnectionRepository>(

View file

@ -41,13 +41,15 @@ class HiveConfig {
await getEncryptedKey(BNames.serverInstallationEncryptionKey), 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.resourcesBox, encryptionCipher: cipher);
await Hive.openBox(BNames.wizardDataBox, encryptionCipher: cipher); await Hive.openBox(BNames.wizardDataBox, encryptionCipher: cipher);
final Box resourcesBox = Hive.box(BNames.resourcesBox); final Box resourcesBox = Hive.box(BNames.resourcesBox);
if (resourcesBox.isEmpty) { if (resourcesBox.isEmpty) {
final Box serverInstallationBox = Hive.box(BNames.serverInstallationBox); final Box serverInstallationBox =
Hive.box(BNames.serverInstallationBox);
final String? serverProviderKey = final String? serverProviderKey =
serverInstallationBox.get(BNames.hetznerKey); serverInstallationBox.get(BNames.hetznerKey);
@ -79,7 +81,8 @@ class HiveConfig {
tokenId: null, tokenId: null,
token: serverProviderKey, token: serverProviderKey,
provider: serverProvider ?? serverDetails!.provider, provider: serverProvider ?? serverDetails!.provider,
associatedServerIds: serverDetails != null ? [serverDetails.id] : [], associatedServerIds:
serverDetails != null ? [serverDetails.id] : [],
); );
await resourcesBox await resourcesBox
@ -128,7 +131,6 @@ class HiveConfig {
print('HiveConfig: Error while opening boxes: $e'); print('HiveConfig: Error while opening boxes: $e');
rethrow; rethrow;
} }
} }
static Future<Uint8List> getEncryptedKey(final String encKey) async { static Future<Uint8List> getEncryptedKey(final String encKey) async {

View file

@ -5,8 +5,6 @@ import 'package:selfprivacy/logic/models/hive/backblaze_bucket.dart';
class ApiConfigModel { class ApiConfigModel {
final Box _box = Hive.box(BNames.serverInstallationBox); final Box _box = Hive.box(BNames.serverInstallationBox);
String? get localeCode => _localeCode;
static const localeCodeFallback = 'en'; static const localeCodeFallback = 'en';
String? _localeCode; String? _localeCode;
@ -17,12 +15,4 @@ class ApiConfigModel {
Future<void> setBackblazeBucket(final BackblazeBucket value) async { Future<void> setBackblazeBucket(final BackblazeBucket value) async {
await _box.put(BNames.backblazeBucket, value); await _box.put(BNames.backblazeBucket, value);
} }
// TODO: Remove it
void clear() {
}
// TODO: Remove it
void init() {
}
} }

View file

@ -9,6 +9,7 @@
#include <connectivity_plus/connectivity_plus_windows_plugin.h> #include <connectivity_plus/connectivity_plus_windows_plugin.h>
#include <dynamic_color/dynamic_color_plugin_c_api.h> #include <dynamic_color/dynamic_color_plugin_c_api.h>
#include <flutter_secure_storage_windows/flutter_secure_storage_windows_plugin.h> #include <flutter_secure_storage_windows/flutter_secure_storage_windows_plugin.h>
#include <local_auth_windows/local_auth_plugin.h>
#include <url_launcher_windows/url_launcher_windows.h> #include <url_launcher_windows/url_launcher_windows.h>
void RegisterPlugins(flutter::PluginRegistry* registry) { void RegisterPlugins(flutter::PluginRegistry* registry) {
@ -18,6 +19,8 @@ void RegisterPlugins(flutter::PluginRegistry* registry) {
registry->GetRegistrarForPlugin("DynamicColorPluginCApi")); registry->GetRegistrarForPlugin("DynamicColorPluginCApi"));
FlutterSecureStorageWindowsPluginRegisterWithRegistrar( FlutterSecureStorageWindowsPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("FlutterSecureStorageWindowsPlugin")); registry->GetRegistrarForPlugin("FlutterSecureStorageWindowsPlugin"));
LocalAuthPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("LocalAuthPlugin"));
UrlLauncherWindowsRegisterWithRegistrar( UrlLauncherWindowsRegisterWithRegistrar(
registry->GetRegistrarForPlugin("UrlLauncherWindows")); registry->GetRegistrarForPlugin("UrlLauncherWindows"));
} }

View file

@ -6,6 +6,7 @@ list(APPEND FLUTTER_PLUGIN_LIST
connectivity_plus connectivity_plus
dynamic_color dynamic_color
flutter_secure_storage_windows flutter_secure_storage_windows
local_auth_windows
url_launcher_windows url_launcher_windows
) )