Fix recovery flow
parent
8ec3b8c3e3
commit
7810c2a279
|
@ -461,6 +461,7 @@ class ServerInstallationCubit extends Cubit<ServerInstallationState> {
|
|||
await repository.saveHasFinalChecked(true);
|
||||
await repository.saveIsRecoveringServer(false);
|
||||
final mainUser = await repository.getMainUser();
|
||||
await repository.saveRootUser(mainUser);
|
||||
final updatedState = (state as ServerInstallationRecovery).copyWith(
|
||||
backblazeCredential: backblazeCredential,
|
||||
rootUser: mainUser,
|
||||
|
@ -502,7 +503,7 @@ class ServerInstallationCubit extends Cubit<ServerInstallationState> {
|
|||
if (state.serverDetails != null) {
|
||||
await repository.deleteServer(state.serverDomain!);
|
||||
}
|
||||
await repository.deleteRecords();
|
||||
await repository.deleteServerRelatedRecords();
|
||||
emit(ServerInstallationNotFinished(
|
||||
hetznerKey: state.hetznerKey,
|
||||
serverDomain: state.serverDomain,
|
||||
|
|
|
@ -628,7 +628,7 @@ class ServerInstallationRepository {
|
|||
await cloudFlare.removeSimilarRecords(cloudFlareDomain: serverDomain);
|
||||
}
|
||||
|
||||
Future<void> deleteRecords() async {
|
||||
Future<void> deleteServerRelatedRecords() async {
|
||||
await box.deleteAll([
|
||||
BNames.serverDetails,
|
||||
BNames.isServerStarted,
|
||||
|
@ -636,6 +636,7 @@ class ServerInstallationRepository {
|
|||
BNames.isServerResetedSecondTime,
|
||||
BNames.hasFinalChecked,
|
||||
BNames.isLoading,
|
||||
BNames.isRecoveringServer,
|
||||
]);
|
||||
getIt<ApiConfigModel>().init();
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ class RecoveryKey extends StatefulWidget {
|
|||
class _RecoveryKeyState extends State<RecoveryKey> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var keyStatus = context.watch<RecoveryKeyCubit>().state;
|
||||
final keyStatus = context.watch<RecoveryKeyCubit>().state;
|
||||
|
||||
final List<Widget> widgets;
|
||||
final String? subtitle =
|
||||
|
|
|
@ -60,9 +60,16 @@ class RecoveryRouting extends StatelessWidget {
|
|||
}
|
||||
}
|
||||
|
||||
return AnimatedSwitcher(
|
||||
return BlocListener<ServerInstallationCubit, ServerInstallationState>(
|
||||
listener: (context, state) {
|
||||
if (state is ServerInstallationFinished) {
|
||||
Navigator.of(context).popUntil((route) => route.isFirst);
|
||||
}
|
||||
},
|
||||
child: AnimatedSwitcher(
|
||||
duration: const Duration(milliseconds: 300),
|
||||
child: currentPage,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue