diff --git a/enzevalos_iphone/AuthenticationScreen.swift b/enzevalos_iphone/AuthenticationScreen.swift index 6232bc3d477bd346423350624312abf48f9fc979..17d6fcfe7766a241340f0d22c6589c251dd29d97 100644 --- a/enzevalos_iphone/AuthenticationScreen.swift +++ b/enzevalos_iphone/AuthenticationScreen.swift @@ -86,7 +86,7 @@ struct AuthenticationScreen: View { }.padding() //TODO: once SWIFTUI supports optionals improve this if statement - if self.viewModel.errorMessage != nil && !self.viewModel.errorMessage!.isEmpty { + if shouldDisplayErrorMessage() { VStack { Text(self.viewModel.errorMessage!) .foregroundColor(Color.white) @@ -96,5 +96,9 @@ struct AuthenticationScreen: View { } } } + + func shouldDisplayErrorMessage() -> Bool { + return (self.viewModel.errorMessage != nil) && (!self.viewModel.errorMessage!.isEmpty) + } } diff --git a/enzevalos_iphone/AuthenticationViewModel.swift b/enzevalos_iphone/AuthenticationViewModel.swift index ae2756102cd2c358857be596fe0508bfbd9e51ea..ce0edb1bf7b9697cefadde7d056d0c2113646578 100644 --- a/enzevalos_iphone/AuthenticationViewModel.swift +++ b/enzevalos_iphone/AuthenticationViewModel.swift @@ -56,7 +56,7 @@ class AuthenticationViewModel : ObservableObject { let timeoutDelay: DispatchTimeInterval = DispatchTimeInterval.seconds(10) let result = self.dispatchGroup.wait(timeout: DispatchTime.now() + timeoutDelay) DispatchQueue.main.async { - self.timeoutOccured(timeoutResult: result) + self.onTimeout(timeoutResult: result) } } } @@ -156,7 +156,7 @@ class AuthenticationViewModel : ObservableObject { errorMessage = NSLocalizedString(MailServerConnectionError.TimeoutError.localizedUIBodyString, comment: "") } - func timeoutOccured(timeoutResult: DispatchTimeoutResult) { + func onTimeout(timeoutResult: DispatchTimeoutResult) { imapCallback?.callback = nil smtpCallback?.callback = nil if timeoutResult == .success { @@ -176,7 +176,6 @@ class AuthenticationViewModel : ObservableObject { imapConfigurationSuccessful = true } else { imapConfigurationSuccessful = false - authenticationFailed() } dispatchGroup.leave() } @@ -187,7 +186,6 @@ class AuthenticationViewModel : ObservableObject { smtpConfigurationSuccessful = true } else { smtpConfigurationSuccessful = false - authenticationFailed() } dispatchGroup.leave() return diff --git a/enzevalos_iphone/Onboarding.swift b/enzevalos_iphone/Onboarding.swift index 379dea0afdf2e1cd0d71538568b1136975b0a683..09ae1c25c2f2aca1a6e8341adc1c353cf2e7c942 100644 --- a/enzevalos_iphone/Onboarding.swift +++ b/enzevalos_iphone/Onboarding.swift @@ -186,7 +186,7 @@ class Onboarding: NSObject { keyboardToolbar.sizeToFit() keyboardToolbar.barTintColor = defaultColor keyboardToolbar.backgroundColor = defaultColor - let googleBarButton = UIBarButtonItem(title: "Login with Google", style: .plain, target: self, action: #selector(startGoogleOauth)) + let googleBarButton = UIBarButtonItem(title: "Login with Google", style: .plain, target: self, action: #selector(oauth)) googleBarButton.tintColor = .orange googleButton = googleBarButton let flexBarButton = UIBarButtonItem(barButtonSystemItem: .flexibleSpace, target: nil, action: nil) diff --git a/enzevalos_iphone/de.lproj/Localizable.strings b/enzevalos_iphone/de.lproj/Localizable.strings index 0eda774b5f7aebf7e635d1d413ad15984b2b4c5c..fd7241bbbf5cf228082c94dff9c92836ca8a09dd 100644 --- a/enzevalos_iphone/de.lproj/Localizable.strings +++ b/enzevalos_iphone/de.lproj/Localizable.strings @@ -286,6 +286,8 @@ "MailServerError.Default.Body" = "Es konnte keine Verbindung zum Server hergestellt werden.\n Bitte überprüfe das Password, den Accountname und die Serverkonfiguration (IMAP/SMTP). Die Serverkonfiguration kann mit der Serverkonfiguration auf der Provider-Webseite verglichen werden. In manchen Fällen muss der Zugriff mittels IMAP/SMTP in den Accounteinstellungen erst freigeschaltet werden."; "MailServerError.IMAP.Body" = "Es konnte keine Verbindung zum Server hergestellt werden.\n Bitte überprüfe die IMAP Serverkonfiguration."; "MailServerError.SMTP.Body" = "Es konnte keine Verbindung zum Server hergestellt werden.\n Bitte überprüfe die SMTP Serverkonfiguration."; +"MailServerError.Timeout.Body" = "Der Server hat nicht rechtzeitig geantwortet"; + "Read.Import.Secret.Title" = "Neuer geheimer Schlüssel"; "Read.Import.Secret.Body.PW" = "gib zum Importieren das Passwort für den geheimen Schlüssel mit der ID %@ ein."; diff --git a/enzevalos_iphone/en.lproj/Localizable.strings b/enzevalos_iphone/en.lproj/Localizable.strings index e31af588a2daa284b2e3f808ed88292362df2183..17e74684475add999de8c9917024a51ae2d19665 100644 --- a/enzevalos_iphone/en.lproj/Localizable.strings +++ b/enzevalos_iphone/en.lproj/Localizable.strings @@ -256,6 +256,7 @@ "MailServerError.Default.Body" = "Couldn't connect to server.\n Please, check your account name, password and server configuration. You can also compare the server configuration with the configuration listed on the website of your provider. In some cases, you have to activate the IMAP/SMTP connection in your account settings."; "MailServerError.IMAP.Body" = "Couldn't connect to server.\n Please check your IMAP server configuration."; "MailServerError.SMTP.Body" = "Couldn't connect to server.\n Please check your SMTP server configuration."; +"MailServerError.Timeout.Body" = "Server didn't answer in time"; "Read.Import.Secret.Title" = "New secret"; "Read.Import.Secret.Body.PW" = "Please, enter the password to import the new secret key with the id: %@.";