IOS-1542 Move some UI support directly into VerifiableAccountProtocol. IOS-1542
authorDirk Zimmermann <dz@pep.security>
Wed, 08 May 2019 15:52:44 +0200
branchIOS-1542
changeset 85297006b6a29946
parent 8519 3a5b50f22d85
child 8530 4674e4a9f48d
IOS-1542 Move some UI support directly into VerifiableAccountProtocol.
pEpForiOS.xcodeproj/project.pbxproj
pEpForiOS/UI/Util/Extensions/VerifiableAccountProtocol+UI.swift
     1.1 --- a/pEpForiOS.xcodeproj/project.pbxproj	Wed May 08 07:53:11 2019 +0200
     1.2 +++ b/pEpForiOS.xcodeproj/project.pbxproj	Wed May 08 15:52:44 2019 +0200
     1.3 @@ -307,7 +307,6 @@
     1.4  		43985D0A2044296D0080FA9A /* OAuth2AuthViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43985D092044296D0080FA9A /* OAuth2AuthViewModel.swift */; };
     1.5  		43985D0E204438480080FA9A /* AccountSettingsProtocol+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43985D0D204438480080FA9A /* AccountSettingsProtocol+Extension.swift */; };
     1.6  		439A23E520B40FAC00417AF5 /* PEP_rating+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 439A23E420B40FAC00417AF5 /* PEP_rating+Extension.swift */; };
     1.7 -		439B16AF22802C8300201DE5 /* VerifiableAccountProtocol+UI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 439B16AE22802C8300201DE5 /* VerifiableAccountProtocol+UI.swift */; };
     1.8  		43A0B2CF214006FC00FB779D /* ReplyUtilTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43A0B2CE214006FC00FB779D /* ReplyUtilTests.swift */; };
     1.9  		43A384812153E4BF006AC8F8 /* 8B691AD204E22FD1BF018E0D6C9EAD5A798018D1_pub_sec.txt in Resources */ = {isa = PBXBuildFile; fileRef = 43A384802153E4BF006AC8F8 /* 8B691AD204E22FD1BF018E0D6C9EAD5A798018D1_pub_sec.txt */; };
    1.10  		43A469FA21513B10002E1036 /* PEPSwipeTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43A469F921513B10002E1036 /* PEPSwipeTableViewCell.swift */; };
    1.11 @@ -821,7 +820,6 @@
    1.12  		43985D092044296D0080FA9A /* OAuth2AuthViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OAuth2AuthViewModel.swift; sourceTree = "<group>"; };
    1.13  		43985D0D204438480080FA9A /* AccountSettingsProtocol+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "AccountSettingsProtocol+Extension.swift"; sourceTree = "<group>"; };
    1.14  		439A23E420B40FAC00417AF5 /* PEP_rating+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "PEP_rating+Extension.swift"; sourceTree = "<group>"; };
    1.15 -		439B16AE22802C8300201DE5 /* VerifiableAccountProtocol+UI.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "VerifiableAccountProtocol+UI.swift"; sourceTree = "<group>"; };
    1.16  		439D406F1CC78930009A4E7C /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; };
    1.17  		439D40711CC78958009A4E7C /* libbz2.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libbz2.tbd; path = usr/lib/libbz2.tbd; sourceTree = SDKROOT; };
    1.18  		439D40731CC7897B009A4E7C /* libiconv.2.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libiconv.2.tbd; path = usr/lib/libiconv.2.tbd; sourceTree = SDKROOT; };
    1.19 @@ -2421,7 +2419,6 @@
    1.20  		B7DB7FC22215C484003968DA /* Extensions */ = {
    1.21  			isa = PBXGroup;
    1.22  			children = (
    1.23 -				439B16AE22802C8300201DE5 /* VerifiableAccountProtocol+UI.swift */,
    1.24  				B7DB7FDB221ADDBD003968DA /* UIImageView+Extension.swift */,
    1.25  				B7DB7FD9221ADDAF003968DA /* UIBarButtonItem+Extension.swift */,
    1.26  				B7DB7FD4221AD3BB003968DA /* UIButton+Extension.swift */,
    1.27 @@ -2947,7 +2944,6 @@
    1.28  				49C34AF620E4F649009D11CC /* CellDetailTransition.swift in Sources */,
    1.29  				492EF92A20C18C6C004EAE14 /* DisplayedMessage.swift in Sources */,
    1.30  				B70A3A9322089D5000EDCE61 /* Log+ASL.swift in Sources */,
    1.31 -				439B16AF22802C8300201DE5 /* VerifiableAccountProtocol+UI.swift in Sources */,
    1.32  				49228A5520D4035100A51E9D /* DetailCellSegue.swift in Sources */,
    1.33  				43497B38211C62DE00AC42B0 /* MessageIdentitfying.swift in Sources */,
    1.34  				00FD0CE82102014C00BA0C56 /* PrimarySplitViewcontroller+ScreenComposerProtocol.swift in Sources */,
     2.1 --- a/pEpForiOS/UI/Util/Extensions/VerifiableAccountProtocol+UI.swift	Wed May 08 07:53:11 2019 +0200
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,33 +0,0 @@
     2.4 -//
     2.5 -//  VerifiableAccountProtocol+UI.swift
     2.6 -//  pEp
     2.7 -//
     2.8 -//  Created by Dirk Zimmermann on 18.04.19.
     2.9 -//  Copyright © 2019 p≡p Security S.A. All rights reserved.
    2.10 -//
    2.11 -
    2.12 -import Foundation
    2.13 -
    2.14 -import MessageModel
    2.15 -
    2.16 -/// Used by the UI.
    2.17 -public extension VerifiableAccountProtocol {
    2.18 -    public var isValidName: Bool {
    2.19 -        return (userName?.count ?? 0) >= 1
    2.20 -    }
    2.21 -
    2.22 -    public var isValidUser: Bool {
    2.23 -        return isValidName && isValidEmail && isValidPassword
    2.24 -    }
    2.25 -
    2.26 -    private var isValidEmail: Bool {
    2.27 -        return address?.isProbablyValidEmail() ?? false
    2.28 -    }
    2.29 -
    2.30 -    private var isValidPassword: Bool {
    2.31 -        if let pass = password {
    2.32 -            return pass.count > 0
    2.33 -        }
    2.34 -        return false
    2.35 -    }
    2.36 -}