diff --git a/enzevalos_iphone.xcodeproj/project.pbxproj b/enzevalos_iphone.xcodeproj/project.pbxproj index fe470109f72945b05264a001dde4a28520905518..b0c4aa04d02c8135164c23818fe412d27445b415 100644 --- a/enzevalos_iphone.xcodeproj/project.pbxproj +++ b/enzevalos_iphone.xcodeproj/project.pbxproj @@ -154,6 +154,10 @@ 47691A8C1ECC3EC7004BCFC5 /* EphemeralMail.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47691A8B1ECC3EC7004BCFC5 /* EphemeralMail.swift */; }; 477548DE21F5DABE000B22A8 /* MailServerConnectionError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 477548DD21F5DABE000B22A8 /* MailServerConnectionError.swift */; }; 477548DF21F5DABE000B22A8 /* MailServerConnectionError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 477548DD21F5DABE000B22A8 /* MailServerConnectionError.swift */; }; + 477548E221F77466000B22A8 /* SecurityIndicator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 477548E121F77466000B22A8 /* SecurityIndicator.swift */; }; + 477548E421F77BA0000B22A8 /* StudyParameterProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 477548E321F77BA0000B22A8 /* StudyParameterProtocol.swift */; }; + 477548E521F77DF5000B22A8 /* StudyParameterProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 477548E321F77BA0000B22A8 /* StudyParameterProtocol.swift */; }; + 477548E621F77DF7000B22A8 /* SecurityIndicator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 477548E121F77466000B22A8 /* SecurityIndicator.swift */; }; 47953AA91FD7000200D4631A /* bitcoinde.asc in Resources */ = {isa = PBXBuildFile; fileRef = 47953AA81FD7000200D4631A /* bitcoinde.asc */; }; 47953AAA1FD7000200D4631A /* bitcoinde.asc in Resources */ = {isa = PBXBuildFile; fileRef = 47953AA81FD7000200D4631A /* bitcoinde.asc */; }; 479B5977206914BE00B3944D /* CryptoTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 479B5976206914BE00B3944D /* CryptoTests.swift */; }; @@ -351,6 +355,8 @@ 47691A891ECB56D1004BCFC5 /* Mail.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Mail.swift; sourceTree = "<group>"; }; 47691A8B1ECC3EC7004BCFC5 /* EphemeralMail.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EphemeralMail.swift; sourceTree = "<group>"; }; 477548DD21F5DABE000B22A8 /* MailServerConnectionError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MailServerConnectionError.swift; sourceTree = "<group>"; }; + 477548E121F77466000B22A8 /* SecurityIndicator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecurityIndicator.swift; sourceTree = "<group>"; }; + 477548E321F77BA0000B22A8 /* StudyParameterProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StudyParameterProtocol.swift; sourceTree = "<group>"; }; 47953AA81FD7000200D4631A /* bitcoinde.asc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = bitcoinde.asc; sourceTree = "<group>"; }; 479B5976206914BE00B3944D /* CryptoTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CryptoTests.swift; sourceTree = "<group>"; }; 479C649521F2139B00A01071 /* support_pk.asc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = support_pk.asc; sourceTree = "<group>"; }; @@ -625,6 +631,15 @@ name = mail; sourceTree = "<group>"; }; + 477548E021F77445000B22A8 /* study parameters */ = { + isa = PBXGroup; + children = ( + 477548E121F77466000B22A8 /* SecurityIndicator.swift */, + 477548E321F77BA0000B22A8 /* StudyParameterProtocol.swift */, + ); + path = "study parameters"; + sourceTree = "<group>"; + }; 47B91AC01EC0C1CF000AE3EE /* coredata */ = { isa = PBXGroup; children = ( @@ -845,6 +860,7 @@ A17FDFF1202C680A00F7BA89 /* debug and study */ = { isa = PBXGroup; children = ( + 477548E021F77445000B22A8 /* study parameters */, A17FDFF2202C685800F7BA89 /* StudySettings.swift */, 47D1302A1F7CEE6D007B14DF /* DebugSettings.swift */, A111F6AB1FA77AF80060AFDE /* Logging */, @@ -1433,6 +1449,7 @@ 3E9709031FAC95F5005825C9 /* MessageBodyTableViewCell.swift in Sources */, 3E9709041FAC95F5005825C9 /* ReadVENDelegate.swift in Sources */, 3E9709061FAC95F5005825C9 /* PersistentKey+CoreDataClass.swift in Sources */, + 477548E621F77DF7000B22A8 /* SecurityIndicator.swift in Sources */, 3E9709081FAC95F5005825C9 /* KeyViewController.swift in Sources */, 3E9709091FAC95F5005825C9 /* ExportCells.swift in Sources */, 3E97090B1FAC95F5005825C9 /* CNMailAddressesExtension.swift in Sources */, @@ -1456,6 +1473,7 @@ 3E9709231FAC95F5005825C9 /* MailAddress.swift in Sources */, 3E9709241FAC95F5005825C9 /* MailHandlerDelegator.swift in Sources */, 3E97092A1FAC95F5005825C9 /* LabelStyleKit.swift in Sources */, + 477548E521F77DF5000B22A8 /* StudyParameterProtocol.swift in Sources */, 3E97092C1FAC95F5005825C9 /* SubBadgeTableViewCell.swift in Sources */, 3E97092D1FAC95F5005825C9 /* FrequentCell.swift in Sources */, 3E97092E1FAC95F5005825C9 /* ListViewController.swift in Sources */, @@ -1504,6 +1522,7 @@ 8428A86F1F436A1E007649A5 /* InviteFriendViewController.swift in Sources */, A1735DFA205AB88500B336DB /* SendViewState.swift in Sources */, 475B00331F7B9565006CDD41 /* SwiftPGP.swift in Sources */, + 477548E421F77BA0000B22A8 /* StudyParameterProtocol.swift in Sources */, 3EB4FAA420120096001D0625 /* DialogOption.swift in Sources */, F14239C11F30A99C00998A83 /* QRCodeGenerator.swift in Sources */, F1AF938F1E2D04BA00755128 /* CustomCells.swift in Sources */, @@ -1526,6 +1545,7 @@ F12060801DA540FE00F6EF37 /* RefreshControlExtension.swift in Sources */, A13526811D955BDF00D3BFE1 /* enzevalos_iphone.xcdatamodeld in Sources */, 472F39821E1E5347009260FB /* Mail_Address+CoreDataProperties.swift in Sources */, + 477548E221F77466000B22A8 /* SecurityIndicator.swift in Sources */, 476373C21E09BA88004D5EFE /* UserData.swift in Sources */, A1EB05A01D95696C008659C1 /* MessageBodyTableViewCell.swift in Sources */, F18B44621E73286C0080C041 /* ReadVENDelegate.swift in Sources */, diff --git a/enzevalos_iphone/HideShowPasswordTextField.swift b/enzevalos_iphone/HideShowPasswordTextField.swift index 451696a891fb914fdfec85d91d8efabcc37682c9..3864480b04bd5c4704483a08a269aedbb4bf2740 100644 --- a/enzevalos_iphone/HideShowPasswordTextField.swift +++ b/enzevalos_iphone/HideShowPasswordTextField.swift @@ -3,7 +3,7 @@ // Guidebook // // Created by Mike Sprague on 4/15/16. -// See: https://github.com/Guidebook/HideShowPasswordTextField +// See: https://github.com/Guidebook/HideShowPasswordTextField // // diff --git a/enzevalos_iphone/LabelStyleKit.swift b/enzevalos_iphone/LabelStyleKit.swift index f1757a4485a3af9ac52147ba9d69d411813aaca9..88787b5489d573fa2bb788a4112ca908429bd812 100644 --- a/enzevalos_iphone/LabelStyleKit.swift +++ b/enzevalos_iphone/LabelStyleKit.swift @@ -8,7 +8,6 @@ // Generated by PaintCode // http://www.paintcodeapp.com // -// This code was partly generated by Trial version of PaintCode, therefore cannot be used for commercial purposes. // diff --git a/enzevalos_iphone/MailServerConnectionError.swift b/enzevalos_iphone/MailServerConnectionError.swift index 483f90112f810a87267b113ac91aadf97cf10cef..b8856c36f4aa836c8b224ce5503f1e8a10f80a64 100644 --- a/enzevalos_iphone/MailServerConnectionError.swift +++ b/enzevalos_iphone/MailServerConnectionError.swift @@ -104,7 +104,7 @@ enum MailServerConnectionError: Error { case "The server does not support STARTTLS connections.".uppercased(): mscError = .StartTLSNotAvailableError break - case "The SMTP storage limit was hit while trying to send a large message.".uppercased(): + case "The SMTP storage limit was hit while trying to send a large message.".uppercased(): mscError = .StorageLimitSMTPError break case "Authentication is required for this SMTP server.".uppercased(): diff --git a/enzevalos_iphone/PasswordToggleVisibilityView.swift b/enzevalos_iphone/PasswordToggleVisibilityView.swift index c39d6c2b8615d7f0d65a8c4316d0980e5609dc83..65eb319a7a441ff5164137696586425aa9ddbaf9 100644 --- a/enzevalos_iphone/PasswordToggleVisibilityView.swift +++ b/enzevalos_iphone/PasswordToggleVisibilityView.swift @@ -3,7 +3,7 @@ // Guidebook // // Created by Mike Sprague on 4/14/16. -// See: https://github.com/Guidebook/HideShowPasswordTextField +// See: https://github.com/Guidebook/HideShowPasswordTextField // // diff --git a/enzevalos_iphone/StudySettings.swift b/enzevalos_iphone/StudySettings.swift index c4e71fcc74f622a458fd493422c586d9f368cd8c..ec9c8e22b98bb2e65edf85cfbfdf453590f3928f 100644 --- a/enzevalos_iphone/StudySettings.swift +++ b/enzevalos_iphone/StudySettings.swift @@ -24,6 +24,7 @@ import KeychainAccess enum StudyParamter: Int { case Warning = 0 case Invitation = 1 + case Indicator = 2 var name: String { get { @@ -32,6 +33,8 @@ enum StudyParamter: Int { return "warning" case .Invitation: return "invitation" + case .Indicator: + return "indicator" } } } @@ -43,7 +46,10 @@ enum StudyParamter: Int { return "hideWarnings" case .Invitation: return "invitation mode" + case .Indicator: + return "indicator mode" } + } } var numberOfTreatments: UInt32 { @@ -53,6 +59,8 @@ enum StudyParamter: Int { return 2 case .Invitation: return 3 + case .Indicator: + return 2 } } } @@ -65,10 +73,13 @@ enum InvitationMode: Int { case FreeText } + + + class StudySettings { static var studyMode = true static var presentFirstQuestionaireMail = false - static let parameters = [StudyParamter.Invitation] + static let parameters = [StudyParamter.Indicator] static let bitcoinStudyBody = """ @@ -153,7 +164,6 @@ class StudySettings { static var invitationsmode: InvitationMode { get { - return UserManager.loadInvitationMode() let value = UserDefaults.standard.integer(forKey: StudyParamter.Invitation.keyName) if let mode = InvitationMode.init(rawValue: value) { return mode diff --git a/enzevalos_iphone/study parameters/SecurityIndicator.swift b/enzevalos_iphone/study parameters/SecurityIndicator.swift new file mode 100644 index 0000000000000000000000000000000000000000..12d36e151a9d39bb7d61e4420320855bf0445626 --- /dev/null +++ b/enzevalos_iphone/study parameters/SecurityIndicator.swift @@ -0,0 +1,138 @@ +// +// SecurityIndicator.swift +// enzevalos_iphone +// +// Created by Oliver Wiese on 22.01.19. +// Copyright © 2019 fu-berlin. All rights reserved. +// + +import Foundation + + + +enum SecurityIndicator: Int, StudyParameterProtocol { + case letter = 0, padlock = 1 + + static func startStudy() { + } + + var name: String { + get { + return "indicator" + } + } + + var keyName: String { + get { + return "indicator mode" + } + } + + var numberOfTreatments: UInt32 { + get { + return 2 + } + } + + + func imageOfSecureIndicator(background: Bool = false, open: Bool = false) -> UIImage { + switch self { + case .letter: + if open { + return IconsStyleKit.imageOfLetterOpen + } + if background { + return IconsStyleKit.imageOfLetterBG + } + return IconsStyleKit.imageOfLetter + case .padlock: + return IconsStyleKit.imageOfPadlockSecure + } + } + + + func imageOfCorruptedIndicator(background: Bool = false) -> UIImage { + switch self { + case .letter: + return IconsStyleKit.imageOfLetterCorrupted + case .padlock: + return IconsStyleKit.imageOfPadlockError + } + } + + func imageOfInsecureIndicator(background: Bool = false) -> UIImage { + switch self { + case .letter: + if background { + return IconsStyleKit.imageOfPostcardBG + } + return IconsStyleKit.imageOfPostcard + case .padlock: + return IconsStyleKit.imageOfPadlockInsecure + } + } + + func drawOfSecureIndictor(frame: CGRect?, rezising: IconsStyleKit.ResizingBehavior = .aspectFit, color: UIColor = IconsStyleKit.strokeColor, fillbackground: Bool = false, open: Bool) { + switch self { + case .letter: + if open { + var f = CGRect(x: 0, y: 0, width: 47, height: 43) + if let frame = frame { + f = frame + } + IconsStyleKit.drawLetterOpen(frame: f, resizing: rezising, color: color) + } + else { + var f = CGRect(x: 0, y: 0, width: 50, height: 35) + if let frame = frame { + f = frame + } + IconsStyleKit.drawLetter(frame: f, resizing: .aspectFit, color: color, fillBackground: fillbackground) + } + break + case .padlock: + var f = CGRect(x: 0, y: 0, width: 80, height: 100) + if let frame = frame { + f = frame + } + IconsStyleKit.drawPadlockSecure(frame: f, resizing: rezising, color: color, fillBackground: fillbackground) + } + } + + func drawOfInSecureIndictor(frame: CGRect?, rezising: IconsStyleKit.ResizingBehavior = .aspectFit, color: UIColor = IconsStyleKit.strokeColor, fillbackground: Bool = false, open: Bool) { + switch self { + case .letter: + var f = CGRect(x: 0, y: 0, width: 49, height: 34) + if let frame = frame { + f = frame + } + IconsStyleKit.drawPostcard(frame: f, resizing: rezising, color: color, fillBackground: fillbackground) + break + case .padlock: + var f = CGRect(x: 0, y: 0, width: 80, height: 100) + if let frame = frame { + f = frame + } + IconsStyleKit.drawPadlockInsecure(frame: f, resizing: rezising, color: color, fillBackground: fillbackground) + } + } + + func drawOfCorruptedIndictor(frame: CGRect?, rezising: IconsStyleKit.ResizingBehavior = .aspectFit, color: UIColor = IconsStyleKit.strokeColor, fillbackground: Bool = false, open: Bool) { + switch self { + case .letter: + var f = CGRect(x: 0, y: 0, width: 49, height: 34) + if let frame = frame { + f = frame + } + IconsStyleKit.drawLetterCorrupted(frame: f, resizing: rezising, color: color) + break + case .padlock: + var f = CGRect(x: 0, y: 0, width: 80, height: 100) + if let frame = frame { + f = frame + } + IconsStyleKit.drawPadlockError(frame: f, resizing: rezising, color: color, fillBackground: fillbackground) + } + } + +} diff --git a/enzevalos_iphone/study parameters/StudyParameterProtocol.swift b/enzevalos_iphone/study parameters/StudyParameterProtocol.swift new file mode 100644 index 0000000000000000000000000000000000000000..b67e66efd8339c00bdbe1cc3912bf6430ddccf74 --- /dev/null +++ b/enzevalos_iphone/study parameters/StudyParameterProtocol.swift @@ -0,0 +1,16 @@ +// +// StudyParameterProtocol.swift +// enzevalos_iphone +// +// Created by Oliver Wiese on 22.01.19. +// Copyright © 2019 fu-berlin. All rights reserved. +// + +import Foundation + +protocol StudyParameterProtocol { + var name: String {get} + var keyName: String {get} + var numberOfTreatments: UInt32 {get} + static func startStudy() +}