mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-29 12:46:58 +02:00
feature/2821_downtime_login_screen
This commit is contained in:
@@ -29,8 +29,11 @@ struct OnboardingBwiSplashScreen: View {
|
||||
|
||||
/// The dimensions of the stack with the action buttons and page indicator.
|
||||
@State private var overlayFrame: CGRect = .zero
|
||||
@State private var showServerMaintananceAlert = false
|
||||
@State private var showServerMaintananceDefaultAlert = false
|
||||
@State private var showInvalidAppVersionAlert = false
|
||||
|
||||
@State private var isFetchingDowntime = false
|
||||
|
||||
// MARK: Public
|
||||
|
||||
@ObservedObject var viewModel: OnboardingBwiSplashScreenViewModel.Context
|
||||
@@ -38,9 +41,13 @@ struct OnboardingBwiSplashScreen: View {
|
||||
/// The main action buttons.
|
||||
var startButton: some View {
|
||||
Button(action: startButtonAction) {
|
||||
Text(VectorL10n.splashScreenStart)
|
||||
.font(theme.fonts.body.bold())
|
||||
.frame(minWidth: 0, maxWidth: .infinity, minHeight: 32)
|
||||
if isFetchingDowntime {
|
||||
ProgressView()
|
||||
} else {
|
||||
Text(VectorL10n.splashScreenStart)
|
||||
.font(theme.fonts.body.bold())
|
||||
.frame(minWidth: 0, maxWidth: .infinity, minHeight: 32)
|
||||
}
|
||||
}
|
||||
.foregroundColor(.white)
|
||||
.background(theme.colors.accent)
|
||||
@@ -67,6 +74,20 @@ struct OnboardingBwiSplashScreen: View {
|
||||
}
|
||||
.navigationTitle("")
|
||||
.navigationBarHidden(true)
|
||||
.alert(isPresented: $showServerMaintananceAlert) {
|
||||
Alert(title: Text(NSLocalizedString("downtime_title", tableName: "Bwi", comment: "")),
|
||||
message: Text(ServerDowntimeDefaultService().downtimeText()),
|
||||
dismissButton: .destructive(Text(NSLocalizedString("downtime_alert_dismiss_button", tableName: "Bwi", comment: ""))) {
|
||||
viewModel.send(viewAction: .login)
|
||||
})
|
||||
}
|
||||
.alert(isPresented: $showServerMaintananceDefaultAlert) {
|
||||
Alert(title: Text(NSLocalizedString("downtime_title", tableName: "Bwi", comment: "")),
|
||||
message: Text(NSLocalizedString("downtime_default_message", tableName: "Bwi", comment: "")),
|
||||
dismissButton: .destructive(Text(NSLocalizedString("downtime_alert_dismiss_button", tableName: "Bwi", comment: ""))) {
|
||||
viewModel.send(viewAction: .login)
|
||||
})
|
||||
}
|
||||
.alert(isPresented: $showInvalidAppVersionAlert) {
|
||||
Alert(title: Text(VectorL10n.bwiOutdatedVersionWarningTitle),
|
||||
message: Text(VectorL10n.bwiOutdatedVersionWarningMessage),
|
||||
@@ -78,11 +99,28 @@ struct OnboardingBwiSplashScreen: View {
|
||||
}
|
||||
|
||||
private func startButtonAction() {
|
||||
if BuildSettings.bwiCheckAppVersion && ValidAppVersionsDefaultService().isCurrentAppVersionDeprecated() {
|
||||
showInvalidAppVersionAlert = true
|
||||
} else {
|
||||
// let service = ServerDowntimeDefaultService()
|
||||
// if service.isDowntimePresentable() /*&& service.isDowntimeNow()*/ {
|
||||
// showServerMaintananceAlert = true
|
||||
// } else {
|
||||
viewModel.send(viewAction: .login)
|
||||
}
|
||||
// }
|
||||
|
||||
// isFetchingDowntime = true // show progresview
|
||||
//
|
||||
// let service = ServerDowntimeDefaultService()
|
||||
// service.fetchDowntimesWithDirectRequest { success in
|
||||
// self.isFetchingDowntime = false // hide progressview
|
||||
// if success {
|
||||
// if service.isDowntimePresentable() && service.isDowntimeNow() {
|
||||
// showServerMaintananceAlert = true
|
||||
// } else {
|
||||
// viewModel.send(viewAction: .login)
|
||||
// }
|
||||
// } else {
|
||||
// showServerMaintananceDefaultAlert = true
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user