diff --git a/Signal.xcodeproj/project.pbxproj b/Signal.xcodeproj/project.pbxproj index 3c3f7e5ded..514a232fcb 100644 --- a/Signal.xcodeproj/project.pbxproj +++ b/Signal.xcodeproj/project.pbxproj @@ -76,10 +76,8 @@ 3402AA55271D9DCD0084CBAE /* AttachmentTextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34A95597271B510500B05242 /* AttachmentTextView.swift */; }; 3402AA56271D9DCD0084CBAE /* FindByPhoneNumberViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34A9557D271B510500B05242 /* FindByPhoneNumberViewController.swift */; }; 3402AA57271D9DCD0084CBAE /* MediaMessageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34A95578271B510500B05242 /* MediaMessageView.swift */; }; - 3402AA58271D9DCD0084CBAE /* OWSNavigationControllerBase.m in Sources */ = {isa = PBXBuildFile; fileRef = 34A9556B271B510500B05242 /* OWSNavigationControllerBase.m */; }; 3402AA5A271D9DCD0084CBAE /* OWSTableViewController2.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34A9558B271B510500B05242 /* OWSTableViewController2.swift */; }; 3402AA5B271D9DCD0084CBAE /* StickerPackCollectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34A95570271B510500B05242 /* StickerPackCollectionView.swift */; }; - 3402AA5D271D9DCD0084CBAE /* OWSNavigationControllerBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 34A95582271B510500B05242 /* OWSNavigationControllerBase.h */; settings = {ATTRIBUTES = (Public, ); }; }; 3402AA62271D9DEC0084CBAE /* ThreadUtil+SignalUI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3402A9FC271D9CB80084CBAE /* ThreadUtil+SignalUI.swift */; }; 3402AA63271D9DEC0084CBAE /* ContactShareViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34A955A5271B510500B05242 /* ContactShareViewModel.swift */; }; 3402AA65271D9DEC0084CBAE /* ThreadViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34A955A7271B510500B05242 /* ThreadViewModel.swift */; }; @@ -3147,7 +3145,6 @@ 34A95564271B510400B05242 /* Toast.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Toast.swift; sourceTree = ""; }; 34A95567271B510500B05242 /* OWSWindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OWSWindow.swift; sourceTree = ""; }; 34A95569271B510500B05242 /* ActionSheetController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionSheetController.swift; sourceTree = ""; }; - 34A9556B271B510500B05242 /* OWSNavigationControllerBase.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = OWSNavigationControllerBase.m; sourceTree = ""; }; 34A9556E271B510500B05242 /* LinearHorizontalLayout.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LinearHorizontalLayout.swift; sourceTree = ""; }; 34A9556F271B510500B05242 /* StickerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StickerView.swift; sourceTree = ""; }; 34A95570271B510500B05242 /* StickerPackCollectionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StickerPackCollectionView.swift; sourceTree = ""; }; @@ -3160,7 +3157,6 @@ 34A9557D271B510500B05242 /* FindByPhoneNumberViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FindByPhoneNumberViewController.swift; sourceTree = ""; }; 34A9557E271B510500B05242 /* SpamCaptchaViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SpamCaptchaViewController.swift; sourceTree = ""; }; 34A9557F271B510500B05242 /* TextApprovalViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextApprovalViewController.swift; sourceTree = ""; }; - 34A95582271B510500B05242 /* OWSNavigationControllerBase.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OWSNavigationControllerBase.h; sourceTree = ""; }; 34A9558A271B510500B05242 /* ContactFieldViewHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContactFieldViewHelper.swift; sourceTree = ""; }; 34A9558B271B510500B05242 /* OWSTableViewController2.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OWSTableViewController2.swift; sourceTree = ""; }; 34A9558D271B510500B05242 /* EditContactShareNameViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditContactShareNameViewController.swift; sourceTree = ""; }; @@ -6376,8 +6372,6 @@ 880C2E01262A19DE006650B6 /* InteractiveSheetViewController.swift */, 34A95591271B510500B05242 /* ModalActivityIndicatorViewController.swift */, 665EF86C290C385B00F490D2 /* OWSNavigationController.swift */, - 34A95582271B510500B05242 /* OWSNavigationControllerBase.h */, - 34A9556B271B510500B05242 /* OWSNavigationControllerBase.m */, 765283AD2A00D8B4004583A9 /* OWSTableContents.swift */, 765283B12A00D8EC004583A9 /* OWSTableItem.swift */, 765283AF2A00D8CE004583A9 /* OWSTableSection.swift */, @@ -11206,7 +11200,6 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - 3402AA5D271D9DCD0084CBAE /* OWSNavigationControllerBase.h in Headers */, 34A954BA271A471300B05242 /* SignalUI.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; @@ -12432,7 +12425,6 @@ 3402AA71271D9E180084CBAE /* OWSLayerView.swift in Sources */, 3402AAB1271D9E180084CBAE /* OWSNavigationBar.swift in Sources */, 665EF86D290C385B00F490D2 /* OWSNavigationController.swift in Sources */, - 3402AA58271D9DCD0084CBAE /* OWSNavigationControllerBase.m in Sources */, 764FE0432A2F049C004D2804 /* OWSSearchBar.swift in Sources */, 3402AA70271D9E180084CBAE /* OWSStackView.swift in Sources */, 765283AE2A00D8B4004583A9 /* OWSTableContents.swift in Sources */, diff --git a/SignalUI/Appearance/ChatColors.swift b/SignalUI/Appearance/ChatColors.swift index 6507128f75..127329d55b 100644 --- a/SignalUI/Appearance/ChatColors.swift +++ b/SignalUI/Appearance/ChatColors.swift @@ -5,6 +5,7 @@ import Foundation import SignalServiceKit +import UIKit /// Represents the chat color chosen for a particular scope. /// diff --git a/SignalUI/Appearance/ColorOrGradient.swift b/SignalUI/Appearance/ColorOrGradient.swift index 4af22eb4ef..f571818f8a 100644 --- a/SignalUI/Appearance/ColorOrGradient.swift +++ b/SignalUI/Appearance/ColorOrGradient.swift @@ -4,6 +4,7 @@ // import Foundation +import UIKit // ColorOrGradientSetting is used for persistence and comparison. // ColorOrGradientValue is used for rendering. diff --git a/SignalUI/SignalUI.h b/SignalUI/SignalUI.h index 077bede208..f6e40ad370 100644 --- a/SignalUI/SignalUI.h +++ b/SignalUI/SignalUI.h @@ -10,6 +10,3 @@ FOUNDATION_EXPORT double SignalUIVersionNumber; //! Project version string for SignalUI. FOUNDATION_EXPORT const unsigned char SignalUIVersionString[]; - -// The public headers of the framework -#import diff --git a/SignalUI/ViewControllers/OWSNavigationController.swift b/SignalUI/ViewControllers/OWSNavigationController.swift index 7a7747bcdc..196c9a16a2 100644 --- a/SignalUI/ViewControllers/OWSNavigationController.swift +++ b/SignalUI/ViewControllers/OWSNavigationController.swift @@ -53,7 +53,7 @@ extension OWSNavigationChildController { /// This navigation controller subclass should be used anywhere we might /// want to cancel back button presses or back gestures due to, for example, /// unsaved changes. -open class OWSNavigationController: OWSNavigationControllerBase { +open class OWSNavigationController: UINavigationController { private var owsNavigationBar: OWSNavigationBar { return navigationBar as! OWSNavigationBar @@ -245,23 +245,10 @@ extension OWSNavigationController: UINavigationBarDelegate { // wasBackButtonClicked is true if the back button was pressed but not // if a back gesture was performed or if the view is popped programmatically. let wasBackButtonClicked = topViewController?.navigationItem == item - var result = true - if wasBackButtonClicked { - if let child = topViewController?.getFinalNavigationChildController() { - result = !child.shouldCancelNavigationBack - } + if wasBackButtonClicked, let child = topViewController?.getFinalNavigationChildController() { + return !child.shouldCancelNavigationBack } - - // If we're not going to cancel the pop/back, we need to call the super - // implementation since it has important side effects. - if result { - // NOTE: result might end up false if the super implementation cancels the - // the pop/back. - super.ows_navigationBar(navigationBar, shouldPop: item) - result = true - } - - return result + return true } } diff --git a/SignalUI/ViewControllers/OWSNavigationControllerBase.h b/SignalUI/ViewControllers/OWSNavigationControllerBase.h deleted file mode 100644 index 7114d7e1dd..0000000000 --- a/SignalUI/ViewControllers/OWSNavigationControllerBase.h +++ /dev/null @@ -1,20 +0,0 @@ -// -// Copyright 2017 Signal Messenger, LLC -// SPDX-License-Identifier: AGPL-3.0-only -// - -#import - -NS_ASSUME_NONNULL_BEGIN - -/// This subclass exists purely to expose UINavigationController's implementation of -/// UINavigationBarDelegate to the swift subclass OWSNavigationController. Objc -/// can force a call to the superclass' implenentation of navigationBar(: shouldPopItem:) but -/// swift can't do that, so we wrap it in objc. -@interface OWSNavigationControllerBase : UINavigationController - -- (BOOL)ows_navigationBar:(UINavigationBar *)navigationBar shouldPopItem:(UINavigationItem *)item; - -@end - -NS_ASSUME_NONNULL_END diff --git a/SignalUI/ViewControllers/OWSNavigationControllerBase.m b/SignalUI/ViewControllers/OWSNavigationControllerBase.m deleted file mode 100644 index c9adec7f65..0000000000 --- a/SignalUI/ViewControllers/OWSNavigationControllerBase.m +++ /dev/null @@ -1,23 +0,0 @@ -// -// Copyright 2017 Signal Messenger, LLC -// SPDX-License-Identifier: AGPL-3.0-only -// - -#import "OWSNavigationControllerBase.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface UINavigationController (OWSNavigationControllerBase) - -@end - -@implementation OWSNavigationControllerBase - -- (BOOL)ows_navigationBar:(UINavigationBar *)navigationBar shouldPopItem:(UINavigationItem *)item -{ - return [super navigationBar:navigationBar shouldPopItem:item]; -} - -@end - -NS_ASSUME_NONNULL_END diff --git a/SignalUI/ViewControllers/OWSTableSection.swift b/SignalUI/ViewControllers/OWSTableSection.swift index 905e42d3cb..b2a0b4564e 100644 --- a/SignalUI/ViewControllers/OWSTableSection.swift +++ b/SignalUI/ViewControllers/OWSTableSection.swift @@ -4,6 +4,7 @@ // import Foundation +import UIKit public class OWSTableSection { diff --git a/SignalUI/Views/PrimaryImageView.swift b/SignalUI/Views/PrimaryImageView.swift index 9c6b8e7a76..870dc6934a 100644 --- a/SignalUI/Views/PrimaryImageView.swift +++ b/SignalUI/Views/PrimaryImageView.swift @@ -4,6 +4,7 @@ // import Foundation +import UIKit // Any view that exposes a read-only image that can be used for transitions public protocol PrimaryImageView: UIView { diff --git a/SignalUI/Views/TextViewWithPlaceholder.swift b/SignalUI/Views/TextViewWithPlaceholder.swift index 0bf0d596ac..d2189ae8ac 100644 --- a/SignalUI/Views/TextViewWithPlaceholder.swift +++ b/SignalUI/Views/TextViewWithPlaceholder.swift @@ -4,6 +4,7 @@ // import Foundation +import UIKit public protocol TextViewWithPlaceholderDelegate: AnyObject { /// A method invoked by the text field when its cursor/selection changed without any change diff --git a/SignalUI/Wallpapers/Wallpaper+Constants.swift b/SignalUI/Wallpapers/Wallpaper+Constants.swift index 2109409a2e..c245304ef3 100644 --- a/SignalUI/Wallpapers/Wallpaper+Constants.swift +++ b/SignalUI/Wallpapers/Wallpaper+Constants.swift @@ -4,6 +4,7 @@ // import Foundation +import UIKit extension Wallpaper { var asColorOrGradientSetting: ColorOrGradientSetting? {