merge default IOS-1540_GOOD
authorDirk Zimmermann <dz@pep.security>
Tue, 11 Jun 2019 08:57:01 +0200
branchIOS-1540_GOOD
changeset 89704322b8714a2a
parent 8951 3d07affcb2a8
parent 8968 d4c60d2954e2
child 8974 27b29e734698
merge default
pEpForiOS/UI/EmailDisplay/EmailViewController.swift
     1.1 Binary file Design/UI/pEpForIOS-Alert-Devicegroup.png has changed
     2.1 Binary file Design/UI/pEpForIOS-Alert-pEpSync-TrustwordsLong.png has changed
     3.1 Binary file Design/UI/pEpForIOS-Contact-Unknown.png has changed
     4.1 Binary file Design/UI/pEpForIOS-Contact-Unsecure.png has changed
     5.1 Binary file Design/UI/pEpForIOS-Message-Secure&Trusted.png has changed
     6.1 Binary file Design/UI/pEpForIOS-Message-Secure-Threading.png has changed
     7.1 Binary file Design/UI/pEpForIOS-Message-Unknown.png has changed
     8.1 Binary file Design/UI/pEpForIOS-Message-Untrusted.png has changed
     9.1 Binary file Design/UI/pEpForIOS-Settings-Accounts.png has changed
    10.1 Binary file Design/UI/pEpForIOS-Settings.png has changed
    11.1 Binary file Design/UI/pEpForIOS-iPad-Inbox-horizontal.png has changed
    12.1 Binary file Design/UI/pEpForIOS-iPad-Mailboxes-Threading-vertical.png has changed
    13.1 Binary file Design/icons/pEpForiOS-icon-compose.pdf has changed
    14.1 Binary file Design/icons/pEpForiOS-icon-device group.pdf has changed
    15.1 Binary file Design/icons/pEpForiOS-icon-reply.pdf has changed
    16.1 --- a/pEpForiOS/UI/EmailDisplay/EmailViewController.swift	Thu Jun 06 07:13:22 2019 +0200
    16.2 +++ b/pEpForiOS/UI/EmailDisplay/EmailViewController.swift	Tue Jun 11 08:57:01 2019 +0200
    16.3 @@ -425,6 +425,7 @@
    16.4          }
    16.5          Message.imapDelete(messages: [message])
    16.6          delegate?.emailDisplayDidDelete(message: message)
    16.7 +        navigationController?.popViewController(animated: true)
    16.8      }
    16.9  
   16.10      /**
    17.1 --- a/pEpForiOS/UI/Util/UIUtils.swift	Thu Jun 06 07:13:22 2019 +0200
    17.2 +++ b/pEpForiOS/UI/Util/UIUtils.swift	Tue Jun 11 08:57:01 2019 +0200
    17.3 @@ -98,6 +98,7 @@
    17.4          var prefilledTo: Identity? = nil
    17.5          if let address = address {
    17.6              let to = Identity(address: address)
    17.7 +            to.save()
    17.8              prefilledTo = to
    17.9          }
   17.10          let composeVM = ComposeViewModel(resultDelegate: nil,
    18.1 --- a/pEpForiOS/UI/Util/UrlClickHandlerProtocol.swift	Thu Jun 06 07:13:22 2019 +0200
    18.2 +++ b/pEpForiOS/UI/Util/UrlClickHandlerProtocol.swift	Tue Jun 11 08:57:01 2019 +0200
    18.3 @@ -67,7 +67,6 @@
    18.4          return true
    18.5      }
    18.6  
    18.7 -    @available(iOS 10.0, *)
    18.8      func textView(_ textView: UITextView, shouldInteractWith URL: URL,
    18.9                    in characterRange: NSRange,
   18.10                    interaction: UITextItemInteraction) -> Bool {
    19.1 --- a/pEpForiOS/Util/IdentityImageTool.swift	Thu Jun 06 07:13:22 2019 +0200
    19.2 +++ b/pEpForiOS/Util/IdentityImageTool.swift	Tue Jun 11 08:57:01 2019 +0200
    19.3 @@ -64,85 +64,10 @@
    19.4          IdentityImageTool.imageCache.removeAll()
    19.5      }
    19.6  
    19.7 -    //    func cachedIdentityImage(for identity: Identity) -> UIImage? { //!!!: cleanup
    19.8 -//        var searchKey: IdentityKey? = nil
    19.9 -//        let session = Session()
   19.10 -//        session.performAndWait {
   19.11 -//            let safeIdentity = identity.safeForSession(session)
   19.12 -//            searchKey = IdentityKey(identity: safeIdentity)
   19.13 -//        }
   19.14 -//        guard let key = searchKey else {
   19.15 -//            return nil
   19.16 -//        }
   19.17 -//        return IdentityImageTool.imageCache[key]
   19.18 -//    }
   19.19 -
   19.20      func cachedIdentityImage(for key: IdentityKey) -> UIImage? {
   19.21          return IdentityImageTool.imageCache[key]
   19.22      }
   19.23  
   19.24 -    /// Creates (and caches) the contact image to display for an identity.
   19.25 -    /// This is a possibly time consuming process and shold not be called from the main thread.
   19.26 -    ///
   19.27 -    /// - Parameters:
   19.28 -    ///   - identity: identity to create contact image to doisplay for
   19.29 -    ///   - imageSize: size of the image to create
   19.30 -    ///   - textColor: text color to use in case the resulting images contains the users initials
   19.31 -    ///   - backgroundColor: backgroundcolor to use in case the resulting images contains
   19.32 -    ///     the users initials
   19.33 -    /// - Returns: contact image to display
   19.34 -//    func identityImage(for identity: Identity, //!!!: cleanup
   19.35 -//                       imageSize: CGSize = CGSize.defaultAvatarSize,
   19.36 -//                       textColor: UIColor = UIColor.white,
   19.37 -//                       backgroundColor: UIColor = UIColor(hexString: "#c8c7cc")) -> UIImage? {
   19.38 -//        if let cachedImage = cachedIdentityImage(for: identity) {
   19.39 -//            // We have the image in cache. Return it.
   19.40 -//            return cachedImage
   19.41 -//        }
   19.42 -//
   19.43 -//        var image:UIImage?
   19.44 -//
   19.45 -//        let session = Session()
   19.46 -//        let safeIdentity = identity.safeForSession(session)
   19.47 -//        session.performAndWait { [weak self] in
   19.48 -//
   19.49 -//
   19.50 -//            guard let me = self else {
   19.51 -//                Log.shared.errorAndCrash(component: #function, errorString: "Lost myself")
   19.52 -//                return
   19.53 -//            }
   19.54 -//
   19.55 -//            if let addressBookID = safeIdentity.addressBookID {
   19.56 -//                // Get image from system AddressBook if any
   19.57 -//                let ab = AddressBook()
   19.58 -//                if let contact = ab.contactBy(addressBookID: addressBookID),
   19.59 -//                    let imgData = contact.thumbnailImageData {
   19.60 -//                    image = UIImage(data: imgData)
   19.61 -//                }
   19.62 -//            }
   19.63 -//
   19.64 -//            if image == nil {
   19.65 -//                // We cound not find an image anywhere. Let's create one with the initials
   19.66 -//                var initials = "?"
   19.67 -//                if let userName = safeIdentity.userName {
   19.68 -//                    initials = userName.initials()
   19.69 -//                } else {
   19.70 -//                    let namePart = safeIdentity.address.namePartOfEmail()
   19.71 -//                    initials = namePart.initials()
   19.72 -//                }
   19.73 -//                image =  me.identityImageFromName(initials: initials,
   19.74 -//                                              size: imageSize,
   19.75 -//                                              textColor: textColor,
   19.76 -//                                              imageBackgroundColor: backgroundColor)
   19.77 -//            }
   19.78 -//            if let safeImage = image {
   19.79 -//                // cache image
   19.80 -//                let saveKey = IdentityKey(identity: safeIdentity)
   19.81 -//                IdentityImageTool.imageCache[saveKey] = safeImage
   19.82 -//            }
   19.83 -//        }
   19.84 -//        return image
   19.85 -//    }
   19.86  
   19.87      func identityImage(for identityKey: IdentityKey,
   19.88                         imageSize: CGSize = CGSize.defaultAvatarSize,
    20.1 --- a/pEpForiOSTests/Models/SetOwnKeyViewModelTests.swift	Thu Jun 06 07:13:22 2019 +0200
    20.2 +++ b/pEpForiOSTests/Models/SetOwnKeyViewModelTests.swift	Tue Jun 11 08:57:01 2019 +0200
    20.3 @@ -127,10 +127,7 @@
    20.4          let attachments = theCdMessage.attachments?.array as? [CdAttachment] ?? []
    20.5          XCTAssertEqual(attachments.count, 0)
    20.6  
    20.7 -        guard let msg = theCdMessage.message() else {
    20.8 -            XCTFail()
    20.9 -            return
   20.10 -        }
   20.11 +        let msg = MessageModelObjectUtils.getMessage(fromCdMessage: theCdMessage)
   20.12  
   20.13          XCTAssertEqual(msg.attachments.count, 0)
   20.14  
    21.1 --- a/pEpForiOSTests/TestUtils/Message+TestUtils.swift	Thu Jun 06 07:13:22 2019 +0200
    21.2 +++ b/pEpForiOSTests/TestUtils/Message+TestUtils.swift	Tue Jun 11 08:57:01 2019 +0200
    21.3 @@ -55,7 +55,9 @@
    21.4          let pFolder =
    21.5              CdMessage.PredicateFactory.belongingToParentFolderNamed(parentFolderName: folderName)
    21.6          let p = NSCompoundPredicate(andPredicateWithSubpredicates: [pAccount, pUid, pFolder])
    21.7 -        let cdMessage = CdMessage.all(predicate: p)?.first as? CdMessage
    21.8 -        return cdMessage?.message()
    21.9 +        guard let cdMessage = CdMessage.all(predicate: p)?.first as? CdMessage else {
   21.10 +            return nil
   21.11 +        }
   21.12 +        return MessageModelObjectUtils.getMessage(fromCdMessage: cdMessage)
   21.13      }
   21.14  }
    22.1 --- a/pEpForiOSTests/TestUtils/TestUtil.swift	Thu Jun 06 07:13:22 2019 +0200
    22.2 +++ b/pEpForiOSTests/TestUtils/TestUtil.swift	Tue Jun 11 08:57:01 2019 +0200
    22.3 @@ -710,14 +710,16 @@
    22.4      static func setUpPepFromMail(emailFilePath: String,
    22.5                                   decryptDelegate: DecryptMessagesOperationDelegateProtocol? = nil)
    22.6          -> (mySelf: Identity, partner: Identity, message: Message)? {
    22.7 -            if let (mySelfID, partnerID, message) = cdMessageAndSetUpPepFromMail(
    22.8 -                emailFilePath: emailFilePath, decryptDelegate: decryptDelegate),
    22.9 -                let msg = message.message(),
   22.10 +            guard
   22.11 +                let (mySelfID, partnerID, cdMessage) = cdMessageAndSetUpPepFromMail(
   22.12 +                    emailFilePath: emailFilePath, decryptDelegate: decryptDelegate),
   22.13                  let mySelf = mySelfID.identity(),
   22.14 -                let partner = partnerID.identity() {
   22.15 -                return (mySelf: mySelf, partner: partner, message: msg)
   22.16 +                let partner = partnerID.identity()
   22.17 +                else {
   22.18 +                    return nil
   22.19              }
   22.20 -            return nil
   22.21 +            let msg = MessageModelObjectUtils.getMessage(fromCdMessage: cdMessage)
   22.22 +            return (mySelf: mySelf, partner: partner, message: msg)
   22.23      }
   22.24  
   22.25      /**