IOS-1480 Move LegacyConnectInfoProvider. IOS-1480
authorDirk Zimmermann <dz@pep.security>
Mon, 18 Feb 2019 13:21:12 +0100
branchIOS-1480
changeset 768758ac06261c07
parent 7686 fc544fea26cf
child 7688 462dca82d791
IOS-1480 Move LegacyConnectInfoProvider.
pEpForiOS.xcodeproj/project.pbxproj
pEpForiOS/Network/ConnectInfo/deprecated/LegacyConnectInfoProvider.swift
     1.1 --- a/pEpForiOS.xcodeproj/project.pbxproj	Mon Feb 18 13:21:12 2019 +0100
     1.2 +++ b/pEpForiOS.xcodeproj/project.pbxproj	Mon Feb 18 13:21:12 2019 +0100
     1.3 @@ -127,7 +127,6 @@
     1.4  		1541D7F51FC82A4900D52A5D /* URL+MIME.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1541D7F41FC82A4900D52A5D /* URL+MIME.swift */; };
     1.5  		1544BD0221524C9F0075C5A0 /* AttachmentFilterTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1544BD0121524C9F0075C5A0 /* AttachmentFilterTest.swift */; };
     1.6  		1547509A1FE7C0B4000D8004 /* FetchNumberOfNewMailsOperation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 154750991FE7C0B4000D8004 /* FetchNumberOfNewMailsOperation.swift */; };
     1.7 -		15484B6C2105E26600F9D962 /* LegacyConnectInfoProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 15484B6B2105E26600F9D962 /* LegacyConnectInfoProvider.swift */; };
     1.8  		154D92CF20AC1745009A5868 /* MoveToFolderOperationTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 154D92CE20AC1744009A5868 /* MoveToFolderOperationTest.swift */; };
     1.9  		154F0A802085FC7D00C77D72 /* CdAttachment+Pantomime.swift in Sources */ = {isa = PBXBuildFile; fileRef = 154F0A7F2085FC7D00C77D72 /* CdAttachment+Pantomime.swift */; };
    1.10  		154F0A8220874B3E00C77D72 /* ContentDispositionTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 154F0A8120874B3E00C77D72 /* ContentDispositionTest.swift */; };
    1.11 @@ -670,7 +669,6 @@
    1.12  		1541D7F41FC82A4900D52A5D /* URL+MIME.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "URL+MIME.swift"; sourceTree = "<group>"; };
    1.13  		1544BD0121524C9F0075C5A0 /* AttachmentFilterTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = AttachmentFilterTest.swift; path = pEpForiOSTests/Models/Filter/AttachmentFilterTest.swift; sourceTree = SOURCE_ROOT; };
    1.14  		154750991FE7C0B4000D8004 /* FetchNumberOfNewMailsOperation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FetchNumberOfNewMailsOperation.swift; sourceTree = "<group>"; };
    1.15 -		15484B6B2105E26600F9D962 /* LegacyConnectInfoProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LegacyConnectInfoProvider.swift; sourceTree = "<group>"; };
    1.16  		154D92CE20AC1744009A5868 /* MoveToFolderOperationTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoveToFolderOperationTest.swift; sourceTree = "<group>"; };
    1.17  		154F0A7F2085FC7D00C77D72 /* CdAttachment+Pantomime.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "CdAttachment+Pantomime.swift"; sourceTree = "<group>"; };
    1.18  		154F0A8120874B3E00C77D72 /* ContentDispositionTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentDispositionTest.swift; sourceTree = "<group>"; };
    1.19 @@ -1474,7 +1472,6 @@
    1.20  		15484B662105D58800F9D962 /* deprecated */ = {
    1.21  			isa = PBXGroup;
    1.22  			children = (
    1.23 -				15484B6B2105E26600F9D962 /* LegacyConnectInfoProvider.swift */,
    1.24  			);
    1.25  			path = deprecated;
    1.26  			sourceTree = "<group>";
    1.27 @@ -3277,7 +3274,6 @@
    1.28  				1554756621393036005A52D0 /* Folder+Extensions.swift in Sources */,
    1.29  				0069DCFB2110679200846EB1 /* EmailViewController+UIPopoverPresentationControllerDelegate.swift in Sources */,
    1.30  				43106A192045716000693144 /* OAuth2ConfigurationProtocol+Extension.swift in Sources */,
    1.31 -				15484B6C2105E26600F9D962 /* LegacyConnectInfoProvider.swift in Sources */,
    1.32  				43C322051EA89EED005073FB /* HandshakePartnerTableViewCell.swift in Sources */,
    1.33  				15BA536C20A08D270090F126 /* UnifiedInbox.swift in Sources */,
    1.34  				152A39C521905C3E00D9F8E4 /* ComposeTableViewController.swift in Sources */,
     2.1 --- a/pEpForiOS/Network/ConnectInfo/deprecated/LegacyConnectInfoProvider.swift	Mon Feb 18 13:21:12 2019 +0100
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,66 +0,0 @@
     2.4 -//
     2.5 -//  LegacyConnectInfoProvider.swift
     2.6 -//  pEp
     2.7 -//
     2.8 -//  Created by Andreas Buff on 23.07.18.
     2.9 -//  Copyright © 2018 p≡p Security S.A. All rights reserved.
    2.10 -//
    2.11 -
    2.12 -import MessageModel
    2.13 -import CoreData
    2.14 -
    2.15 -/// Supports usage of deprecated EmailConnectInfo.
    2.16 -extension ConnectInfo {
    2.17 -    @available(*, deprecated, message: "use account instead")
    2.18 -    var accountObjectID: NSManagedObjectID? {
    2.19 -        var result: NSManagedObjectID? = nil
    2.20 -        MessageModel.performAndWait { [weak self] in
    2.21 -            guard let me = self else {
    2.22 -                Logger.frontendLogger.lostMySelf()
    2.23 -                return
    2.24 -            }
    2.25 -            guard let cdAccount = CdAccount.search(account: me.account) else {
    2.26 -                Logger.utilLogger.errorAndCrash("No CdAccount")
    2.27 -                return
    2.28 -            }
    2.29 -            result = cdAccount.objectID
    2.30 -        }
    2.31 -        return result
    2.32 -    }
    2.33 -
    2.34 -    @available(*, deprecated, message: "use server instead")
    2.35 -    var serverObjectID: NSManagedObjectID? {
    2.36 -        var result: NSManagedObjectID? = nil
    2.37 -        MessageModel.performAndWait { [weak self] in
    2.38 -            guard let me = self else {
    2.39 -                Logger.frontendLogger.lostMySelf()
    2.40 -                return
    2.41 -            }
    2.42 -            let serverType = me.server.serverType
    2.43 -            guard
    2.44 -                let cdAccount = CdAccount.search(account: me.account),
    2.45 -                let cdServer = cdAccount.server(type: serverType) else {
    2.46 -                    Logger.utilLogger.errorAndCrash("No CdAccount")
    2.47 -                    return
    2.48 -            }
    2.49 -            result = cdServer.objectID
    2.50 -        }
    2.51 -        return result
    2.52 -    }
    2.53 -}
    2.54 -
    2.55 -extension EmailConnectInfo {
    2.56 -
    2.57 -    @available(*, deprecated, message: "use folderBy(name:) instead")
    2.58 -    func folderBy(name: String, context: NSManagedObjectContext) throws -> CdFolder {
    2.59 -        guard
    2.60 -            let accountId = accountObjectID,
    2.61 -            let cdAccount = context.object(with: accountId) as? CdAccount else {
    2.62 -                throw BackgroundError.CoreDataError.couldNotFindAccount(info: #function)
    2.63 -        }
    2.64 -        guard let cdFolder = CdFolder.by(name: name, account: cdAccount, context: context) else {
    2.65 -            throw BackgroundError.CoreDataError.couldNotFindFolder(info: #function)
    2.66 -        }
    2.67 -        return cdFolder
    2.68 -    }
    2.69 -}