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());
final apiConfigModel = ApiConfigModel();
await apiConfigModel.init();
getIt.registerSingleton<ApiConfigModel>(apiConfigModel);
getIt.registerSingleton<ApiConnectionRepository>(

View file

@ -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<Uint8List> getEncryptedKey(final String encKey) async {

View file

@ -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<void> setBackblazeBucket(final BackblazeBucket value) async {
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 <dynamic_color/dynamic_color_plugin_c_api.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>
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"));
}

View file

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