mirror of
https://git.selfprivacy.org/kherel/selfprivacy.org.app.git
synced 2025-01-27 11:16:45 +00:00
Fix revert routing errors
This commit is contained in:
parent
313cfc7187
commit
6a22e2db6f
|
@ -411,6 +411,7 @@ class ServerInstallationCubit extends Cubit<ServerInstallationState> {
|
||||||
case RecoveryStep.recoveryKey:
|
case RecoveryStep.recoveryKey:
|
||||||
case RecoveryStep.newDeviceKey:
|
case RecoveryStep.newDeviceKey:
|
||||||
case RecoveryStep.oldToken:
|
case RecoveryStep.oldToken:
|
||||||
|
case RecoveryStep.hetznerToken:
|
||||||
emit(
|
emit(
|
||||||
dataState.copyWith(
|
dataState.copyWith(
|
||||||
currentStep: RecoveryStep.selecting,
|
currentStep: RecoveryStep.selecting,
|
||||||
|
@ -425,6 +426,23 @@ class ServerInstallationCubit extends Cubit<ServerInstallationState> {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
case RecoveryStep.cloudflareToken:
|
||||||
|
repository.deleteDomain();
|
||||||
|
repository.deleteServerDetails();
|
||||||
|
emit(
|
||||||
|
dataState.copyWith(
|
||||||
|
currentStep: RecoveryStep.serverSelection,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case RecoveryStep.backblazeToken:
|
||||||
|
repository.deleteBackblazeKey();
|
||||||
|
emit(
|
||||||
|
dataState.copyWith(
|
||||||
|
currentStep: RecoveryStep.cloudflareToken,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
break;
|
||||||
// We won't revert steps after client is authorized
|
// We won't revert steps after client is authorized
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -603,6 +603,11 @@ class ServerInstallationRepository {
|
||||||
await getIt<ApiConfigModel>().storeServerDetails(serverDetails);
|
await getIt<ApiConfigModel>().storeServerDetails(serverDetails);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> deleteServerDetails() async {
|
||||||
|
await box.delete(BNames.serverDetails);
|
||||||
|
getIt<ApiConfigModel>().init();
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> saveHetznerKey(final String key) async {
|
Future<void> saveHetznerKey(final String key) async {
|
||||||
print('saved');
|
print('saved');
|
||||||
await getIt<ApiConfigModel>().storeHetznerKey(key);
|
await getIt<ApiConfigModel>().storeHetznerKey(key);
|
||||||
|
@ -619,10 +624,20 @@ class ServerInstallationRepository {
|
||||||
await getIt<ApiConfigModel>().storeBackblazeCredential(backblazeCredential);
|
await getIt<ApiConfigModel>().storeBackblazeCredential(backblazeCredential);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> deleteBackblazeKey() async {
|
||||||
|
await box.delete(BNames.backblazeCredential);
|
||||||
|
getIt<ApiConfigModel>().init();
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> saveCloudFlareKey(final String key) async {
|
Future<void> saveCloudFlareKey(final String key) async {
|
||||||
await getIt<ApiConfigModel>().storeCloudFlareKey(key);
|
await getIt<ApiConfigModel>().storeCloudFlareKey(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> deleteCloudFlareKey() async {
|
||||||
|
await box.delete(BNames.cloudFlareKey);
|
||||||
|
getIt<ApiConfigModel>().init();
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> saveDomain(final ServerDomain serverDomain) async {
|
Future<void> saveDomain(final ServerDomain serverDomain) async {
|
||||||
await getIt<ApiConfigModel>().storeServerDomain(serverDomain);
|
await getIt<ApiConfigModel>().storeServerDomain(serverDomain);
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,6 @@ class ApiConfigModel {
|
||||||
|
|
||||||
Future<void> storeBackblazeCredential(final BackblazeCredential value) async {
|
Future<void> storeBackblazeCredential(final BackblazeCredential value) async {
|
||||||
await _box.put(BNames.backblazeCredential, value);
|
await _box.put(BNames.backblazeCredential, value);
|
||||||
|
|
||||||
_backblazeCredential = value;
|
_backblazeCredential = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,7 +63,6 @@ class ApiConfigModel {
|
||||||
|
|
||||||
void init() {
|
void init() {
|
||||||
_hetznerKey = _box.get(BNames.hetznerKey);
|
_hetznerKey = _box.get(BNames.hetznerKey);
|
||||||
|
|
||||||
_cloudFlareKey = _box.get(BNames.cloudFlareKey);
|
_cloudFlareKey = _box.get(BNames.cloudFlareKey);
|
||||||
_backblazeCredential = _box.get(BNames.backblazeCredential);
|
_backblazeCredential = _box.get(BNames.backblazeCredential);
|
||||||
_serverDomain = _box.get(BNames.serverDomain);
|
_serverDomain = _box.get(BNames.serverDomain);
|
||||||
|
|
|
@ -28,6 +28,8 @@ class RecoveryConfirmBackblaze extends StatelessWidget {
|
||||||
heroTitle: 'recovering.confirm_backblaze'.tr(),
|
heroTitle: 'recovering.confirm_backblaze'.tr(),
|
||||||
heroSubtitle: 'recovering.confirm_backblaze_description'.tr(),
|
heroSubtitle: 'recovering.confirm_backblaze_description'.tr(),
|
||||||
hasBackButton: true,
|
hasBackButton: true,
|
||||||
|
onBackButtonPressed:
|
||||||
|
context.read<ServerInstallationCubit>().revertRecoveryStep,
|
||||||
hasFlashButton: false,
|
hasFlashButton: false,
|
||||||
children: [
|
children: [
|
||||||
CubitFormTextField(
|
CubitFormTextField(
|
||||||
|
|
|
@ -31,6 +31,8 @@ class RecoveryConfirmCloudflare extends StatelessWidget {
|
||||||
),
|
),
|
||||||
hasBackButton: true,
|
hasBackButton: true,
|
||||||
hasFlashButton: false,
|
hasFlashButton: false,
|
||||||
|
onBackButtonPressed:
|
||||||
|
context.read<ServerInstallationCubit>().revertRecoveryStep,
|
||||||
children: [
|
children: [
|
||||||
CubitFormTextField(
|
CubitFormTextField(
|
||||||
formFieldCubit: context.read<CloudFlareFormCubit>().apiKey,
|
formFieldCubit: context.read<CloudFlareFormCubit>().apiKey,
|
||||||
|
|
|
@ -39,6 +39,8 @@ class _RecoveryConfirmServerState extends State<RecoveryConfirmServer> {
|
||||||
? 'recovering.choose_server_description'.tr()
|
? 'recovering.choose_server_description'.tr()
|
||||||
: 'recovering.confirm_server_description'.tr(),
|
: 'recovering.confirm_server_description'.tr(),
|
||||||
hasBackButton: true,
|
hasBackButton: true,
|
||||||
|
onBackButtonPressed:
|
||||||
|
context.read<ServerInstallationCubit>().revertRecoveryStep,
|
||||||
hasFlashButton: false,
|
hasFlashButton: false,
|
||||||
children: [
|
children: [
|
||||||
FutureBuilder<List<ServerBasicInfoWithValidators>>(
|
FutureBuilder<List<ServerBasicInfoWithValidators>>(
|
||||||
|
|
|
@ -32,6 +32,8 @@ class RecoveryHetznerConnected extends StatelessWidget {
|
||||||
),
|
),
|
||||||
hasBackButton: true,
|
hasBackButton: true,
|
||||||
hasFlashButton: false,
|
hasFlashButton: false,
|
||||||
|
onBackButtonPressed:
|
||||||
|
context.read<ServerInstallationCubit>().revertRecoveryStep,
|
||||||
children: [
|
children: [
|
||||||
CubitFormTextField(
|
CubitFormTextField(
|
||||||
formFieldCubit: context.read<HetznerFormCubit>().apiKey,
|
formFieldCubit: context.read<HetznerFormCubit>().apiKey,
|
||||||
|
|
Loading…
Reference in a new issue