diff --git a/enzevalos_iphone/AuthenticationModel.swift b/enzevalos_iphone/AuthenticationModel.swift index d9ee43dbc12ba9d5d549df77563cccb63a543a77..650953c5cda8c6f0ccc3c6b4e8213f1b350dfbd8 100644 --- a/enzevalos_iphone/AuthenticationModel.swift +++ b/enzevalos_iphone/AuthenticationModel.swift @@ -9,6 +9,9 @@ import Foundation import Combine +/** + Model of the Authentication according to MVVP pattern. Performs all the necessary server calls according to the data provided by the ViewModel + */ class AuthenticationModel: NSObject { enum AuthenticationResult {case Success, Timeout, Error(value: MailServerConnectionError)} @@ -29,6 +32,12 @@ class AuthenticationModel: NSObject { /** Start asynchronous tasks for checking IMAP and SMTP configuration with a *timeoutDelay* after which the tasks are not getting consumed anymore. + + - Parameters: + - mailAccount: data class that holds the properties used for establishing the connection + - extendedValidation: indicates whether the imap/smtp configuration got specified by the user or should use default values + + - Returns: a Future that produces an AuthenticationResult once the server calls are done */ func checkConfig(mailAccount: MailAccount, extendedValidation: Bool) -> Future<AuthenticationResult, Never> { self.extendedValidation = extendedValidation @@ -152,9 +161,11 @@ class AuthenticationModel: NSObject { smtpConfigurationSuccessful = false } dispatchGroup.leave() - return } + /** + A listner class that notifies the AuthenticationCallback's about the result once the server call is done + */ class Listener: MailSessionListener { let callback: AuthenticationCallback let mailAccount: MailAccount diff --git a/enzevalos_iphone/AuthenticationScreen.swift b/enzevalos_iphone/AuthenticationScreen.swift index 494b2c215d2da8f8acd621126ee854743b709667..b4945a7fc601b663cdf933b9978836c3964e37f4 100644 --- a/enzevalos_iphone/AuthenticationScreen.swift +++ b/enzevalos_iphone/AuthenticationScreen.swift @@ -8,6 +8,9 @@ import SwiftUI +/** + View of the Authentication according to MVVP pattern. Observes the AuthenticationViewModel and adjusts the displayed data accordingly + */ struct AuthenticationScreen: View { @State private var login: String = "" @State private var password: String = "" diff --git a/enzevalos_iphone/AuthenticationViewModel.swift b/enzevalos_iphone/AuthenticationViewModel.swift index 7679b3e4606b16cb263d1de7e704fe692f8a56fc..cfe61434940d087aae915ac2ec90aa3e252d1d79 100644 --- a/enzevalos_iphone/AuthenticationViewModel.swift +++ b/enzevalos_iphone/AuthenticationViewModel.swift @@ -9,6 +9,9 @@ import Foundation import Combine +/** + ViewModel of the Authentication according to MVVP pattern. Uses AuthenticationModel to get the result of the authentication. + */ class AuthenticationViewModel : ObservableObject { @Published var errorMessage: String?