MESSENGER-5130 hotfix maintenance popup on missing server

This commit is contained in:
Frank Rotermund
2023-09-08 09:52:48 +02:00
parent 2f6e023c19
commit 4546ff4031
5 changed files with 47 additions and 12 deletions
@@ -17,6 +17,10 @@
import SwiftUI
import AVKit
enum AuthenticationServerSelectionScreenAlertType {
case showServerMaintenanceInfoMessageAlert, showServerMaintenanceDefaultAlert, showInvalidAppVersionAlert, showDowntimeTimeAlert, showInvalidServerAlert
}
struct AuthenticationServerSelectionScreen: View {
// MARK: - Properties
@@ -35,7 +39,7 @@ struct AuthenticationServerSelectionScreen: View {
// bwi #4976 show maintenance alert
@State private var isFetchingDowntime = false
@State private var showAlert = false
@State private var activeAlert: OnBoardingSplashScreenAlertType = .showInvalidAppVersionAlert
@State private var activeAlert: AuthenticationServerSelectionScreenAlertType = .showInvalidAppVersionAlert
private var textFieldFooterColor: Color {
viewModel.viewState.hasValidationError ? theme.colors.alert : theme.colors.tertiaryContent
@@ -68,9 +72,7 @@ struct AuthenticationServerSelectionScreen: View {
serverForm
.alert(item: $viewModel.alertInfo) { $0.alert }
.alert(isPresented: $showAlertForInvalidServer) {
invalidServerAlert()
}
if BWIBuildSettings.shared.authScreenShowTestServerOptions {
serverSelectionButton
}
@@ -153,8 +155,10 @@ struct AuthenticationServerSelectionScreen: View {
return Alert(title: Text(BWIL10n.downtimeTitle),
message: Text(BWIL10n.downtimeDefaultMessage),
dismissButton: .destructive(Text(BWIL10n.downtimeAlertDismissButton)) {
self.submit()
})
self.submit()
})
case .showInvalidServerAlert:
return self.invalidServerAlert()
}
})
@@ -270,7 +274,8 @@ struct AuthenticationServerSelectionScreen: View {
if isHomeserverAddressValid(viewModel.homeserverAddress) {
viewModel.send(viewAction: .confirm)
} else {
showAlertForInvalidServer = true
activeAlert = .showInvalidServerAlert
showAlert = true
}
}
@@ -345,8 +350,8 @@ struct AuthenticationServerSelectionScreen: View {
if success {
self.showAlertIfNeeded()
} else {
showAlert = true
activeAlert = .showServerMaintenanceDefaultAlert
// hotfix 2.9.1 if request ist no successful there probably is no maintenance on server -> don't show popup
self.submit()
}
}
}