mirror of
https://git.selfprivacy.org/kherel/selfprivacy.org.app.git
synced 2025-01-23 09:16:54 +00:00
fix(initializing): Implement store and load of server provider from BNames
This commit is contained in:
parent
df9ec28d02
commit
b574659dc3
|
@ -118,6 +118,7 @@ class ServerInstallationCubit extends Cubit<ServerInstallationState> {
|
||||||
|
|
||||||
void setServerProviderKey(final String serverProviderKey) async {
|
void setServerProviderKey(final String serverProviderKey) async {
|
||||||
await repository.saveServerProviderKey(serverProviderKey);
|
await repository.saveServerProviderKey(serverProviderKey);
|
||||||
|
|
||||||
if (state is ServerInstallationRecovery) {
|
if (state is ServerInstallationRecovery) {
|
||||||
emit(
|
emit(
|
||||||
(state as ServerInstallationRecovery).copyWith(
|
(state as ServerInstallationRecovery).copyWith(
|
||||||
|
|
|
@ -56,17 +56,20 @@ class ServerInstallationRepository {
|
||||||
final String? cloudflareToken = getIt<ApiConfigModel>().cloudFlareKey;
|
final String? cloudflareToken = getIt<ApiConfigModel>().cloudFlareKey;
|
||||||
final String? serverTypeIdentificator = getIt<ApiConfigModel>().serverType;
|
final String? serverTypeIdentificator = getIt<ApiConfigModel>().serverType;
|
||||||
final ServerDomain? serverDomain = getIt<ApiConfigModel>().serverDomain;
|
final ServerDomain? serverDomain = getIt<ApiConfigModel>().serverDomain;
|
||||||
|
final ServerProvider? serverProvider =
|
||||||
|
getIt<ApiConfigModel>().serverProvider;
|
||||||
final BackblazeCredential? backblazeCredential =
|
final BackblazeCredential? backblazeCredential =
|
||||||
getIt<ApiConfigModel>().backblazeCredential;
|
getIt<ApiConfigModel>().backblazeCredential;
|
||||||
final ServerHostingDetails? serverDetails =
|
final ServerHostingDetails? serverDetails =
|
||||||
getIt<ApiConfigModel>().serverDetails;
|
getIt<ApiConfigModel>().serverDetails;
|
||||||
|
|
||||||
if (serverDetails != null &&
|
if (serverProvider != null ||
|
||||||
serverDetails.provider != ServerProvider.unknown) {
|
(serverDetails != null &&
|
||||||
|
serverDetails.provider != ServerProvider.unknown)) {
|
||||||
serverProviderApiFactory =
|
serverProviderApiFactory =
|
||||||
ApiFactoryCreator.createServerProviderApiFactory(
|
ApiFactoryCreator.createServerProviderApiFactory(
|
||||||
ServerProviderApiFactorySettings(
|
ServerProviderApiFactorySettings(
|
||||||
provider: serverDetails.provider,
|
provider: serverProvider ?? serverDetails!.provider,
|
||||||
location: location,
|
location: location,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
|
@ -82,6 +82,7 @@ class ApiConfigModel {
|
||||||
_serverDetails = null;
|
_serverDetails = null;
|
||||||
_backblazeBucket = null;
|
_backblazeBucket = null;
|
||||||
_serverType = null;
|
_serverType = null;
|
||||||
|
_serverProvider = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
void init() {
|
void init() {
|
||||||
|
@ -93,5 +94,6 @@ class ApiConfigModel {
|
||||||
_serverDetails = _box.get(BNames.serverDetails);
|
_serverDetails = _box.get(BNames.serverDetails);
|
||||||
_backblazeBucket = _box.get(BNames.backblazeBucket);
|
_backblazeBucket = _box.get(BNames.backblazeBucket);
|
||||||
_serverType = _box.get(BNames.serverTypeIdentifier);
|
_serverType = _box.get(BNames.serverTypeIdentifier);
|
||||||
|
_serverProvider = _box.get(BNames.serverProvider);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue