From 8f304fcfddcf4bc4e1fcc4e907f74f60b167f8e5 Mon Sep 17 00:00:00 2001
From: jakob <jakob.bode@fu-berlin.de>
Date: Wed, 15 Aug 2018 15:58:56 +0200
Subject: [PATCH] handle contents of views

---
 ...nboardingSetupLongPageViewController.swift | 33 +++++++++++++++++--
 1 file changed, 30 insertions(+), 3 deletions(-)

diff --git a/enzevalos_iphone/OnboardingSetupLongPageViewController.swift b/enzevalos_iphone/OnboardingSetupLongPageViewController.swift
index 7d1440f7..aa2232db 100644
--- a/enzevalos_iphone/OnboardingSetupLongPageViewController.swift
+++ b/enzevalos_iphone/OnboardingSetupLongPageViewController.swift
@@ -259,15 +259,42 @@ extension OnboardingSetupLongPageViewController: OnboardingConfirmationDelegate
         let onboardingDataHandler = OnboardingDataHandler.handler
         var mailaddress = ""
         var password = ""
+        var username = ""
+        var imapServer = ""
+        var imapPort = 0
+        var imapEncryption = MCOConnectionType.clear.rawValue
+        var imapAuthentification = MCOAuthType.saslPlain.rawValue
+        var smtpServer = ""
+        var smtpPort = 0
+        var smtpEncryption = MCOConnectionType.clear.rawValue
+        var smtpAuthentification = MCOAuthType.saslPlain.rawValue
         //TODO add more
         
         if let controller = credentialsController {
             mailaddress = controller.textFieldTop.text ?? ""
+            password = controller.textFieldBottom.text ?? ""
+        }
+        if let controller = usernameController {
+            username = controller.textFieldTop.text ?? ""
+        }
+        if let controller = imapServerController {
+            imapServer = controller.textFieldTop.text ?? ""
+            imapPort = Int(controller.textFieldBottom.text ?? "0") ?? 0
+        }
+        if let controller = imapConnectionController {
+            imapEncryption = controller.pickerViewTop.selectedRow(inComponent: 0)
+            imapAuthentification = controller.pickerViewBottom.selectedRow(inComponent: 0)
+        }
+        if let controller = smtpServerController {
+            smtpServer = controller.textFieldTop.text ?? ""
+            smtpPort = Int(controller.textFieldBottom.text ?? "0") ?? 0
+        }
+        if let controller = smtpConnectionController {
+            smtpEncryption = controller.pickerViewTop.selectedRow(inComponent: 0)
+            smtpAuthentification = controller.pickerViewBottom.selectedRow(inComponent: 0)
         }
-        //TODO add more
         
-        //TODO
-        //onboardingDataHandler.setSettings(with: mailaddress, password: password, username: <#T##String#>, imapServer: <#T##String#>, imapPort: <#T##Int#>, imapConnectionType: <#T##String#>, imapAuthenticationType: <#T##String#>, smtpServer: <#T##String#>, smtpPort: <#T##Int#>, smtpConnectionType: <#T##String#>, smtpAuthenticationType: <#T##String#>)
+        onboardingDataHandler.setSettings(with: mailaddress, password: password, username: username, imapServer: imapServer, imapPort: imapPort, imapConnectionType: imapEncryption, imapAuthenticationType: imapAuthentification, smtpServer: smtpServer, smtpPort: smtpPort, smtpConnectionType: smtpEncryption, smtpAuthenticationType: smtpAuthentification)
         let setupController = self.storyboard?.instantiateViewController(withIdentifier: "validateSetupLong") as! OnboardingValidateSetupLongPageViewController
         self.present(setupController, animated: true, completion: nil)
     }
-- 
GitLab