mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-20 00:24:43 +02:00
Feature/3811 appconfig
This commit is contained in:
@@ -16,10 +16,6 @@
|
||||
|
||||
import SwiftUI
|
||||
|
||||
enum OnBoardingSplashScreenAlertType {
|
||||
case showServerMaintenanceInfoMessageAlert, showServerMaintenanceDefaultAlert, showInvalidAppVersionAlert, showDowntimeTimeAlert
|
||||
}
|
||||
|
||||
@available(iOS 14.0, *)
|
||||
/// The splash screen shown at the beginning of the onboarding flow.
|
||||
struct OnboardingBwiSplashScreen: View {
|
||||
@@ -36,7 +32,7 @@ struct OnboardingBwiSplashScreen: View {
|
||||
@State private var overlayFrame: CGRect = .zero
|
||||
@State private var isFetchingDowntime = false
|
||||
@State private var showAlert = false
|
||||
@State private var activeAlert: OnBoardingSplashScreenAlertType = .showInvalidAppVersionAlert
|
||||
@State private var activeAlert: ServerMaintenanceAlertType = .showInvalidAppVersionAlert
|
||||
|
||||
// MARK: Public
|
||||
|
||||
@@ -79,40 +75,8 @@ struct OnboardingBwiSplashScreen: View {
|
||||
.navigationTitle("")
|
||||
.navigationBarHidden(true)
|
||||
.alert(isPresented: $showAlert, content: {
|
||||
switch activeAlert {
|
||||
case .showInvalidAppVersionAlert:
|
||||
return Alert(title: Text(BWIL10n.bwiOutdatedVersionWarningTitle),
|
||||
message: Text(BWIL10n.bwiOutdatedVersionWarningMessage(AppInfo.current.displayName)),
|
||||
dismissButton: .destructive(Text(BWIL10n.bwiOutdatedVersionAppstoreButton), action: {
|
||||
let iTunesLink = BWIBuildSettings.shared.itunesAppLink
|
||||
UIApplication.shared.open(URL(string: iTunesLink)!, options: [:], completionHandler: nil)
|
||||
}))
|
||||
case .showDowntimeTimeAlert:
|
||||
return Alert(title: Text(BWIL10n.downtimeTitle),
|
||||
message: Text(ServerDowntimeDefaultService().downtimeText() != "" ? BWIL10n.downtimeDefaultMessage + "\n\n" + ServerDowntimeDefaultService().downtimeText() : BWIL10n.downtimeDefaultMessage),
|
||||
dismissButton: .destructive(Text(service.isBlocking() ? BWIL10n.blockingDowntimeAlertDismissButton : BWIL10n.downtimeAlertDismissButton)) {
|
||||
if service.isBlocking() {
|
||||
return
|
||||
} else {
|
||||
viewModel.send(viewAction: .login)
|
||||
}
|
||||
})
|
||||
case .showServerMaintenanceInfoMessageAlert:
|
||||
return Alert(title: Text(""),
|
||||
message: Text(ServerDowntimeDefaultService().downtimeText()),
|
||||
dismissButton: .destructive(Text(service.isBlocking() ? BWIL10n.blockingDowntimeAlertDismissButton : BWIL10n.downtimeAlertDismissButton)) {
|
||||
if service.isBlocking() {
|
||||
return
|
||||
} else {
|
||||
viewModel.send(viewAction: .login)
|
||||
}
|
||||
})
|
||||
case .showServerMaintenanceDefaultAlert:
|
||||
return Alert(title: Text(BWIL10n.downtimeTitle),
|
||||
message: Text(BWIL10n.downtimeDefaultMessage),
|
||||
dismissButton: .destructive(Text(BWIL10n.downtimeAlertDismissButton)) {
|
||||
viewModel.send(viewAction: .login)
|
||||
})
|
||||
service.alert(alertType: activeAlert) {
|
||||
viewModel.send(viewAction: .login)
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -146,24 +110,11 @@ struct OnboardingBwiSplashScreen: View {
|
||||
|
||||
|
||||
private func showAlertIfNeeded() {
|
||||
switch service.nextDowntimeStatus() {
|
||||
case .none:
|
||||
viewModel.send(viewAction: .login)
|
||||
break
|
||||
case .ongoing:
|
||||
if service.downtimeType() == .adhocMessage {
|
||||
activeAlert = .showServerMaintenanceInfoMessageAlert
|
||||
} else {
|
||||
activeAlert = .showDowntimeTimeAlert
|
||||
}
|
||||
if service.showAlert() {
|
||||
activeAlert = service.alertType()
|
||||
showAlert = true
|
||||
break
|
||||
case .warning:
|
||||
// only show active downtimes
|
||||
} else {
|
||||
viewModel.send(viewAction: .login)
|
||||
// showAlert = true
|
||||
// activeAlert = .showServerMaintenanceAlert
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user