diff --git a/enzevalos_iphone.xcodeproj/project.pbxproj b/enzevalos_iphone.xcodeproj/project.pbxproj index fedbb84ca73a3da5fec316c2d1d95e1a634f9307..1b05418f2be86789c125845841dda898db972bdb 100644 --- a/enzevalos_iphone.xcodeproj/project.pbxproj +++ b/enzevalos_iphone.xcodeproj/project.pbxproj @@ -191,6 +191,7 @@ A1F992391DA7DD2E0073BF1B /* InboxTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = A1F9923B1DA7DD2E0073BF1B /* InboxTableViewCell.xib */; }; A1FA44A721E10E1400DB02AC /* TravelHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = A1FA44A621E10E1400DB02AC /* TravelHandler.swift */; }; AC4001CA169DC07A7A1E3AD3 /* Pods_enzevalos_iphone.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 94EE54279AB591E0CAB8EFD8 /* Pods_enzevalos_iphone.framework */; }; + D76938018EDE28949DF8DF0A /* Pods_enzevalos_iphoneUITests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EF232CF5EE5EE7B9838EBDF4 /* Pods_enzevalos_iphoneUITests.framework */; }; F113C3851F30D06800E7F1D6 /* QRScannerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F113C3841F30D06800E7F1D6 /* QRScannerView.swift */; }; F113C38B1F3344C200E7F1D6 /* ViewControllerPannable.swift in Sources */ = {isa = PBXBuildFile; fileRef = F113C38A1F3344C200E7F1D6 /* ViewControllerPannable.swift */; }; F119D2901E364B59001D732A /* AnimatedSendIcon.swift in Sources */ = {isa = PBXBuildFile; fileRef = F119D28F1E364B59001D732A /* AnimatedSendIcon.swift */; }; @@ -198,7 +199,7 @@ F12041FD1DA409A5002E4940 /* ListViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = F12041FC1DA409A5002E4940 /* ListViewCell.swift */; }; F12060801DA540FE00F6EF37 /* RefreshControlExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = F120607F1DA540FE00F6EF37 /* RefreshControlExtension.swift */; }; F12060821DA552FC00F6EF37 /* MailHandlerDelegator.swift in Sources */ = {isa = PBXBuildFile; fileRef = F12060811DA552FC00F6EF37 /* MailHandlerDelegator.swift */; }; - F120A7D31F7937BB006D5BF1 /* (null) in Frameworks */ = {isa = PBXBuildFile; }; + F120A7D31F7937BB006D5BF1 /* BuildFile in Frameworks */ = {isa = PBXBuildFile; }; F12D8DBB2069422A0068788E /* About.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F12D8DBD2069422A0068788E /* About.storyboard */; }; F14239C11F30A99C00998A83 /* QRCodeGenerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = F14239C01F30A99C00998A83 /* QRCodeGenerator.swift */; }; F1737ACB2031D7D70000312B /* StudySettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = A17FDFF2202C685800F7BA89 /* StudySettings.swift */; }; @@ -495,6 +496,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + D76938018EDE28949DF8DF0A /* Pods_enzevalos_iphoneUITests.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -506,7 +508,7 @@ 47F867E42052B49800AA832F /* libbz2.tbd in Frameworks */, 47F867E22052B48E00AA832F /* libz.tbd in Frameworks */, 47F867E02052B47C00AA832F /* Security.framework in Frameworks */, - F120A7D31F7937BB006D5BF1 /* (null) in Frameworks */, + F120A7D31F7937BB006D5BF1 /* BuildFile in Frameworks */, 472F396E1E14F384009260FB /* CoreData.framework in Frameworks */, AC4001CA169DC07A7A1E3AD3 /* Pods_enzevalos_iphone.framework in Frameworks */, ); @@ -1128,6 +1130,7 @@ isa = PBXNativeTarget; buildConfigurationList = 476EEF9D22A872BF00BB4EF7 /* Build configuration list for PBXNativeTarget "enzevalos_iphoneUITests" */; buildPhases = ( + E1C52B0447A565FBE3CAA203 /* [CP] Check Pods Manifest.lock */, 476EEF9222A872BF00BB4EF7 /* Sources */, 476EEF9322A872BF00BB4EF7 /* Frameworks */, 476EEF9422A872BF00BB4EF7 /* Resources */, @@ -1198,13 +1201,14 @@ 476EEF9522A872BF00BB4EF7 = { CreatedOnToolsVersion = 10.1; DevelopmentTeam = VJ9C93G68Y; + LastSwiftMigration = 1020; ProvisioningStyle = Automatic; TestTargetID = A13526741D955BDF00D3BFE1; }; A13526741D955BDF00D3BFE1 = { CreatedOnToolsVersion = 7.3.1; DevelopmentTeam = VJ9C93G68Y; - LastSwiftMigration = 1010; + LastSwiftMigration = 1020; ProvisioningStyle = Automatic; SystemCapabilities = { com.apple.BackgroundModes = { @@ -1221,7 +1225,7 @@ A135268B1D955BE000D3BFE1 = { CreatedOnToolsVersion = 7.3.1; DevelopmentTeam = 4377G946WP; - LastSwiftMigration = 1010; + LastSwiftMigration = 1020; }; }; }; @@ -1420,6 +1424,28 @@ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; + E1C52B0447A565FBE3CAA203 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-enzevalos_iphoneUITests-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -1667,6 +1693,7 @@ /* Begin XCBuildConfiguration section */ 476EEF9E22A872BF00BB4EF7 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 9A132EDE8BCA06ACDB505C22 /* Pods-enzevalos_iphoneUITests.debug.xcconfig */; buildSettings = { CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; @@ -1685,7 +1712,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "FU-Berlin.enzevalos-iphoneUITests"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; TEST_TARGET_NAME = enzevalos_iphone; }; @@ -1693,6 +1720,7 @@ }; 476EEF9F22A872BF00BB4EF7 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 796D16D79BED5D60B580E602 /* Pods-enzevalos_iphoneUITests.release.xcconfig */; buildSettings = { CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; @@ -1709,7 +1737,7 @@ MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = "FU-Berlin.enzevalos-iphoneUITests"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; TEST_TARGET_NAME = enzevalos_iphone; }; @@ -1883,7 +1911,7 @@ SWIFT_OBJC_BRIDGING_HEADER = "enzevalos_iphone-Bridging-Header.h"; "SWIFT_OBJC_BRIDGING_HEADER[arch=*]" = "enzevalos_iphone/enzevalos_iphone-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -1940,7 +1968,7 @@ PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_OBJC_BRIDGING_HEADER = "enzevalos_iphone-Bridging-Header.h"; "SWIFT_OBJC_BRIDGING_HEADER[sdk=*]" = "enzevalos_iphone/enzevalos_iphone-Bridging-Header.h"; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; "USER_HEADER_SEARCH_PATHS[arch=*]" = ""; }; name = Release; @@ -1965,7 +1993,7 @@ ); PRODUCT_BUNDLE_IDENTIFIER = "fu-berlin.enzevalos-iphoneTests"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; TEST_HOST = "$(BUNDLE_LOADER)"; }; name = Debug; @@ -1990,7 +2018,7 @@ ); PRODUCT_BUNDLE_IDENTIFIER = "fu-berlin.enzevalos-iphoneTests"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; TEST_HOST = "$(BUNDLE_LOADER)"; }; name = Release; diff --git a/enzevalos_iphone/AppDelegate.swift b/enzevalos_iphone/AppDelegate.swift index 840bbb9932d527654efcab2a0e0021fac5698475..bbd1aea8edaab95e422b2917135a0c4a38ed62a9 100644 --- a/enzevalos_iphone/AppDelegate.swift +++ b/enzevalos_iphone/AppDelegate.swift @@ -47,11 +47,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { } resetApp() StudySettings.setupStudy() - //StudySettings.firstMail() if (!UserDefaults.standard.bool(forKey: "launchedBefore")) { -// Logger.queue.async(flags: .barrier) { - // Logger.log(startApp: true) -// } // Remove Google Auth token from keychain GTMKeychain.removePasswordFromKeychain(forName: "googleOAuthCodingKey") @@ -60,14 +56,12 @@ class AppDelegate: UIResponder, UIApplicationDelegate { UserDefaults.standard.register(defaults: ["Signature.Text": "Verfasst mit Letterbox. Mehr Informationen: http://letterbox.imp.fu-berlin.de?invitation=0"]) self.window = UIWindow(frame: UIScreen.main.bounds) - //self.window?.rootViewController = UIStoryboard(name: "Main", bundle: nil).instantiateViewControllerWithIdentifier("onboarding") self.window?.rootViewController = Onboarding.onboarding() self.window?.makeKeyAndVisible() } else { AddressHandler.updateCNContacts() - // Logger.log(startApp: false) presentInboxViewController() } NotificationCenter.default.addObserver( diff --git a/enzevalos_iphone/Base.lproj/Main.storyboard b/enzevalos_iphone/Base.lproj/Main.storyboard index 52f63cca82a0c4cc34668f961f703508137016e9..87f9053222b1de62e1021591899b595ef19f42b3 100644 --- a/enzevalos_iphone/Base.lproj/Main.storyboard +++ b/enzevalos_iphone/Base.lproj/Main.storyboard @@ -158,7 +158,7 @@ <rect key="frame" x="16" y="0.0" width="288" height="44"/> <subviews> <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="I7i-jf-aSX"> - <rect key="frame" x="0.0" y="0.0" width="147" height="44"/> + <rect key="frame" x="0.0" y="5.5" width="147" height="33"/> <constraints> <constraint firstAttribute="height" constant="44" id="81H-Ed-3bH"/> </constraints> @@ -182,7 +182,7 @@ </constraints> </view> <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="qTi-rO-CH3"> - <rect key="frame" x="148" y="0.0" width="140" height="44"/> + <rect key="frame" x="148" y="5.5" width="140" height="33"/> <constraints> <constraint firstAttribute="height" constant="44" id="voC-CF-ncN"/> </constraints> @@ -576,8 +576,8 @@ <constraint firstAttribute="width" constant="15" id="ons-Pp-k3n"/> </constraints> </imageView> - <imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="sfv-2Q-95I"> - <rect key="frame" x="0.0" y="15" width="15" height="18"/> + <imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="sfv-2Q-95I"> + <rect key="frame" x="0.0" y="18" width="15" height="15"/> <constraints> <constraint firstAttribute="height" constant="15" id="SmT-9e-ovi"/> <constraint firstAttribute="width" constant="15" id="uKU-PK-flD"/> @@ -1011,11 +1011,11 @@ <rect key="frame" x="0.0" y="545.5" width="320" height="44"/> <autoresizingMask key="autoresizingMask"/> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="dM9-jb-EcN" id="tvN-re-z1Z"> - <rect key="frame" x="0.0" y="0.0" width="286" height="43.5"/> + <rect key="frame" x="0.0" y="0.0" width="294" height="43.5"/> <autoresizingMask key="autoresizingMask"/> <subviews> <label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="VTZ-4w-fot"> - <rect key="frame" x="16" y="0.0" width="269" height="43.5"/> + <rect key="frame" x="15" y="0.0" width="270" height="43.5"/> <autoresizingMask key="autoresizingMask"/> <fontDescription key="fontDescription" type="system" pointSize="17"/> <nil key="textColor"/> @@ -1488,7 +1488,7 @@ Um deine sicheren E-Mails auch auf einem anderen Gerät lesen zu können, muss d <nil key="textColor"/> <nil key="highlightedColor"/> </label> - <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="3456-7890-1234-" textAlignment="center" lineBreakMode="characterWrap" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="QaR-WZ-20E"> + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" text="3456-7890-1234-" textAlignment="center" lineBreakMode="characterWrap" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="QaR-WZ-20E"> <rect key="frame" x="85.5" y="173.5" width="153" height="17.5"/> <fontDescription key="fontDescription" type="boldSystem" pointSize="17"/> <nil key="textColor"/> @@ -1865,6 +1865,6 @@ Um deine sicheren E-Mails auch auf einem anderen Gerät lesen zu können, muss d <segue reference="hSn-Um-hji"/> <segue reference="btx-4o-o0r"/> <segue reference="TgN-rB-esa"/> - <segue reference="ecN-Wn-7S0"/> + <segue reference="6Ug-AV-lba"/> </inferredMetricsTieBreakers> </document> diff --git a/enzevalos_iphone/IntroPageViewController.swift b/enzevalos_iphone/IntroPageViewController.swift index 484f6fbfc9b493630bf382c2bdc3897d2e36ab8f..064a35dc10ba48360310bb2f59ab1ab15d788cf7 100644 --- a/enzevalos_iphone/IntroPageViewController.swift +++ b/enzevalos_iphone/IntroPageViewController.swift @@ -71,7 +71,7 @@ class IntroPageViewController: UIPageViewController, IntroInfoButton { } override func setViewControllers(_ viewControllers: [UIViewController]?, direction: UIPageViewController.NavigationDirection, animated: Bool, completion: ((Bool) -> Void)? = nil) { - if let viewControllers = viewControllers, let controller = viewControllers.first, let index = orderedViewControllers.index(of: controller) { + if let viewControllers = viewControllers, let controller = viewControllers.first, let index = orderedViewControllers.firstIndex(of: controller) { self.pageControl.currentPage = index } super.setViewControllers(viewControllers, direction: direction, animated: animated, completion: completion) @@ -81,14 +81,14 @@ class IntroPageViewController: UIPageViewController, IntroInfoButton { extension IntroPageViewController: UIPageViewControllerDataSource { func pageViewController(_ pageViewController: UIPageViewController, viewControllerBefore viewController: UIViewController) -> UIViewController? { - if let index = orderedViewControllers.index(of: viewController), index > 0 { + if let index = orderedViewControllers.firstIndex(of: viewController), index > 0 { return orderedViewControllers[index-1] } return nil } func pageViewController(_ pageViewController: UIPageViewController, viewControllerAfter viewController: UIViewController) -> UIViewController? { - if let index = orderedViewControllers.index(of: viewController), index < orderedViewControllers.count-1 { + if let index = orderedViewControllers.firstIndex(of: viewController), index < orderedViewControllers.count-1 { return orderedViewControllers[index+1] } return nil @@ -99,7 +99,7 @@ extension IntroPageViewController: UIPageViewControllerDataSource { extension IntroPageViewController: UIPageViewControllerDelegate { func pageViewController(_ pageViewController: UIPageViewController, willTransitionTo pendingViewControllers: [UIViewController]) { - pendingIndex = orderedViewControllers.index(of: pendingViewControllers.first!) + pendingIndex = orderedViewControllers.firstIndex(of: pendingViewControllers.first!) } func pageViewController(_ pageViewController: UIPageViewController, didFinishAnimating finished: Bool, previousViewControllers: [UIViewController], transitionCompleted completed: Bool) { diff --git a/enzevalos_iphone/Onboarding.swift b/enzevalos_iphone/Onboarding.swift index ddadde39dc991b6285c0ddc6060da6df2bd32d58..85807d8d89fc7bc467e65c0dc3cdec69a4b7a87d 100644 --- a/enzevalos_iphone/Onboarding.swift +++ b/enzevalos_iphone/Onboarding.swift @@ -427,7 +427,7 @@ class Onboarding: NSObject { imapTransportEncryption.reloadAllComponents() imapTransDataDelegate.pickedValue = transportRows[imapConnRow]! - imapConnRow = imapTransDataDelegate.rows.index(of: transportRows[imapConnRow]!)! + imapConnRow = imapTransDataDelegate.rows.firstIndex(of: transportRows[imapConnRow]!)! imapTransportEncryption.selectRow(imapConnRow, inComponent: 0, animated: false) let imapAuthLabel = UILabel.init() @@ -449,7 +449,7 @@ class Onboarding: NSObject { imapAuthentication.reloadInputViews() imapAuthentication.tintColor = textColor imapAuthDataDelegate.pickedValue = authenticationRows[imapAuthTypeRow]! - imapAuthTypeRow = Array(authenticationRows.values).index(of: authenticationRows[imapAuthTypeRow]!)! + imapAuthTypeRow = Array(authenticationRows.values).firstIndex(of: authenticationRows[imapAuthTypeRow]!)! imapAuthentication.selectRow(imapAuthTypeRow, inComponent: 0, animated: false) } @@ -512,7 +512,7 @@ class Onboarding: NSObject { smtpTransportEncryption.reloadAllComponents() smtpTransDataDelegate.pickedValue = transportRows[smtpConnTypeRow]! - smtpConnTypeRow = smtpTransDataDelegate.rows.index(of: transportRows[smtpConnTypeRow]!)! + smtpConnTypeRow = smtpTransDataDelegate.rows.firstIndex(of: transportRows[smtpConnTypeRow]!)! smtpTransportEncryption.selectRow(smtpConnTypeRow, inComponent: 0, animated: false) let smtpAuthLabel = UILabel.init() @@ -533,7 +533,7 @@ class Onboarding: NSObject { smtpAuthentication.reloadInputViews() smtpAuthentication.tintColor = textColor smtpAuthDataDelegate.pickedValue = authenticationRows[smtpAuthTypeRow]! - smtpAuthTypeRow = Array(authenticationRows.values).index(of: authenticationRows[smtpAuthTypeRow]!)! + smtpAuthTypeRow = Array(authenticationRows.values).firstIndex(of: authenticationRows[smtpAuthTypeRow]!)! smtpAuthentication.selectRow(smtpAuthTypeRow, inComponent: 0, animated: false) let smtpAuth = UIView.init(frame: CGRect.init(x: 0, y: 0, width: 50, height: smtpTransportEncryption.frame.height + padding + smtpAuthLabel.frame.height + smtpAuthentication.frame.height)) diff --git a/enzevalos_iphone/ReplaceSegue.swift b/enzevalos_iphone/ReplaceSegue.swift index 4aa51a31a338a83f82b7aa92eb2209427d843630..b6b268ab939c163b115dfdc972301df7bf77e178 100644 --- a/enzevalos_iphone/ReplaceSegue.swift +++ b/enzevalos_iphone/ReplaceSegue.swift @@ -14,7 +14,7 @@ class ReplaceSegue: UIStoryboardSegue { if let navigationController = source.navigationController { var controllerStack = navigationController.viewControllers - let index = controllerStack.index(of: source) + let index = controllerStack.firstIndex(of: source) controllerStack[index!] = destination navigationController.setViewControllers(controllerStack, animated: true) diff --git a/enzevalos_iphone/SwiftPGP.swift b/enzevalos_iphone/SwiftPGP.swift index 62d9ec008b240a19db1cf78646e43e5ac5abde7a..c53e173a1c58107de39fa9324b1849e9318b3b40 100644 --- a/enzevalos_iphone/SwiftPGP.swift +++ b/enzevalos_iphone/SwiftPGP.swift @@ -92,7 +92,7 @@ class SwiftPGP: Encryption { private var allSecretKeys: [Key]{ get{ var myKeys = Set<Key>() - if let keys = try? keychain.getString("secretKeys"){ + if let keys = ((try? keychain.getString("secretKeys")) as String??){ if let keyIDs = keys{ for id in keyIDs.split(separator: ";"){ if let key = loadKey(id: String(id)){ @@ -111,7 +111,7 @@ class SwiftPGP: Encryption { let keyring = Keyring() keyring.import(keys: [key]) let id = key.keyID.longIdentifier - if let testData = try? keychain.getData(id), testData != nil{ + if let testData = ((try? keychain.getData(id)) as Data??), testData != nil{ // merge keys. i.e. secret key stored and key is public key. if let keys = try? ObjectivePGP.readKeys(from: testData!){ keyring.import(keys: keys) @@ -123,7 +123,7 @@ class SwiftPGP: Encryption { } } if key.isSecret{ - if let keys = try? keychain.getString("secretKeys"){ + if let keys = ((try? keychain.getString("secretKeys")) as String??){ if var ids = keys{ ids = ids + ";"+id keychain["secretKeys"] = ids @@ -538,7 +538,7 @@ class SwiftPGP: Encryption { /* VERIFICATION */ - // test if message ist signed + // test if message is signed sigState = verifySignature(data: data, attachedSignature: attachedSignature, keys: []) for id in validDecryptionIDs { if let key = loadKey(id: id) { @@ -631,15 +631,11 @@ class SwiftPGP: Encryption { } let pubKeys = keys.filter{$0.isPublic} - var hasCorrectKey = false do{ try ObjectivePGP.verify(sigData, withSignature: attachedSignature, using: pubKeys, passphraseForKey: loadPassword) sigState = SignatureState.ValidSignature } catch { let nsError = error as NSError - if hasCorrectKey { - print(error) - } switch nsError.code { case 7: // no public key sigState = SignatureState.NoPublicKey @@ -718,7 +714,7 @@ class SwiftPGP: Encryption { pwKeyChain[key.keyID.longIdentifier] = pw } if let data = String("Test").data(using: .utf8) { - if let pw = try? pwKeyChain.get(key.keyID.longIdentifier), let _ = try? ObjectivePGP.sign(data, detached: false, using: [key], passphraseForKey: {(key) -> String? in return pw}) { + if let pw = ((try? pwKeyChain.get(key.keyID.longIdentifier)) as String??), let _ = try? ObjectivePGP.sign(data, detached: false, using: [key], passphraseForKey: {(key) -> String? in return pw}) { return true } } diff --git a/enzevalos_iphone/TravelHandler.swift b/enzevalos_iphone/TravelHandler.swift index dacc5e8c80eb2d00d9a579e90cdb42b5b89c3ccd..3d1aa9f3a58b26abf3463276fb95aabb6712475e 100644 --- a/enzevalos_iphone/TravelHandler.swift +++ b/enzevalos_iphone/TravelHandler.swift @@ -88,7 +88,7 @@ public class TravelHandler { public fileprivate(set) var mode: Mode { get { - if let mode = try? travelKeyChain.getString("mode") { + if let mode = ((try? travelKeyChain.getString("mode")) as String??) { if mode == "borderCrossing" { return .borderCrossing } else if mode == "traveling" { @@ -112,7 +112,7 @@ public class TravelHandler { fileprivate var canSecurelyBackup: Bool { get { - if let str = try? travelKeyChain.get("canSecurelyBackup"), let result = Bool(str ?? "true") { + if let str = ((try? travelKeyChain.get("canSecurelyBackup")) as String??), let result = Bool(str ?? "true") { return result } return true @@ -124,7 +124,7 @@ public class TravelHandler { fileprivate var backupKeyID: String? { get { - if let result = try? travelKeyChain.get("backupKeyID") { + if let result = ((try? travelKeyChain.get("backupKeyID")) as String??) { return result } return nil @@ -138,7 +138,7 @@ public class TravelHandler { fileprivate var backupAddress: String? { get { - if let result = try? travelKeyChain.get("backupAddress") { + if let result = ((try? travelKeyChain.get("backupAddress")) as String??) { return result } return nil @@ -152,7 +152,7 @@ public class TravelHandler { private var travelerStored: Data? { get { - if let data = try? travelKeyChain.getData("travelerStored") { + if let data = ((try? travelKeyChain.getData("travelerStored")) as Data??) { return data } return nil diff --git a/enzevalos_iphone/mail/IncomingMail.swift b/enzevalos_iphone/mail/IncomingMail.swift index d745b213158948a86772f83e48747187079481e0..de4aeef1ca7fe6497fae95c9bbab7570f82eae0d 100644 --- a/enzevalos_iphone/mail/IncomingMail.swift +++ b/enzevalos_iphone/mail/IncomingMail.swift @@ -176,7 +176,6 @@ class IncomingMail { private var misstrustNewKey = false private var repealsKey: PersistentKey? = nil - // Crypto info private var storeEncrypted = false @@ -290,6 +289,8 @@ class IncomingMail { } private func parseBody() { + print("\(i)th parsing of body in mail: \(self.subject)") + i = i + 1 var isEncrypted = false var isSigned = false var encData: Data? @@ -557,12 +558,17 @@ class IncomingMail { } private func prepareDecryption() { - html = msgParser.plainTextRendering() - lineArray = html.components(separatedBy: "\n") - lineArray.removeFirst(4) - body = lineArray.joined(separator: "\n") - body = body.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines) - body.append("\n") + if let data = msgParser.data(), let text = String(data: data, encoding: .utf8) { + body = text + } + else { + html = msgParser.plainTextRendering() + lineArray = html.components(separatedBy: "\n") + lineArray.removeFirst(4) + body = lineArray.joined(separator: "\n") + body = body.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines) + body.append("\n") + } } private func plainTextBody() {