fix(recovery): Fix installation recovery current step resolving

- Refactor the nested if-pyramid
- Replace the DnsProviderType check with a simple check for a token string, since we receive DnsProviderType from the server and the user has no actions in it
- Make sure the server selection prompt isn't skipped before asking for a DNS token
- Resolve: #395
This commit is contained in:
NaiJi 2024-09-08 21:14:25 +04:00 committed by Inex Code
parent 50bc9d8965
commit f938a04c5e

View file

@ -156,19 +156,22 @@ class ServerInstallationRepository {
final ServerDomain serverDomain,
final ServerHostingDetails? serverDetails,
) {
if (serverDetails != null) {
if (serverProviderToken != null) {
if (serverDetails.provider != ServerProviderType.unknown) {
if (serverDomain.provider != DnsProviderType.unknown) {
return RecoveryStep.backblazeToken;
}
return RecoveryStep.dnsProviderToken;
}
return RecoveryStep.serverSelection;
}
if (serverDetails == null) {
return RecoveryStep.selecting;
}
if (serverProviderToken == null) {
return RecoveryStep.serverProviderToken;
}
return RecoveryStep.selecting;
/// We don't write anything to the database after .serverSelection
/// step, therefore we have to re-ask it again before prompting for
/// DNS token, if it wasn't provided yet.
if (dnsProviderToken == null) {
return RecoveryStep.serverSelection;
}
return RecoveryStep.backblazeToken;
}
void clearAppConfig() {