Merge branch 'feature/4933_appversion_check_on_login' into 'develop'

MESSENGER-4933 appversion check on login

See merge request bwmessenger/bundesmessenger/bundesmessenger-ios!220
This commit is contained in:
Frank Rotermund
2023-09-19 13:47:04 +00:00
3 changed files with 17 additions and 1 deletions
@@ -134,4 +134,6 @@ enum AuthenticationLoginErrorType: Hashable {
case invalidHomeserver
/// The response from the homeserver was unexpected.
case unknown
/// Appversion is too old
case appVersion
}
@@ -80,6 +80,16 @@ class AuthenticationLoginViewModel: AuthenticationLoginViewModelType, Authentica
message: VectorL10n.authenticationServerSelectionGenericError)
case .unknown:
state.bindings.alertInfo = AlertInfo(id: type)
case .appVersion:
state.bindings.alertInfo = AlertInfo(id: type,
title: BWIL10n.bwiDeprecatedVersionWarningTitle,
message: BWIL10n.bwiDeprecatedVersionWarningMessage,
primaryButton: (BWIL10n.bwiDeprecatedVersionAppstoreButton, {
UIApplication.shared.open(URL(string: BWIBuildSettings.shared.itunesAppLink)!)
}),
secondaryButton: (VectorL10n.ok, {}))
}
}
@@ -130,7 +130,11 @@ final class AuthenticationLoginCoordinator: Coordinator, Presentable {
self.showForgotPasswordScreen()
}
case .login(let username, let password):
self.login(username: username, password: password)
if BWIBuildSettings.shared.bwiCheckAppVersion && ValidAppVersionsDefaultService().isCurrentAppVersionDeprecated() {
authenticationLoginViewModel.displayError(.appVersion)
} else {
self.login(username: username, password: password)
}
case .continueWithSSO(let identityProvider):
self.callback?(.continueWithSSO(identityProvider))
case .fallback: