IOS-1542 Remove unused code. IOS-1542
authorDirk Zimmermann <dz@pep.security>
Thu, 25 Apr 2019 16:25:40 +0200
branchIOS-1542
changeset 8380fd237aaceec6
parent 8379 f19109e055f9
child 8381 907e287ead66
IOS-1542 Remove unused code.
pEpForiOS/Models/VerifiableAccount/VerifiableAccount.swift
     1.1 --- a/pEpForiOS/Models/VerifiableAccount/VerifiableAccount.swift	Thu Apr 25 16:25:40 2019 +0200
     1.2 +++ b/pEpForiOS/Models/VerifiableAccount/VerifiableAccount.swift	Thu Apr 25 16:25:40 2019 +0200
     1.3 @@ -335,78 +335,6 @@
     1.4          return server
     1.5      }
     1.6  
     1.7 -    // MARK: - Legacy
     1.8 -
     1.9 -    /// Returns an Account instance filled with data of self.
    1.10 -    /// It does not deal with Core Data (does not persist).
    1.11 -    /// Only data from this model is taken into account, not needsVerivication or others.
    1.12 -    ///
    1.13 -    /// - Returns: filled Account
    1.14 -    /// - Throws: AccountSettingsUserInputError
    1.15 -    public func account() throws -> Account {
    1.16 -        guard let address = self.address, address != "" else {
    1.17 -            let msg = NSLocalizedString("E-mail must not be empty",
    1.18 -                                        comment: "Alert message for empty e-mail address field")
    1.19 -            throw AccountSettingsUserInputError.invalidInputEmailAddress(localizedMessage: msg)
    1.20 -        }
    1.21 -
    1.22 -        guard let userName = self.userName, userName != "" else {
    1.23 -            let msg = NSLocalizedString("Username must not be empty",
    1.24 -                                        comment: "Alert message for empty username")
    1.25 -            throw AccountSettingsUserInputError.invalidInputUserName(localizedMessage: msg)
    1.26 -        }
    1.27 -
    1.28 -        guard let serverIMAP = self.serverIMAP, serverIMAP != "" else {
    1.29 -            let msg = NSLocalizedString("IMAP server must not be empty",
    1.30 -                                        comment: "Alert message for empty IMAP server")
    1.31 -            throw AccountSettingsUserInputError.invalidInputServer(localizedMessage: msg)
    1.32 -        }
    1.33 -        guard let serverSMTP = self.serverSMTP, serverSMTP != "" else {
    1.34 -            let msg = NSLocalizedString("SMTP server must not be empty",
    1.35 -                                        comment: "Alert message for empty SMTP server")
    1.36 -            throw AccountSettingsUserInputError.invalidInputServer(localizedMessage: msg)
    1.37 -        }
    1.38 -
    1.39 -        let identity = Identity.create(address: address, userID: nil, userName: userName,
    1.40 -                                       isMySelf: true)
    1.41 -
    1.42 -        var logIn = self.loginName ?? address
    1.43 -        if logIn.isEmpty {
    1.44 -            logIn = address
    1.45 -        }
    1.46 -
    1.47 -        let thePassword = accessToken?.persistBase64Encoded() ?? password
    1.48 -        // The key is created upfront, in case of SASL XOAUTH2, where we want to link
    1.49 -        // the token to the same key
    1.50 -        let credentialsImap = ServerCredentials.create(loginName: logIn,
    1.51 -                                                       key: accessToken?.keyChainID)
    1.52 -        credentialsImap.password = thePassword
    1.53 -
    1.54 -        let imapServer = Server.create(serverType: .imap, port: self.portIMAP, address: serverIMAP,
    1.55 -                                       transport: self.transportIMAP.toServerTransport(),
    1.56 -                                       authMethod: authMethod?.rawValue,
    1.57 -                                       credentials: credentialsImap)
    1.58 -
    1.59 -        let credentialsSmtp: ServerCredentials
    1.60 -        if authMethod == .saslXoauth2 {
    1.61 -            // In case of SASL XOAUTH2, there will be only 1 credential, with our created key
    1.62 -            credentialsSmtp = credentialsImap
    1.63 -        } else {
    1.64 -            credentialsSmtp = ServerCredentials.create(loginName: logIn, key: accessToken?.keyChainID)
    1.65 -            credentialsSmtp.password = thePassword
    1.66 -        }
    1.67 -
    1.68 -        let smtpServer = Server.create(serverType: .smtp,
    1.69 -                                       port: self.portSMTP,
    1.70 -                                       address: serverSMTP,
    1.71 -                                       transport: self.transportSMTP.toServerTransport(),
    1.72 -                                       authMethod: authMethod?.rawValue,
    1.73 -                                       credentials: credentialsSmtp)
    1.74 -
    1.75 -        let account = Account(user: identity, servers: [imapServer, smtpServer])
    1.76 -        return account
    1.77 -    }
    1.78 -
    1.79      // MARK: - Internal (Behaviour)
    1.80  
    1.81      private func checkSuccess() {