IOS-1455 nav and view utils IOS-1455
authorXavier Algarra <xavier@pep-project.org>
Tue, 12 Feb 2019 12:12:48 +0100
branchIOS-1455
changeset 7612d5f2b11b810d
parent 7611 f5489907287d
child 7613 ba69967473eb
IOS-1455 nav and view utils
pEpForiOS.xcodeproj/project.pbxproj
pEpForiOS/UI/SplitView/PrimarySplitViewController.swift
pEpForiOS/UI/Thread/Transitions/DetailCellSegue.swift
pEpForiOS/UI/Util/UINavigationController+Extensions.swift
pEpForiOS/UI/Util/UIView+Autolayout.swift
pEpUtilities/pEpUtilities/pEpUtilities.xcodeproj/project.pbxproj
pEpUtilities/pEpUtilities/pEpUtilities/UIKit/UINavigationController+Extensions.swift
pEpUtilities/pEpUtilities/pEpUtilities/UIKit/UIView+Autolayout.swift
     1.1 --- a/pEpForiOS.xcodeproj/project.pbxproj	Tue Feb 12 12:03:54 2019 +0100
     1.2 +++ b/pEpForiOS.xcodeproj/project.pbxproj	Tue Feb 12 12:12:48 2019 +0100
     1.3 @@ -56,7 +56,6 @@
     1.4  		150B8E991FCDACBB00374438 /* AccountSettingsUserInputError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 150B8E971FCDACBB00374438 /* AccountSettingsUserInputError.swift */; };
     1.5  		150B8EB31FCEB93D00374438 /* UIUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 150B8EB21FCEB93D00374438 /* UIUtils.swift */; };
     1.6  		150DF6D02052A13700A9DCF7 /* SecureWebViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 150DF6CF2052A13700A9DCF7 /* SecureWebViewController.swift */; };
     1.7 -		150DF6D32052ED4800A9DCF7 /* UIView+Autolayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 150DF6D22052ED4800A9DCF7 /* UIView+Autolayout.swift */; };
     1.8  		150E18C0219D8C6C009E9048 /* ComposeViewModelSectionTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 150E18BF219D8C6C009E9048 /* ComposeViewModelSectionTest.swift */; };
     1.9  		15175CEC205929FB00A8D9D0 /* CidHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 15175CEB205929FB00A8D9D0 /* CidHandler.swift */; };
    1.10  		151AD7AD219D74C700FC36FF /* ComposeViewModelTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 151AD7AC219D74C700FC36FF /* ComposeViewModelTest.swift */; };
    1.11 @@ -163,7 +162,6 @@
    1.12  		1574D07D2114696B00FEDC93 /* URL+MailToTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1574D07C2114696B00FEDC93 /* URL+MailToTest.swift */; };
    1.13  		1574D09B21186A1D00FEDC93 /* AddToContactsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1574D09A21186A1D00FEDC93 /* AddToContactsViewController.swift */; };
    1.14  		157743B8217885EA0007222C /* RecipientTextViewModelTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 157743B7217885EA0007222C /* RecipientTextViewModelTest.swift */; };
    1.15 -		1579397B1F4E00AF00A2A6CF /* UINavigationController+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1579397A1F4E00AF00A2A6CF /* UINavigationController+Extensions.swift */; };
    1.16  		157C05482180756300E530DE /* DocumentAttachmentPickerViewModelTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 157C05472180756300E530DE /* DocumentAttachmentPickerViewModelTest.swift */; };
    1.17  		15865A8920319ADC00F7A4B5 /* Folder+pEp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 15865A8820319ADC00F7A4B5 /* Folder+pEp.swift */; };
    1.18  		15874BC12127493E00A3A4A6 /* SettingSwitchTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 15874BA82127493E00A3A4A6 /* SettingSwitchTableViewCell.swift */; };
    1.19 @@ -649,7 +647,6 @@
    1.20  		150B8E971FCDACBB00374438 /* AccountSettingsUserInputError.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AccountSettingsUserInputError.swift; sourceTree = "<group>"; };
    1.21  		150B8EB21FCEB93D00374438 /* UIUtils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIUtils.swift; sourceTree = "<group>"; };
    1.22  		150DF6CF2052A13700A9DCF7 /* SecureWebViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecureWebViewController.swift; sourceTree = "<group>"; };
    1.23 -		150DF6D22052ED4800A9DCF7 /* UIView+Autolayout.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIView+Autolayout.swift"; sourceTree = "<group>"; };
    1.24  		150E18BF219D8C6C009E9048 /* ComposeViewModelSectionTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ComposeViewModelSectionTest.swift; sourceTree = "<group>"; };
    1.25  		15175CEB205929FB00A8D9D0 /* CidHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CidHandler.swift; sourceTree = "<group>"; };
    1.26  		151AD7AC219D74C700FC36FF /* ComposeViewModelTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ComposeViewModelTest.swift; sourceTree = "<group>"; };
    1.27 @@ -757,7 +754,6 @@
    1.28  		1574D07C2114696B00FEDC93 /* URL+MailToTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "URL+MailToTest.swift"; sourceTree = "<group>"; };
    1.29  		1574D09A21186A1D00FEDC93 /* AddToContactsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = AddToContactsViewController.swift; path = AddToContactsViewController/AddToContactsViewController.swift; sourceTree = "<group>"; };
    1.30  		157743B7217885EA0007222C /* RecipientTextViewModelTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RecipientTextViewModelTest.swift; sourceTree = "<group>"; };
    1.31 -		1579397A1F4E00AF00A2A6CF /* UINavigationController+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UINavigationController+Extensions.swift"; sourceTree = "<group>"; };
    1.32  		157C05472180756300E530DE /* DocumentAttachmentPickerViewModelTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DocumentAttachmentPickerViewModelTest.swift; sourceTree = "<group>"; };
    1.33  		15865A8820319ADC00F7A4B5 /* Folder+pEp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Folder+pEp.swift"; sourceTree = "<group>"; };
    1.34  		15874BA82127493E00A3A4A6 /* SettingSwitchTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SettingSwitchTableViewCell.swift; sourceTree = "<group>"; };
    1.35 @@ -2355,13 +2351,11 @@
    1.36  				43293EFA1EB9DD6700EEE010 /* UIViewController+Extension.swift */,
    1.37  				434AC3E220A450D700C11B7F /* UIAlertController+Extension.swift */,
    1.38  				43C322081EA90192005073FB /* PEP+UI.swift */,
    1.39 -				1579397A1F4E00AF00A2A6CF /* UINavigationController+Extensions.swift */,
    1.40  				4330278D1F7BABFF00D685F8 /* GradientView.swift */,
    1.41  				15B2204F1FBF5D6E00CA52BA /* InfoPlist.swift */,
    1.42  				15B220511FC2DAE200CA52BA /* InfoPlist+pEpStrings.swift */,
    1.43  				150B8EB21FCEB93D00374438 /* UIUtils.swift */,
    1.44  				43985D0D204438480080FA9A /* AccountSettingsProtocol+Extension.swift */,
    1.45 -				150DF6D22052ED4800A9DCF7 /* UIView+Autolayout.swift */,
    1.46  				490CEBA62100EAD500E8579C /* SelfDismissable.swift */,
    1.47  				1574D077211356E000FEDC93 /* UrlClickHandlerProtocol.swift */,
    1.48  				1574D09A21186A1D00FEDC93 /* AddToContactsViewController.swift */,
    1.49 @@ -3439,7 +3433,6 @@
    1.50  				1500199D1F2B2C73003E670A /* Notification+CWServiceClientNotificationParsing.swift in Sources */,
    1.51  				496C0EE720BC2A880009B5B9 /* EmailDisplayDelegate.swift in Sources */,
    1.52  				152A39DD21905C3E00D9F8E4 /* AccountCell.swift in Sources */,
    1.53 -				1579397B1F4E00AF00A2A6CF /* UINavigationController+Extensions.swift in Sources */,
    1.54  				43306EC21FE129840045DD00 /* OAuth2Type.swift in Sources */,
    1.55  				43CE63CB1DE8830100FAC505 /* CdAccount+pEp.swift in Sources */,
    1.56  				438052871FE3E1B100ACF729 /* OAuth2AuthorizationFactoryProtocol.swift in Sources */,
    1.57 @@ -3451,7 +3444,6 @@
    1.58  				434BF39520C6B72000FCBCCA /* ThreadAwareMessageProtocol.swift in Sources */,
    1.59  				004A8C5B211316E100203143 /* SelfReferencingOperation.swift in Sources */,
    1.60  				152A39D121905C3E00D9F8E4 /* AttachmentViewModel.swift in Sources */,
    1.61 -				150DF6D32052ED4800A9DCF7 /* UIView+Autolayout.swift in Sources */,
    1.62  				15547568213931BC005A52D0 /* Folder+Threading.swift in Sources */,
    1.63  				4330278E1F7BABFF00D685F8 /* GradientView.swift in Sources */,
    1.64  				4315E4BF2011FD6900F68763 /* AuthMethod.swift in Sources */,
     2.1 --- a/pEpForiOS/UI/SplitView/PrimarySplitViewController.swift	Tue Feb 12 12:03:54 2019 +0100
     2.2 +++ b/pEpForiOS/UI/SplitView/PrimarySplitViewController.swift	Tue Feb 12 12:12:48 2019 +0100
     2.3 @@ -7,6 +7,7 @@
     2.4  //
     2.5  
     2.6  import UIKit
     2.7 +import pEpUtilities
     2.8  
     2.9  class PrimarySplitViewController: UISplitViewController, UISplitViewControllerDelegate {
    2.10      override func viewDidLoad() {
     3.1 --- a/pEpForiOS/UI/Thread/Transitions/DetailCellSegue.swift	Tue Feb 12 12:03:54 2019 +0100
     3.2 +++ b/pEpForiOS/UI/Thread/Transitions/DetailCellSegue.swift	Tue Feb 12 12:12:48 2019 +0100
     3.3 @@ -7,6 +7,7 @@
     3.4  //
     3.5  
     3.6  import UIKit
     3.7 +import pEpUtilities
     3.8  
     3.9  class DetailCellSegue: UIStoryboardSegue {
    3.10  
     4.1 --- a/pEpForiOS/UI/Util/UINavigationController+Extensions.swift	Tue Feb 12 12:03:54 2019 +0100
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,15 +0,0 @@
     4.4 -//
     4.5 -//  UINavigationController+Extensions.swift
     4.6 -//  pEpForiOS
     4.7 -//
     4.8 -//  Created by Andreas Buff on 23.08.17.
     4.9 -//  Copyright © 2017 p≡p Security S.A. All rights reserved.
    4.10 -//
    4.11 -
    4.12 -import UIKit
    4.13 -
    4.14 -extension UINavigationController {
    4.15 -    var rootViewController : UIViewController? {
    4.16 -        return viewControllers.first
    4.17 -    }
    4.18 -}
     5.1 --- a/pEpForiOS/UI/Util/UIView+Autolayout.swift	Tue Feb 12 12:03:54 2019 +0100
     5.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3 @@ -1,32 +0,0 @@
     5.4 -//
     5.5 -//  UIView+Autolayout.swift
     5.6 -//  pEp
     5.7 -//
     5.8 -//  Created by Andreas Buff on 09.03.18.
     5.9 -//  Copyright © 2018 p≡p Security S.A. All rights reserved.
    5.10 -//
    5.11 -
    5.12 -import UIKit
    5.13 -import pEpUtilities
    5.14 -
    5.15 -extension UIView {
    5.16 -    /// Sets up constraints to always stay the same size as the superview.
    5.17 -    func fullSizeInSuperView() {
    5.18 -        guard let superview = self.superview else {
    5.19 -            Logger.frontendLogger.errorAndCrash("No superview")
    5.20 -            return
    5.21 -        }
    5.22 -
    5.23 -        self.translatesAutoresizingMaskIntoConstraints = false
    5.24 -        superview.addConstraints(NSLayoutConstraint.constraints(
    5.25 -            withVisualFormat: "H:|-0-[subview]-0-|",
    5.26 -            options: .directionLeadingToTrailing,
    5.27 -            metrics: nil,
    5.28 -            views: ["subview": self]))
    5.29 -        superview.addConstraints(NSLayoutConstraint.constraints(
    5.30 -            withVisualFormat: "V:|-0-[subview]-0-|",
    5.31 -            options: .directionLeadingToTrailing,
    5.32 -            metrics: nil,
    5.33 -            views: ["subview": self]))
    5.34 -    }
    5.35 -}
     6.1 --- a/pEpUtilities/pEpUtilities/pEpUtilities.xcodeproj/project.pbxproj	Tue Feb 12 12:03:54 2019 +0100
     6.2 +++ b/pEpUtilities/pEpUtilities/pEpUtilities.xcodeproj/project.pbxproj	Tue Feb 12 12:12:48 2019 +0100
     6.3 @@ -24,6 +24,8 @@
     6.4  		B7465DE92212CCDB008A1708 /* UIButton+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = B7465DE82212CCDB008A1708 /* UIButton+Extension.swift */; };
     6.5  		B753907E2212D6B500B1FCF9 /* CGSize+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = B753907D2212D6B500B1FCF9 /* CGSize+Extension.swift */; };
     6.6  		B75390802212DD0600B1FCF9 /* UIView+Util.swift in Sources */ = {isa = PBXBuildFile; fileRef = B753907F2212DD0600B1FCF9 /* UIView+Util.swift */; };
     6.7 +		B75390822212DFB600B1FCF9 /* UINavigationController+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = B75390812212DFB500B1FCF9 /* UINavigationController+Extensions.swift */; };
     6.8 +		B75390842212DFD800B1FCF9 /* UIView+Autolayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = B75390832212DFD800B1FCF9 /* UIView+Autolayout.swift */; };
     6.9  		B7911EC221F8694100D7F66F /* UIColor+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = B7911EC121F8694000D7F66F /* UIColor+Extension.swift */; };
    6.10  		B7911EC621F88AF800D7F66F /* UIImage+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = B7911EC521F88AF800D7F66F /* UIImage+Extension.swift */; };
    6.11  		B7911EC821F88D0200D7F66F /* UITextField+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = B7911EC721F88D0200D7F66F /* UITextField+Extension.swift */; };
    6.12 @@ -57,6 +59,8 @@
    6.13  		B7465DE82212CCDB008A1708 /* UIButton+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIButton+Extension.swift"; sourceTree = "<group>"; };
    6.14  		B753907D2212D6B500B1FCF9 /* CGSize+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "CGSize+Extension.swift"; sourceTree = "<group>"; };
    6.15  		B753907F2212DD0600B1FCF9 /* UIView+Util.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIView+Util.swift"; sourceTree = "<group>"; };
    6.16 +		B75390812212DFB500B1FCF9 /* UINavigationController+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UINavigationController+Extensions.swift"; sourceTree = "<group>"; };
    6.17 +		B75390832212DFD800B1FCF9 /* UIView+Autolayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIView+Autolayout.swift"; sourceTree = "<group>"; };
    6.18  		B7911EB421F7358500D7F66F /* pEpUtilities.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = pEpUtilities.framework; sourceTree = BUILT_PRODUCTS_DIR; };
    6.19  		B7911EB821F7358500D7F66F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
    6.20  		B7911EC121F8694000D7F66F /* UIColor+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIColor+Extension.swift"; sourceTree = "<group>"; };
    6.21 @@ -124,6 +128,8 @@
    6.22  				B7465DE02211C6E9008A1708 /* UIImage+GIF.swift */,
    6.23  				B7465DE42211E08A008A1708 /* UIImageView+Extension.swift */,
    6.24  				B753907F2212DD0600B1FCF9 /* UIView+Util.swift */,
    6.25 +				B75390832212DFD800B1FCF9 /* UIView+Autolayout.swift */,
    6.26 +				B75390812212DFB500B1FCF9 /* UINavigationController+Extensions.swift */,
    6.27  			);
    6.28  			path = UIKit;
    6.29  			sourceTree = "<group>";
    6.30 @@ -253,6 +259,7 @@
    6.31  				B70A3A7322006B9F00EDCE61 /* SystemUtils.swift in Sources */,
    6.32  				B7465DDF2211C6C8008A1708 /* UIBarButtonItem+Extension.swift in Sources */,
    6.33  				B7936E3D220DD8F5003B39E6 /* NSAttributedString+Extensions.swift in Sources */,
    6.34 +				B75390842212DFD800B1FCF9 /* UIView+Autolayout.swift in Sources */,
    6.35  				B7465DE92212CCDB008A1708 /* UIButton+Extension.swift in Sources */,
    6.36  				B7911EC221F8694100D7F66F /* UIColor+Extension.swift in Sources */,
    6.37  				B753907E2212D6B500B1FCF9 /* CGSize+Extension.swift in Sources */,
    6.38 @@ -266,6 +273,7 @@
    6.39  				B7465DBE22119D3A008A1708 /* Thread+Extension.swift in Sources */,
    6.40  				B7A46C52220C732E0027CCB5 /* Data+Extensions.swift in Sources */,
    6.41  				B7465DC82211A062008A1708 /* SegueHandlerType.swift in Sources */,
    6.42 +				B75390822212DFB600B1FCF9 /* UINavigationController+Extensions.swift in Sources */,
    6.43  				B7465DCA2211BB3C008A1708 /* CredentialTextField.swift in Sources */,
    6.44  				B7465DE32211C890008A1708 /* CGImageSource+Extension.swift in Sources */,
    6.45  				B7465DE12211C6E9008A1708 /* UIImage+GIF.swift in Sources */,
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/pEpUtilities/pEpUtilities/pEpUtilities/UIKit/UINavigationController+Extensions.swift	Tue Feb 12 12:12:48 2019 +0100
     7.3 @@ -0,0 +1,15 @@
     7.4 +//
     7.5 +//  UINavigationController+Extensions.swift
     7.6 +//  pEpForiOS
     7.7 +//
     7.8 +//  Created by Andreas Buff on 23.08.17.
     7.9 +//  Copyright © 2017 p≡p Security S.A. All rights reserved.
    7.10 +//
    7.11 +
    7.12 +import UIKit
    7.13 +
    7.14 +extension UINavigationController {
    7.15 +    public var rootViewController : UIViewController? {
    7.16 +        return viewControllers.first
    7.17 +    }
    7.18 +}
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/pEpUtilities/pEpUtilities/pEpUtilities/UIKit/UIView+Autolayout.swift	Tue Feb 12 12:12:48 2019 +0100
     8.3 @@ -0,0 +1,31 @@
     8.4 +//
     8.5 +//  UIView+Autolayout.swift
     8.6 +//  pEp
     8.7 +//
     8.8 +//  Created by Andreas Buff on 09.03.18.
     8.9 +//  Copyright © 2018 p≡p Security S.A. All rights reserved.
    8.10 +//
    8.11 +
    8.12 +import UIKit
    8.13 +
    8.14 +extension UIView {
    8.15 +    /// Sets up constraints to always stay the same size as the superview.
    8.16 +    public func fullSizeInSuperView() {
    8.17 +        guard let superview = self.superview else {
    8.18 +            Logger.frontendLogger.errorAndCrash("No superview")
    8.19 +            return
    8.20 +        }
    8.21 +
    8.22 +        self.translatesAutoresizingMaskIntoConstraints = false
    8.23 +        superview.addConstraints(NSLayoutConstraint.constraints(
    8.24 +            withVisualFormat: "H:|-0-[subview]-0-|",
    8.25 +            options: .directionLeadingToTrailing,
    8.26 +            metrics: nil,
    8.27 +            views: ["subview": self]))
    8.28 +        superview.addConstraints(NSLayoutConstraint.constraints(
    8.29 +            withVisualFormat: "V:|-0-[subview]-0-|",
    8.30 +            options: .directionLeadingToTrailing,
    8.31 +            metrics: nil,
    8.32 +            views: ["subview": self]))
    8.33 +    }
    8.34 +}