diff --git a/enzevalos_iphone/Base.lproj/Main.storyboard b/enzevalos_iphone/Base.lproj/Main.storyboard index 5e8bac37d3d60d6a38ca66c97e249a1746e54eda..fea1ca5e10fc1e8835543bf4a99a9c3250dd9b68 100644 --- a/enzevalos_iphone/Base.lproj/Main.storyboard +++ b/enzevalos_iphone/Base.lproj/Main.storyboard @@ -540,16 +540,16 @@ <autoresizingMask key="autoresizingMask"/> <subviews> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="4I7-Ir-fwz"> - <rect key="frame" x="44" y="14" width="42" height="23"/> + <rect key="frame" x="44" y="14" width="42" height="22"/> <constraints> - <constraint firstAttribute="height" constant="22.5" id="29r-eG-9RK"/> + <constraint firstAttribute="height" constant="22" id="29r-eG-9RK"/> </constraints> <fontDescription key="fontDescription" type="system" pointSize="17"/> <nil key="textColor"/> <nil key="highlightedColor"/> </label> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="Subject" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="TWB-SA-V9M"> - <rect key="frame" x="44" y="44" width="58.5" height="22"/> + <rect key="frame" x="44" y="43" width="58.5" height="22"/> <constraints> <constraint firstAttribute="height" constant="22" id="Gcf-vv-aPr"/> </constraints> @@ -558,20 +558,20 @@ <nil key="highlightedColor"/> </label> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="753" verticalCompressionResistancePriority="753" text="Date" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="OLU-yz-VZh"> - <rect key="frame" x="271.5" y="18.5" width="32.5" height="18"/> + <rect key="frame" x="271.5" y="17.5" width="32.5" height="18"/> <fontDescription key="fontDescription" type="system" pointSize="15"/> <color key="textColor" cocoaTouchSystemColor="scrollViewTexturedBackgroundColor"/> <nil key="highlightedColor"/> </label> <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="nRP-yN-8GZ"> - <rect key="frame" x="16" y="18.5" width="23" height="15"/> + <rect key="frame" x="16" y="18" width="23" height="15"/> <constraints> <constraint firstAttribute="height" constant="15" id="TgY-wB-hul"/> <constraint firstAttribute="width" constant="23" id="XaP-6s-BLv"/> </constraints> </imageView> <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" distribution="equalCentering" alignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="CZD-9d-nBt"> - <rect key="frame" x="21" y="39" width="15" height="32.5"/> + <rect key="frame" x="21" y="38.5" width="15" height="31.5"/> <subviews> <imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="lfd-QR-eFB"> <rect key="frame" x="0.0" y="0.0" width="15" height="15"/> @@ -581,7 +581,7 @@ </constraints> </imageView> <imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="sfv-2Q-95I"> - <rect key="frame" x="0.0" y="17.5" width="15" height="15"/> + <rect key="frame" x="0.0" y="16.5" width="15" height="15"/> <constraints> <constraint firstAttribute="height" constant="15" id="SmT-9e-ovi"/> <constraint firstAttribute="width" constant="15" id="uKU-PK-flD"/> @@ -590,7 +590,7 @@ </subviews> </stackView> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="249" verticalHuggingPriority="249" horizontalCompressionResistancePriority="749" verticalCompressionResistancePriority="749" text="Body" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="aMi-fS-0nq"> - <rect key="frame" x="110" y="49" width="153" height="16"/> + <rect key="frame" x="110" y="48" width="153" height="16"/> <fontDescription key="fontDescription" type="system" pointSize="13"/> <color key="textColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/> <nil key="highlightedColor"/> @@ -632,6 +632,13 @@ <outlet property="delegate" destination="eRp-By-lS3" id="uzM-L0-alX"/> </connections> </tableView> + <toolbarItems> + <barButtonItem style="plain" systemItem="flexibleSpace" id="6J0-Tr-Tgj"/> + <barButtonItem enabled="NO" title="last Update" id="ZNc-Kc-oC1"> + <color key="tintColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> + </barButtonItem> + <barButtonItem style="plain" systemItem="flexibleSpace" id="LhP-ZB-o4i"/> + </toolbarItems> <navigationItem key="navigationItem" id="qTG-y6-efi"> <barButtonItem key="rightBarButtonItem" title="Über uns" id="vnz-ap-Ddb"> <connections> @@ -639,11 +646,13 @@ </connections> </barButtonItem> </navigationItem> + <simulatedToolbarMetrics key="simulatedBottomBarMetrics"/> <refreshControl key="refreshControl" opaque="NO" multipleTouchEnabled="YES" contentMode="center" enabled="NO" contentHorizontalAlignment="center" contentVerticalAlignment="center" id="i7r-Oq-y5T"> <rect key="frame" x="0.0" y="0.0" width="1000" height="1000"/> <autoresizingMask key="autoresizingMask"/> </refreshControl> <connections> + <outlet property="lastUpdateButton" destination="ZNc-Kc-oC1" id="ZUS-YO-vnu"/> <segue destination="TFs-eK-jti" kind="show" identifier="showInboxSegue" id="Qjs-MH-bHU"/> <segue destination="Ouw-WD-EV6" kind="show" identifier="readFolderMailSegue" id="6Ug-AV-lba"/> </connections> @@ -1848,8 +1857,8 @@ Um deine sicheren E-Mails auch auf einem anderen Gerät lesen zu können, muss d </scene> </scenes> <inferredMetricsTieBreakers> - <segue reference="rhW-cI-4c4"/> - <segue reference="hSn-Um-hji"/> + <segue reference="3Wb-uL-BB5"/> + <segue reference="td8-VW-Wrt"/> <segue reference="btx-4o-o0r"/> <segue reference="TgN-rB-esa"/> <segue reference="6Ug-AV-lba"/> diff --git a/enzevalos_iphone/FolderViewController.swift b/enzevalos_iphone/FolderViewController.swift index 4dc1eb8783e3ac0748c1d1bfef8551195613cf1e..bb878f303ac96665c0ab7c3f4e967e033605c1e8 100644 --- a/enzevalos_iphone/FolderViewController.swift +++ b/enzevalos_iphone/FolderViewController.swift @@ -15,9 +15,22 @@ class FolderViewController: UITableViewController { var isFirstFolderViewController = true var presentedFolder: Folder? = nil + @IBOutlet weak var lastUpdateButton: UIBarButtonItem! + var lastUpdateLabel = UILabel(frame: CGRect.zero) + var lastUpdateText: String? { + didSet { + lastUpdateLabel.text = lastUpdateText + lastUpdateLabel.sizeToFit() + } + } + + var lastUpdate: Date? = Date() + let dateFormatter = DateFormatter() + override func viewDidLoad() { self.refreshControl?.addTarget(self, action: #selector(FolderViewController.refresh), for: UIControlEvents.valueChanged) self.refreshControl?.attributedTitle = NSAttributedString(string: NSLocalizedString("PullToRefresh", comment: "Pull to refresh")) + lastUpdateText = NSLocalizedString("Updating", comment: "Getting new data") if isFirstFolderViewController { folders = DataHandler.handler.allRootFolders.sorted().filter { $0.path != UserManager.backendInboxFolderPath } @@ -34,8 +47,19 @@ class FolderViewController: UITableViewController { } NotificationCenter.default.addObserver(forName: Notification.Name.NSManagedObjectContextDidSave, object: nil, queue: nil, using: { [weak self] _ in + self?.lastUpdate = Date() self?.tableView.reloadData() }) + + dateFormatter.locale = Locale.current + dateFormatter.timeStyle = .medium + + lastUpdateLabel.sizeToFit() + lastUpdateLabel.backgroundColor = UIColor.clear + lastUpdateLabel.textAlignment = .center + lastUpdateLabel.font = UIFont.systemFont(ofSize: 13) + lastUpdateLabel.textColor = UIColor.black + lastUpdateButton.customView = lastUpdateLabel } override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) @@ -164,6 +188,7 @@ class FolderViewController: UITableViewController { } func refresh() { + lastUpdateText = NSLocalizedString("Updating", comment: "Getting new data") if let thisFolder = presentedFolder { refreshControl?.beginRefreshing() AppDelegate.getAppDelegate().mailHandler.updateFolder(folder: thisFolder, completionCallback: endRefreshing(_:)) @@ -181,6 +206,7 @@ class FolderViewController: UITableViewController { } tableView.reloadData() refreshControl?.endRefreshing() + lastUpdateText = lastUpdate != nil ? "\(NSLocalizedString("LastUpdate", comment: "When the last update occured")): \(dateFormatter.string(from: lastUpdate!))" : NSLocalizedString("NeverUpdated", comment: "No internet connection since last launch") } func getImage(for path: String) -> UIImage { diff --git a/enzevalos_iphone/Logger.swift b/enzevalos_iphone/Logger.swift index 6306b9e8986f7f05665f12055ba86c6d39025249..56b0e52ec17996e3214a5d35109f1bbe1290d490 100644 --- a/enzevalos_iphone/Logger.swift +++ b/enzevalos_iphone/Logger.swift @@ -53,7 +53,7 @@ class Logger { } } - static func log(setupStudy studypara: [StudyParamter:Int], alreadyRegistered: Bool, bitcoin: Bool) { + static func log(setupStudy studypara: [StudyParamter:Int], alreadyRegistered: Bool) { if !logging { return } @@ -63,7 +63,6 @@ class Logger { event[para.name] = value } event["alreadyRegistered"] = alreadyRegistered - event["bitcoinMailReceived"] = bitcoin saveToDisk(json: dictToJSON(fields: event)) sendCheck() } diff --git a/enzevalos_iphone/MailHandler.swift b/enzevalos_iphone/MailHandler.swift index 4cc80c101260dcf563a6f0a1fc2d40d82c942fc1..4f5b4ea8d137e5badc7bd3cb736b06110a986215 100644 --- a/enzevalos_iphone/MailHandler.swift +++ b/enzevalos_iphone/MailHandler.swift @@ -929,9 +929,6 @@ class MailHandler { } if let header = header, let from = header.from, let date = header.date { - if StudySettings.studyMode && from.mailbox.lowercased().contains("bitcoin.de") { - StudySettings.bitcoinMails = true - } let mail = DataHandler.handler.createMail(UInt64(message.uid), sender: from, receivers: rec, cc: cc, time: date, received: true, subject: header.subject ?? "", body: body, flags: message.flags, record: record, autocrypt: autocrypt, decryptedData: dec, folderPath: folderPath, secretKey: secretKey, references: references, mailagent: userAgent, messageID: msgID) if let m = mail { let pgp = SwiftPGP() @@ -1111,7 +1108,20 @@ class MailHandler { op?.start { (err, vanished) -> Void in guard err == nil else { - self.errorhandling(error: err, originalCall: {self.move(mails: mails, from: from, to: to)}, completionCallback: nil) + self.errorhandling(error: err, originalCall: {self.move(mails: mails, from: from, to: to)}, completionCallback: { err in + guard err != nil else { + return + } + let op = self.IMAPSession.copyMessagesOperation(withFolder: from, uids: uids, destFolder: to) + op?.start({error, _ in + guard error == nil else { + return + } + uids.enumerate({uid in + self.addFlag(uid, flags: MCOMessageFlag.deleted, folder: from) + }) + }) + }) return } } diff --git a/enzevalos_iphone/SendViewController+Invitation.swift b/enzevalos_iphone/SendViewController+Invitation.swift index bec4c05f1d1dfaf8d121e09411ae7dab8c1e4252..cafe1d78b0a18b8f3d3d29ab9a8cc45883190b50 100644 --- a/enzevalos_iphone/SendViewController+Invitation.swift +++ b/enzevalos_iphone/SendViewController+Invitation.swift @@ -270,12 +270,12 @@ extension SendViewController { /// - Parameter textView: that changed it's selected Text func updateMarkedText(for textView: UITextView) { - guard (self.isEligibleForInvitation() == true) else { - self.removeAllInvitationMarks() + guard isEligibleForInvitation() else { + removeAllInvitationMarks() return } - UIMenuController.shared.menuItems = self.menuControllerItems(for: textView) + UIMenuController.shared.menuItems = menuControllerItems(for: textView) } func textViewDidEndEditing(_ textView: UITextView) { @@ -364,6 +364,10 @@ extension SendViewController: UITextViewDelegate { self.updateMarkedText(for: textView) } + func textViewDidBeginEditing(_ textView: UITextView) { + self.updateMarkedText(for: textView) + } + func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool { self.textChanged(inRange: range, with: text) diff --git a/enzevalos_iphone/SendViewController.swift b/enzevalos_iphone/SendViewController.swift index 46ebfc251b9ae4d8967105c73b6391ecc4976277..6929a7f5de7ddaf6ad818daaba64a60fcac362b7 100644 --- a/enzevalos_iphone/SendViewController.swift +++ b/enzevalos_iphone/SendViewController.swift @@ -130,6 +130,7 @@ class SendViewController: UIViewController { toCollectionviewHeight.constant = 0 ccText.delegate = dataDelegate ccText.dataSource = dataDelegate + ccText.inputTextFieldKeyboardType = UIKeyboardType.emailAddress ccText.toLabelText = NSLocalizedString("Cc", comment: "copy label") + ": " ccText.setColorScheme(self.view.tintColor) ccCollectionview.delegate = collectionDataDelegate @@ -178,7 +179,6 @@ class SendViewController: UIViewController { textViewLeading.constant = seperator3Leading.constant - 4 - ccText.inputTextFieldKeyboardType = UIKeyboardType.emailAddress scrollview.clipsToBounds = true tableview.delegate = tableDataDelegate diff --git a/enzevalos_iphone/StudySettings.swift b/enzevalos_iphone/StudySettings.swift index 01b74b8249df10eb1678fb6c1150b1322d8fe399..179ddbfed417f2cb622046acbd3044ccc0e31949 100644 --- a/enzevalos_iphone/StudySettings.swift +++ b/enzevalos_iphone/StudySettings.swift @@ -165,7 +165,7 @@ class StudySettings { // Logger.queue.async(flags: .barrier) { - Logger.log(setupStudy: parameters, alreadyRegistered: !presentFirstQuestionaireMail, bitcoin: bitcoinMails) + Logger.log(setupStudy: parameters, alreadyRegistered: !presentFirstQuestionaireMail) // } } diff --git a/enzevalos_iphone/en.lproj/Localizable.strings b/enzevalos_iphone/en.lproj/Localizable.strings index 7bd73e1a87a0372830927d2cb2971b55f4df1241..c8c42edbff4c739e6b53c63177cefc3062f7bb0f 100644 --- a/enzevalos_iphone/en.lproj/Localizable.strings +++ b/enzevalos_iphone/en.lproj/Localizable.strings @@ -97,8 +97,8 @@ "Secure" = "Secure"; "Send" = "Send"; "SendError" = "An error occured"; //mehr spezifizieren? -"SendInsecureInfo" = "This Mail would be send insecurely to all orange contacts. So everybody could read and manipulate it. You could invite them to use Enzevalos to communicate securely."; -"SendInsecureInfoAll" = "This Mail would be send insecurely to all contacts. So everybody could read and manipulate it. You could invite them to use Enzevalos to communicate securely."; +"SendInsecureInfo" = "This Mail would be send insecurely to all orange contacts. So everybody could read and manipulate it. You could invite them to use Letterbox to communicate securely."; +"SendInsecureInfoAll" = "This Mail would be send insecurely to all contacts. So everybody could read and manipulate it. You could invite them to use Letterbox to communicate securely."; "SendSecureInfo" = "Congratulations! This Mail would be send securely. It is impossible for anybody to read or manipulate it."; "SendSuccess" = "Sent successfully"; "Sent" = "Sent"; @@ -152,7 +152,7 @@ "inviteContacts" = "Invite insecure Contacts"; "inviteContacts.Censor" = "Show explanation"; "inviteSubject" = "Lets use secure email!"; -"inviteText" = "Hey there!\n\nThere is this new App called Enzevalos which makes it really easy to communicate encrypted over email.\n\nI would love for you to try it!\n\nBest regards!"; +"inviteText" = "Hey there!\n\nThere is this new App called Letterbox which makes it really easy to communicate encrypted over email.\n\nI would love for you to try it!\n\nBest regards!"; "noName" = "NO NAME"; "you" = "Your Tray"; "thisIsYou" = "Emails you sent yourself are collected here";