From a2d70799c4f72d7a7683285a7d06c8f0061e6d13 Mon Sep 17 00:00:00 2001
From: cpilaszewicz <khutbvdw>
Date: Thu, 12 Mar 2020 12:07:23 +0100
Subject: [PATCH] Add description of the MVVM elements ot the corresponding
 classes. Also some doc for methods

---
 enzevalos_iphone/AuthenticationModel.swift     | 13 ++++++++++++-
 enzevalos_iphone/AuthenticationScreen.swift    |  3 +++
 enzevalos_iphone/AuthenticationViewModel.swift |  3 +++
 3 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/enzevalos_iphone/AuthenticationModel.swift b/enzevalos_iphone/AuthenticationModel.swift
index d9ee43db..650953c5 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 494b2c21..b4945a7f 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 7679b3e4..cfe61434 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?
-- 
GitLab