diff --git a/enzevalos_iphone.xcodeproj/project.pbxproj b/enzevalos_iphone.xcodeproj/project.pbxproj index b0c4aa04d02c8135164c23818fe412d27445b415..992b9e7379d76ed6efb0a19eb9ed0f07621b6263 100644 --- a/enzevalos_iphone.xcodeproj/project.pbxproj +++ b/enzevalos_iphone.xcodeproj/project.pbxproj @@ -635,6 +635,7 @@ isa = PBXGroup; children = ( 477548E121F77466000B22A8 /* SecurityIndicator.swift */, + F1984D711E1D327200804E1E /* IconsStyleKit.swift */, 477548E321F77BA0000B22A8 /* StudyParameterProtocol.swift */, ); path = "study parameters"; @@ -819,7 +820,6 @@ A198270D1D9A8ABC0027F65C /* enzevalos_iphone-Bridging-Header.h */, A1F9922B1DA7C9100073BF1B /* Main.storyboard */, F1984D731E1E92B300804E1E /* LabelStyleKit.swift */, - F1984D711E1D327200804E1E /* IconsStyleKit.swift */, A1123E6C1DA682850069551C /* Localizable.strings */, A13526841D955BDF00D3BFE1 /* LaunchScreen.storyboard */, A1EB05A31D956E32008659C1 /* Assets.xcassets */, diff --git a/enzevalos_iphone/AnimatedSendIcon.swift b/enzevalos_iphone/AnimatedSendIcon.swift index 01e31e14d7d674ad6219a72245924fd809fdfcb3..a469e4859eb8c8d7ffa622f2f659eeb77cbf2903 100644 --- a/enzevalos_iphone/AnimatedSendIcon.swift +++ b/enzevalos_iphone/AnimatedSendIcon.swift @@ -24,8 +24,8 @@ import UIKit class AnimatedSendIcon: UIView { var isPostcardOnTop = false - var square = UIImageView(image:IconsStyleKit.imageOfLetterBG) - var square2 = UIImageView(image:IconsStyleKit.imageOfPostcardBG) + var square = UIImageView(image: StudySettings.securityIndicator.imageOfSecureIndicator(background: true, open: false)) + var square2 = UIImageView(image: StudySettings.securityIndicator.imageOfInsecureIndicator(background: true)) let width = 100.0 let height = 70.0 let f = 0.8 diff --git a/enzevalos_iphone/ContactViewController.swift b/enzevalos_iphone/ContactViewController.swift index 4b1e65d798bd2674c5604c4145ef7691c5889999..56c573e83081733960b765ba2e1bc4bb1f12b708 100644 --- a/enzevalos_iphone/ContactViewController.swift +++ b/enzevalos_iphone/ContactViewController.swift @@ -156,11 +156,11 @@ class ContactViewController: UIViewController { let frame = CGRect(x: myBounds.size.width / 2 - iconSize / 2, y: myBounds.size.height / 2 - iconSize / 2, width: iconSize, height: iconSize) if keyRecord.hasKey { - IconsStyleKit.drawLetter(frame: frame, fillBackground: true) + StudySettings.securityIndicator.drawOfSecureIndictor(frame: frame, fillbackground: true, open: false) } else if keyRecord.isVerified { - IconsStyleKit.drawLetter(frame: frame, color: UIColor.white) + StudySettings.securityIndicator.drawOfSecureIndictor(frame: frame, color: UIColor.white, fillbackground: true, open: false) } else { - IconsStyleKit.drawPostcard(frame: frame, resizing: .aspectFit, color: UIColor.white) + StudySettings.securityIndicator.drawOfInSecureIndictor(frame: frame, color: UIColor.white, open: false) } let img = UIGraphicsGetImageFromCurrentImageContext(); @@ -372,10 +372,10 @@ extension ContactViewController: UITableViewDataSource { dateFormatter.locale = Locale.current dateFormatter.dateStyle = .medium cell.dateLabel.text = dateFormatter.string(from: time as Date) - cell.iconImage.image = IconsStyleKit.imageOfLetter + cell.iconImage.image = StudySettings.securityIndicator.imageOfSecureIndicator(open: false) } else { cell.dateLabel.text = "" - cell.iconImage.image = IconsStyleKit.imageOfPostcard + cell.iconImage.image = StudySettings.securityIndicator.imageOfInsecureIndicator() } cell.label.text = r[indexPath.row].addresses.first?.mailAddress } @@ -392,10 +392,10 @@ extension ContactViewController: UITableViewDataSource { dateFormatter.locale = Locale.current dateFormatter.dateStyle = .medium cell.dateLabel.text = dateFormatter.string(from: time as Date) - cell.iconImage.image = IconsStyleKit.imageOfLetter + cell.iconImage.image = StudySettings.securityIndicator.imageOfSecureIndicator() } else { cell.dateLabel.text = "" - cell.iconImage.image = IconsStyleKit.imageOfPostcard + cell.iconImage.image = StudySettings.securityIndicator.imageOfInsecureIndicator() } cell.label.text = r[indexPath.row].addresses.first?.mailAddress } diff --git a/enzevalos_iphone/FolderViewController.swift b/enzevalos_iphone/FolderViewController.swift index 145cec858ff8821c669c3265ca2d299a1e02f3d6..5dfb6a2ba79dea4bba0627460cb17da1ccd5dbce 100644 --- a/enzevalos_iphone/FolderViewController.swift +++ b/enzevalos_iphone/FolderViewController.swift @@ -130,11 +130,11 @@ class FolderViewController: UITableViewController { cell.date.text = mail.timeString if mail.isSecure { - cell.secureImageView.image = IconsStyleKit.imageOfLetter + cell.secureImageView.image = StudySettings.securityIndicator.imageOfSecureIndicator() } else if mail.trouble { - cell.secureImageView.image = IconsStyleKit.imageOfLetterCorrupted + cell.secureImageView.image = StudySettings.securityIndicator.imageOfCorruptedIndicator() } else { - cell.secureImageView.image = IconsStyleKit.imageOfPostcard + cell.secureImageView.image = StudySettings.securityIndicator.imageOfInsecureIndicator() } if !mail.isRead { cell.markImageView.image = "🔵".image() diff --git a/enzevalos_iphone/InboxTableViewCell.swift b/enzevalos_iphone/InboxTableViewCell.swift index e1d6f46ec161440f92134910d6c8b22c066b565d..0c4f76d394bcb94c8a1a5bf442b55eabf9557045 100644 --- a/enzevalos_iphone/InboxTableViewCell.swift +++ b/enzevalos_iphone/InboxTableViewCell.swift @@ -99,9 +99,9 @@ class InboxTableViewCell: UITableViewCell { secondButton.isEnabled = false } if con.isSecure { - iconView.image = IconsStyleKit.imageOfLetterBG + iconView.image = StudySettings.securityIndicator.imageOfSecureIndicator(background: true, open: false) } else { - iconView.image = IconsStyleKit.imageOfPostcardBG + iconView.image = StudySettings.securityIndicator.imageOfInsecureIndicator(background: true) } var cont: Contact diff --git a/enzevalos_iphone/Logger.swift b/enzevalos_iphone/Logger.swift index 23958fc056b52bd2153e910fa3a7cf74a7035fad..3902a8676bdc0a4c224fd86194af1e0045a33ec3 100644 --- a/enzevalos_iphone/Logger.swift +++ b/enzevalos_iphone/Logger.swift @@ -36,12 +36,11 @@ class Logger { static var studyID = StudySettings.studyID //identifies the participant in the study static fileprivate func sendCheck() { - if nextDeadline <= Date() && AppDelegate.getAppDelegate().currentReachabilityStatus != .notReachable { + if nextDeadline <= Date() && AppDelegate.getAppDelegate().currentReachabilityStatus != .notReachable && UserManager.loadUserValue(Attribute.userName) != nil { //Do not send duplicate mails let tmpNextDeadline = Date(timeIntervalSinceNow: TimeInterval(resendInterval)) nextDeadline = tmpNextDeadline UserManager.storeUserValue(nextDeadline as AnyObject?, attribute: Attribute.nextDeadline) - sendLog() } } diff --git a/enzevalos_iphone/Onboarding.swift b/enzevalos_iphone/Onboarding.swift index 3376c3cb0c7655af9442b5a02954cce8b01c00d1..8184226202e1e926fdce061ff787f18af2801e10 100644 --- a/enzevalos_iphone/Onboarding.swift +++ b/enzevalos_iphone/Onboarding.swift @@ -104,12 +104,12 @@ class Onboarding: NSObject { intro1.iconWidth = 80 } UIGraphicsBeginImageContextWithOptions(CGSize(width: intro1.iconWidth, height: intro1.iconHeight), false, 0) - IconsStyleKit.drawLetter(frame: CGRect(x: 0, y: 0, width: intro1.iconWidth, height: intro1.iconHeight), fillBackground: true) + StudySettings.securityIndicator.drawOfSecureIndictor(frame: CGRect(x: 0, y: 0, width: intro1.iconWidth, height: intro1.iconHeight), fillbackground: true, open: false) intro1.iconImageView.image = UIGraphicsGetImageFromCurrentImageContext()! UIGraphicsEndImageContext() intro1.bodyLabel.textAlignment = NSTextAlignment.left - let intro2 = OnboardingContentViewController.content(withTitle: NSLocalizedString("Postcard", comment: ""), body: NSLocalizedString("PostcardDescription", comment: "describe the postcard"), image: IconsStyleKit.imageOfPostcardBG, buttonText: nil, action: nil) + let intro2 = OnboardingContentViewController.content(withTitle: NSLocalizedString("Postcard", comment: ""), body: NSLocalizedString("PostcardDescription", comment: "describe the postcard"), image: StudySettings.securityIndicator.imageOfInsecureIndicator(background: true), buttonText: nil, action: nil) intro2.iconHeight = 70 intro2.iconWidth = 100 @@ -118,7 +118,7 @@ class Onboarding: NSObject { intro2.iconWidth = 80 } UIGraphicsBeginImageContextWithOptions(CGSize(width: intro2.iconWidth, height: intro2.iconHeight), false, 0) - IconsStyleKit.drawPostcard(frame: CGRect(x: 0, y: 0, width: intro2.iconWidth, height: intro2.iconHeight), fillBackground: true) + StudySettings.securityIndicator.drawOfInSecureIndictor(frame: CGRect(x: 0, y: 0, width: intro2.iconWidth, height: intro2.iconHeight), fillbackground: true, open: false) intro2.iconImageView.image = UIGraphicsGetImageFromCurrentImageContext()! UIGraphicsEndImageContext() intro2.bodyLabel.textAlignment = NSTextAlignment.left diff --git a/enzevalos_iphone/ReadViewController.swift b/enzevalos_iphone/ReadViewController.swift index 9032e51fb7911b0cafc232c8988320e381a911b2..ae1ed54b9b52f743f538b372793e9af39376631b 100644 --- a/enzevalos_iphone/ReadViewController.swift +++ b/enzevalos_iphone/ReadViewController.swift @@ -444,11 +444,11 @@ class ReadViewController: UITableViewController { iconView.contentMode = .scaleAspectFit var icon: UIImage if mail.trouble { - icon = IconsStyleKit.imageOfLetterCorrupted + icon = StudySettings.securityIndicator.imageOfCorruptedIndicator() } else if mail.isSecure { - icon = IconsStyleKit.imageOfLetterOpen + icon = StudySettings.securityIndicator.imageOfSecureIndicator() } else { - icon = IconsStyleKit.imageOfPostcard + icon = StudySettings.securityIndicator.imageOfInsecureIndicator() } iconView.image = icon iconButton.setImage(icon, for: UIControlState()) diff --git a/enzevalos_iphone/StudySettings.swift b/enzevalos_iphone/StudySettings.swift index ec9c8e22b98bb2e65edf85cfbfdf453590f3928f..22ad9b8cd385cb7d36bcfd552ea7312a66b010a1 100644 --- a/enzevalos_iphone/StudySettings.swift +++ b/enzevalos_iphone/StudySettings.swift @@ -80,6 +80,8 @@ class StudySettings { static var studyMode = true static var presentFirstQuestionaireMail = false static let parameters = [StudyParamter.Indicator] + static let securityIndicator = SecurityIndicator.padlock + static let bitcoinStudyBody = """ diff --git a/enzevalos_iphone/IconsStyleKit.swift b/enzevalos_iphone/study parameters/IconsStyleKit.swift similarity index 99% rename from enzevalos_iphone/IconsStyleKit.swift rename to enzevalos_iphone/study parameters/IconsStyleKit.swift index 834f97783b093b9d8d84131edd2483e0126b6a13..9e14ca2cec59935f8b3d867987a45e2167a8ecbb 100644 --- a/enzevalos_iphone/IconsStyleKit.swift +++ b/enzevalos_iphone/study parameters/IconsStyleKit.swift @@ -9,12 +9,9 @@ // http://www.paintcodeapp.com // // - - - import UIKit -open class IconsStyleKit: NSObject { +internal class IconsStyleKit: NSObject { //// Cache