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