From f92e52aaeee4394a598a6367af13dcd84c1fa4d4 Mon Sep 17 00:00:00 2001
From: Oliver Wiese <oliver.wiese@fu-berlin.de>
Date: Thu, 19 Mar 2020 21:13:52 +0100
Subject: [PATCH] add gesture to transport encryption type picker

---
 enzevalos_iphone.xcodeproj/project.pbxproj             |  2 +-
 enzevalos_iphone/AuthenticationView.swift              | 10 ++++++++++
 enzevalos_iphone/MailAccount.swift                     |  1 -
 enzevalos_iphone/OnboardingIntro.swift                 |  2 +-
 .../SupportingViews}/KeyboardChecker.swift             |  0
 .../SwiftUI/SupportingViews/SearchView.swift           |  2 +-
 enzevalos_iphoneTests/GeneratedMocks.swift             | 10 ++++++----
 7 files changed, 19 insertions(+), 8 deletions(-)
 rename enzevalos_iphone/{ => SwiftUI/SupportingViews}/KeyboardChecker.swift (100%)

diff --git a/enzevalos_iphone.xcodeproj/project.pbxproj b/enzevalos_iphone.xcodeproj/project.pbxproj
index df2f5df7..b0d5d745 100644
--- a/enzevalos_iphone.xcodeproj/project.pbxproj
+++ b/enzevalos_iphone.xcodeproj/project.pbxproj
@@ -1011,6 +1011,7 @@
 		4764068C2416B54D00C7D426 /* SupportingViews */ = {
 			isa = PBXGroup;
 			children = (
+				47EABF282423C1FB00774A93 /* KeyboardChecker.swift */,
 				4764068D2416B54D00C7D426 /* CiricleImage.swift */,
 				4764068E2416B54D00C7D426 /* SearchView.swift */,
 				4764068F2416B54D00C7D426 /* MailView.swift */,
@@ -1151,7 +1152,6 @@
 			isa = PBXGroup;
 			children = (
 				AD97DFBD241F97A300C35B95 /* OnboardingIntroInfoSection.swift */,
-				47EABF282423C1FB00774A93 /* KeyboardChecker.swift */,
 				47EABF0C241A9CA800774A93 /* MailAccount.swift */,
 				47EABF06241A9C8700774A93 /* AuthenticationModel.swift */,
 				47EABF262423BFDD00774A93 /* AuthenticationScreen.swift */,
diff --git a/enzevalos_iphone/AuthenticationView.swift b/enzevalos_iphone/AuthenticationView.swift
index 8c68f3bd..ca9a99d3 100644
--- a/enzevalos_iphone/AuthenticationView.swift
+++ b/enzevalos_iphone/AuthenticationView.swift
@@ -126,6 +126,7 @@ var body: some View {
             
             Text(NSLocalizedString("Onboarding.enterPassword", comment: ""))
                 .padding(.bottom, smallspace)
+            // PW
             ZStack (alignment: .trailing) {
                 if secured {
                     SecureField(NSLocalizedString("Your password", comment: ""), text: $password)
@@ -209,6 +210,14 @@ struct LoginAdvancedSection: View{
             Picker(selection: s ? $smtpEncryption : $imapEncryption , label: Text(s ? "SMTP-Transportencryption" : "IMAP-Transportencryption")) {
                 ForEach(0..<encryptionOptions.count) { i in
                     Text(self.encryptionOptions[i]).tag(i)
+                        .onTapGesture {
+                            print("Tap!")
+                        if !s {
+                            self.imapEncryption = i
+                        } else {
+                            self.smtpEncryption = i
+                        }
+                    }
                 }
             }
             .pickerStyle(SegmentedPickerStyle())
@@ -267,6 +276,7 @@ struct LoginAdvancedSection: View{
             }
         }
     }
+    
 }
 
 
diff --git a/enzevalos_iphone/MailAccount.swift b/enzevalos_iphone/MailAccount.swift
index 87c2fde3..ce8d89c2 100644
--- a/enzevalos_iphone/MailAccount.swift
+++ b/enzevalos_iphone/MailAccount.swift
@@ -12,7 +12,6 @@ class MailAccount {
     
     let emailAddress: String
     let password: String
-    //TODO: describe what username is
     let username: String?
     let imapServer: String
     let imapPort: Int
diff --git a/enzevalos_iphone/OnboardingIntro.swift b/enzevalos_iphone/OnboardingIntro.swift
index 7afac545..a12798f0 100644
--- a/enzevalos_iphone/OnboardingIntro.swift
+++ b/enzevalos_iphone/OnboardingIntro.swift
@@ -16,7 +16,7 @@ struct OnboardingIntro: View {
     var body: some View {
         VStack(alignment: .center){
             Spacer()
-            Text(NSLocalizedString("Onboarding.headline", comment: "Welcome"))
+        Text(NSLocalizedString("Onboarding.headline", comment: "Welcome"))
                 .font(.system(size: 55))
                 .fontWeight(.heavy)
             ZStack(alignment: .bottom){
diff --git a/enzevalos_iphone/KeyboardChecker.swift b/enzevalos_iphone/SwiftUI/SupportingViews/KeyboardChecker.swift
similarity index 100%
rename from enzevalos_iphone/KeyboardChecker.swift
rename to enzevalos_iphone/SwiftUI/SupportingViews/KeyboardChecker.swift
diff --git a/enzevalos_iphone/SwiftUI/SupportingViews/SearchView.swift b/enzevalos_iphone/SwiftUI/SupportingViews/SearchView.swift
index a1e897e2..cf10c7c7 100644
--- a/enzevalos_iphone/SwiftUI/SupportingViews/SearchView.swift
+++ b/enzevalos_iphone/SwiftUI/SupportingViews/SearchView.swift
@@ -95,7 +95,7 @@ struct SearchView: View {
     var searchSegment: some View {
         Picker(selection: $searchField, label: EmptyView()) {
         ForEach(0..<SearchType.allCases.count) { index in
-                Text(SearchType.allCases[index].text).tag(index)
+            Text(SearchType.allCases[index].text).tag(index)
                     .onTapGesture {
                         self.searchField = index
                 }
diff --git a/enzevalos_iphoneTests/GeneratedMocks.swift b/enzevalos_iphoneTests/GeneratedMocks.swift
index db5f7320..9258688a 100644
--- a/enzevalos_iphoneTests/GeneratedMocks.swift
+++ b/enzevalos_iphoneTests/GeneratedMocks.swift
@@ -1,12 +1,13 @@
-// MARK: - Mocks generated from file: enzevalos_iphone/AuthenticationModel.swift at 2020-03-18 10:30:41 +0000
+// MARK: - Mocks generated from file: enzevalos_iphone/AuthenticationModel.swift at 2020-03-19 20:04:04 +0000
 
 //
 //  AuthenticationModel.swift
 //  enzevalos_iphone
 //
-//  Created by SWP Usable Security für Smartphones on 10.03.20.
+//  Created by hanneh00 on 18.03.20.
 //  Copyright © 2020 fu-berlin. All rights reserved.
 //
+
 import Cuckoo
 @testable import enzevalos_iphone
 
@@ -653,15 +654,16 @@ import Foundation
 }
 
 
-// MARK: - Mocks generated from file: enzevalos_iphone/AuthenticationViewModel.swift at 2020-03-18 10:30:41 +0000
+// MARK: - Mocks generated from file: enzevalos_iphone/AuthenticationViewModel.swift at 2020-03-19 20:04:04 +0000
 
 //
 //  AuthenticationViewModel.swift
 //  enzevalos_iphone
 //
-//  Created by SWP Usable Security für Smartphones on 02.03.20.
+//  Created by Cezary Pilaszewicz on 02.03.20.
 //  Copyright © 2020 fu-berlin. All rights reserved.
 //
+
 import Cuckoo
 @testable import enzevalos_iphone
 
-- 
GitLab