From ec96c7a1c622986e2654a2669711fed17c22324a Mon Sep 17 00:00:00 2001 From: Igor Solomennikov Date: Sat, 29 Jan 2022 15:36:57 -0800 Subject: [PATCH 1/8] Do not use UIVC.topLayoutGuide and UIVC.bottomLayoutGuide. Both are deprecated in iOS 12. --- .../ConversationViewController+OWS.swift | 1 - .../src/ViewControllers/HomeView/HomeViewController.m | 2 +- .../ViewControllers/MessageDetailViewController.swift | 4 ++-- .../ThreadSettings/AddToGroupViewController.swift | 4 +--- SignalUI/ViewControllers/OWSViewController.m | 11 +++++------ .../ImageEditor/ImageEditorBlurViewController.swift | 4 ++-- SignalUI/Views/Toast.swift | 4 ++-- 7 files changed, 13 insertions(+), 17 deletions(-) diff --git a/Signal/src/ViewControllers/ConversationView/ConversationViewController+OWS.swift b/Signal/src/ViewControllers/ConversationView/ConversationViewController+OWS.swift index 0887425484..c2a74102d2 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationViewController+OWS.swift +++ b/Signal/src/ViewControllers/ConversationView/ConversationViewController+OWS.swift @@ -139,7 +139,6 @@ extension ConversationViewController { if insetChange != 0 { // The content offset can go negative, up to the size of the top layout guide. // This accounts for the extended layout under the navigation bar. - owsAssertDebug(topLayoutGuide.length == view.safeAreaInsets.top) let minYOffset = -view.safeAreaInsets.top let newYOffset = (oldYOffset + insetChange).clamp(minYOffset, safeContentHeight) let newOffset = CGPoint(x: 0, y: newYOffset) diff --git a/Signal/src/ViewControllers/HomeView/HomeViewController.m b/Signal/src/ViewControllers/HomeView/HomeViewController.m index fff834ef5e..fddadcc483 100644 --- a/Signal/src/ViewControllers/HomeView/HomeViewController.m +++ b/Signal/src/ViewControllers/HomeView/HomeViewController.m @@ -868,7 +868,7 @@ NSString *const kArchiveButtonPseudoGroup = @"kArchiveButtonPseudoGroup"; - (void)scrollSearchBarToTopAnimated:(BOOL)isAnimated { - CGFloat topInset = self.topLayoutGuide.length; + CGFloat topInset = self.view.safeAreaInsets.top; [self.tableView setContentOffset:CGPointMake(0, -topInset) animated:isAnimated]; } diff --git a/Signal/src/ViewControllers/MessageDetailViewController.swift b/Signal/src/ViewControllers/MessageDetailViewController.swift index d7dde7b62b..2575a8d120 100644 --- a/Signal/src/ViewControllers/MessageDetailViewController.swift +++ b/Signal/src/ViewControllers/MessageDetailViewController.swift @@ -1,5 +1,5 @@ // -// Copyright (c) 2021 Open Whisper Systems. All rights reserved. +// Copyright (c) 2022 Open Whisper Systems. All rights reserved. // import Foundation @@ -536,7 +536,7 @@ extension MessageDetailViewController { "MESSAGE_DETAIL_VIEW_DID_COPY_SENT_TIMESTAMP", comment: "Toast indicating that the user has copied the sent timestamp." )) - toast.presentToastView(fromBottomOfView: view, inset: bottomLayoutGuide.length + 8) + toast.presentToastView(fromBottomOfView: view, inset: view.safeAreaInsets.bottom + 8) } } diff --git a/Signal/src/ViewControllers/ThreadSettings/AddToGroupViewController.swift b/Signal/src/ViewControllers/ThreadSettings/AddToGroupViewController.swift index 84d69b229a..cde82e3936 100644 --- a/Signal/src/ViewControllers/ThreadSettings/AddToGroupViewController.swift +++ b/Signal/src/ViewControllers/ThreadSettings/AddToGroupViewController.swift @@ -1,5 +1,5 @@ // -// Copyright (c) 2021 Open Whisper Systems. All rights reserved. +// Copyright (c) 2022 Open Whisper Systems. All rights reserved. // import Foundation @@ -209,8 +209,6 @@ public class AddToGroupViewController: OWSTableViewController2 { } private func notifyOfAddedAndDismiss(groupThread: TSGroupThread, shortName: String) { - let toastInset = bottomLayoutGuide.length + 8 - dismiss(animated: true) { [presentingViewController] in let toastFormat = NSLocalizedString( "ADD_TO_GROUP_SUCCESS_TOAST_FORMAT", diff --git a/SignalUI/ViewControllers/OWSViewController.m b/SignalUI/ViewControllers/OWSViewController.m index 1172bd62b6..2a9adb3a94 100644 --- a/SignalUI/ViewControllers/OWSViewController.m +++ b/SignalUI/ViewControllers/OWSViewController.m @@ -1,5 +1,5 @@ // -// Copyright (c) 2021 Open Whisper Systems. All rights reserved. +// Copyright (c) 2022 Open Whisper Systems. All rights reserved. // #import "OWSViewController.h" @@ -270,12 +270,11 @@ NS_ASSUME_NONNULL_BEGIN // Adjust the position of the bottom view to account for the keyboard's // intrusion into the view. // - // On iPhoneX, when no keyboard is present, we include a buffer at the bottom of the screen so the bottom view - // clears the floating "home button". But because the keyboard includes it's own buffer, we subtract the length - // (height) of the bottomLayoutGuide, else we'd have an unnecessary buffer between the popped keyboard and the input - // bar. + // On iPhones no physical home button, when no keyboard is present, we include a buffer at the bottom of the screen so the bottom view + // clears the floating "home button". But because the keyboard includes it's own buffer, we subtract the size of bottom "safe area", + // else we'd have an unnecessary buffer between the popped keyboard and the input bar. CGFloat newInset = MAX(0, - (self.view.height + self.keyboardAdjustmentOffsetForAutoPinnedToBottomView - self.bottomLayoutGuide.length + (self.view.height + self.keyboardAdjustmentOffsetForAutoPinnedToBottomView - self.view.safeAreaInsets.bottom - keyboardEndFrameConverted.origin.y)); self.lastBottomLayoutInset = newInset; diff --git a/SignalUI/Views/ImageEditor/ImageEditorBlurViewController.swift b/SignalUI/Views/ImageEditor/ImageEditorBlurViewController.swift index e2e200b60a..7e3098803f 100644 --- a/SignalUI/Views/ImageEditor/ImageEditorBlurViewController.swift +++ b/SignalUI/Views/ImageEditor/ImageEditorBlurViewController.swift @@ -1,5 +1,5 @@ // -// Copyright (c) 2021 Open Whisper Systems. All rights reserved. +// Copyright (c) 2022 Open Whisper Systems. All rights reserved. // import UIKit @@ -211,7 +211,7 @@ public class ImageEditorBlurViewController: OWSViewController { "IMAGE_EDITOR_BLUR_TOAST", comment: "A toast indicating that you can blur more faces after detection" )) - let bottomInset = self.bottomLayoutGuide.length + 90 + let bottomInset = self.view.safeAreaInsets.bottom + 90 toastController.presentToastView(fromBottomOfView: self.view, inset: bottomInset) } diff --git a/SignalUI/Views/Toast.swift b/SignalUI/Views/Toast.swift index 894f950fed..5df0387bb8 100644 --- a/SignalUI/Views/Toast.swift +++ b/SignalUI/Views/Toast.swift @@ -1,5 +1,5 @@ // -// Copyright (c) 2021 Open Whisper Systems. All rights reserved. +// Copyright (c) 2022 Open Whisper Systems. All rights reserved. // import Foundation @@ -188,7 +188,7 @@ public extension UIViewController { let toastController = ToastController(text: text) // TODO: There should be a better way to do this. // TODO: Take into account the keyboard height. - let bottomInset = bottomLayoutGuide.length + 8 + extraVInset + let bottomInset = view.safeAreaInsets.bottom + 8 + extraVInset toastController.presentToastView(fromBottomOfView: view, inset: bottomInset) } } From 6848210a4c2f9a6e3e802f9b7df7b1c3b65b4a79 Mon Sep 17 00:00:00 2001 From: Igor Solomennikov Date: Sat, 29 Jan 2022 16:21:38 -0800 Subject: [PATCH 2/8] Remove UIScrollView workaround that was only used in iOS 11.0-11.2 Not needed anymore since min supported iOS version is now 12.2 --- .../ConversationViewController.swift | 2 -- SignalUI/Categories/UIView+SignalUI.h | 11 +--------- SignalUI/Categories/UIView+SignalUI.m | 22 +------------------ .../ViewControllers/OWSTableViewController.m | 21 ++++-------------- .../OWSTableViewController2.swift | 15 +------------ 5 files changed, 7 insertions(+), 64 deletions(-) diff --git a/Signal/src/ViewControllers/ConversationView/ConversationViewController.swift b/Signal/src/ViewControllers/ConversationView/ConversationViewController.swift index 2705815347..c739113c48 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationViewController.swift +++ b/Signal/src/ViewControllers/ConversationView/ConversationViewController.swift @@ -161,8 +161,6 @@ public class ConversationViewController: OWSViewController { self.collectionView.autoPinEdge(toSuperviewSafeArea: .leading) self.collectionView.autoPinEdge(toSuperviewSafeArea: .trailing) - // TODO: Do we still need to do this? - self.collectionView.applyInsetsFix() self.collectionView.accessibilityIdentifier = "collectionView" self.registerReuseIdentifiers() diff --git a/SignalUI/Categories/UIView+SignalUI.h b/SignalUI/Categories/UIView+SignalUI.h index aea6f50a5f..ab41c421f9 100644 --- a/SignalUI/Categories/UIView+SignalUI.h +++ b/SignalUI/Categories/UIView+SignalUI.h @@ -1,5 +1,5 @@ // -// Copyright (c) 2021 Open Whisper Systems. All rights reserved. +// Copyright (c) 2022 Open Whisper Systems. All rights reserved. // #import @@ -140,15 +140,6 @@ CGFloat ScaleFromIPhone5(CGFloat iPhone5Value); #pragma mark - -@interface UIScrollView (OWS) - -// Returns YES if contentInsetAdjustmentBehavior is disabled. -- (BOOL)applyScrollViewInsetsFix; - -@end - -#pragma mark - - @interface UIStackView (OWS) - (void)addHairlineWithColor:(UIColor *)color; diff --git a/SignalUI/Categories/UIView+SignalUI.m b/SignalUI/Categories/UIView+SignalUI.m index 0c7b4996e9..2ea05c84c5 100644 --- a/SignalUI/Categories/UIView+SignalUI.m +++ b/SignalUI/Categories/UIView+SignalUI.m @@ -1,5 +1,5 @@ // -// Copyright (c) 2021 Open Whisper Systems. All rights reserved. +// Copyright (c) 2022 Open Whisper Systems. All rights reserved. // #import "UIView+SignalUI.h" @@ -555,26 +555,6 @@ CGFloat ScaleFromIPhone5(CGFloat iPhone5Value) #pragma mark - -@implementation UIScrollView (OWS) - -- (BOOL)applyScrollViewInsetsFix -{ - // Fix a bug that only affects iOS 11.0.x and 11.1.x. - // The symptom is a fix weird animation that happens when using the interactive pop gesture. - if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(11, 0) && !SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(11, 2)) { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wpartial-availability" - self.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; -#pragma clang diagnostic pop - return YES; - } - return NO; -} - -@end - -#pragma mark - - @implementation UIStackView (OWS) - (void)addHairlineWithColor:(UIColor *)color diff --git a/SignalUI/ViewControllers/OWSTableViewController.m b/SignalUI/ViewControllers/OWSTableViewController.m index 63d2ddd5e6..c11124e25a 100644 --- a/SignalUI/ViewControllers/OWSTableViewController.m +++ b/SignalUI/ViewControllers/OWSTableViewController.m @@ -621,24 +621,11 @@ NSString *const kOWSTableCellIdentifier = @"kOWSTableCellIdentifier"; [self.view addSubview:self.tableView]; - if ([self.tableView applyScrollViewInsetsFix]) { - // if applyScrollViewInsetsFix disables contentInsetAdjustmentBehavior, - // we need to pin to the top and bottom layout guides since UIKit - // won't adjust our content insets. - [self.tableView autoPinToTopLayoutGuideOfViewController:self withInset:0]; - [self.tableView autoPinToBottomLayoutGuideOfViewController:self withInset:0]; - [self.tableView autoPinEdgeToSuperviewSafeArea:ALEdgeLeading]; - [self.tableView autoPinEdgeToSuperviewSafeArea:ALEdgeTrailing]; - - // We don't need a top or bottom insets, since we pin to the top and bottom layout guides. - self.automaticallyAdjustsScrollViewInsets = NO; + if (self.shouldAvoidKeyboard) { + [self.tableView autoPinEdgesToSuperviewEdgesWithInsets:UIEdgeInsetsZero excludingEdge:ALEdgeBottom]; + [self autoPinViewToBottomOfViewControllerOrKeyboard:self.tableView avoidNotch:YES]; } else { - if (self.shouldAvoidKeyboard) { - [self.tableView autoPinEdgesToSuperviewEdgesWithInsets:UIEdgeInsetsZero excludingEdge:ALEdgeBottom]; - [self autoPinViewToBottomOfViewControllerOrKeyboard:self.tableView avoidNotch:YES]; - } else { - [self.tableView autoPinEdgesToSuperviewEdges]; - } + [self.tableView autoPinEdgesToSuperviewEdges]; } [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:kOWSTableCellIdentifier]; diff --git a/SignalUI/ViewControllers/OWSTableViewController2.swift b/SignalUI/ViewControllers/OWSTableViewController2.swift index f8317d1810..3924cc61d9 100644 --- a/SignalUI/ViewControllers/OWSTableViewController2.swift +++ b/SignalUI/ViewControllers/OWSTableViewController2.swift @@ -1,5 +1,5 @@ // -// Copyright (c) 2021 Open Whisper Systems. All rights reserved. +// Copyright (c) 2022 Open Whisper Systems. All rights reserved. // import Foundation @@ -133,14 +133,6 @@ open class OWSTableViewController2: OWSViewController { topHeader.setContentHuggingVerticalHigh() topHeader.setCompressionResistanceVerticalHigh() - } else if tableView.applyInsetsFix() { - // if applyScrollViewInsetsFix disables contentInsetAdjustmentBehavior, - // we need to pin to the top and bottom layout guides since UIKit - // won't adjust our content insets. - tableView.autoPin(toTopLayoutGuideOf: self, withInset: 0) - - // We don't need a top or bottom insets, since we pin to the top and bottom layout guides. - automaticallyAdjustsScrollViewInsets = false } else { tableView.autoPinEdge(toSuperviewEdge: .top) } @@ -199,11 +191,6 @@ open class OWSTableViewController2: OWSViewController { } else { bottomFooterConstraint = bottomFooter.autoPinEdge(toSuperviewEdge: .bottom) } - } else if tableView.applyInsetsFix() { - // if applyScrollViewInsetsFix disables contentInsetAdjustmentBehavior, - // we need to pin to the top and bottom layout guides since UIKit - // won't adjust our content insets. - bottomFooterConstraint = tableView.autoPin(toBottomLayoutGuideOf: self, withInset: 0) } else if shouldAvoidKeyboard { bottomFooterConstraint = autoPinView(toBottomOfViewControllerOrKeyboard: tableView, avoidNotch: true) } else { From ea55469ec8812be4d6be1e4496bb739c46ef409d Mon Sep 17 00:00:00 2001 From: Igor Solomennikov Date: Sat, 29 Jan 2022 16:24:47 -0800 Subject: [PATCH 3/8] Remove deprecated UITextViewDelegate methods. textView(_:shouldInteractWith:in:) were deprecated in iOS 10. This change is purely deletion of code because newer UITextViewDelegate methods: textView(_:shouldInteractWith:in:interaction:) were already implemented. --- SignalUI/Views/Mentions/MentionTextView.swift | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/SignalUI/Views/Mentions/MentionTextView.swift b/SignalUI/Views/Mentions/MentionTextView.swift index 0608348522..1e09bc44d6 100644 --- a/SignalUI/Views/Mentions/MentionTextView.swift +++ b/SignalUI/Views/Mentions/MentionTextView.swift @@ -1,5 +1,5 @@ // -// Copyright (c) 2021 Open Whisper Systems. All rights reserved. +// Copyright (c) 2022 Open Whisper Systems. All rights reserved. // import Foundation @@ -601,12 +601,4 @@ extension MentionTextView: UITextViewDelegate { open func textView(_ textView: UITextView, shouldInteractWith textAttachment: NSTextAttachment, in characterRange: NSRange, interaction: UITextItemInteraction) -> Bool { return mentionDelegate?.textView?(textView, shouldInteractWith: textAttachment, in: characterRange, interaction: interaction) ?? true } - - open func textView(_ textView: UITextView, shouldInteractWith URL: URL, in characterRange: NSRange) -> Bool { - return mentionDelegate?.textView?(textView, shouldInteractWith: URL, in: characterRange) ?? true - } - - open func textView(_ textView: UITextView, shouldInteractWith textAttachment: NSTextAttachment, in characterRange: NSRange) -> Bool { - return mentionDelegate?.textView?(textView, shouldInteractWith: textAttachment, in: characterRange) ?? true - } } From 2cbb155e345cb2f1fd4fc6b1cbef93d4b1b576f7 Mon Sep 17 00:00:00 2001 From: Igor Solomennikov Date: Sat, 29 Jan 2022 16:27:56 -0800 Subject: [PATCH 4/8] Fix three minor compiler warnings. --- .../ConversationView/Cells/AudioMessageView.swift | 2 -- .../ConversationViewController+GestureRecognizers.swift | 2 -- .../RegistrationPinAttemptsExhaustedViewController.swift | 4 ++-- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/Signal/src/ViewControllers/ConversationView/Cells/AudioMessageView.swift b/Signal/src/ViewControllers/ConversationView/Cells/AudioMessageView.swift index daf5164382..faae5619f4 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/AudioMessageView.swift +++ b/Signal/src/ViewControllers/ConversationView/Cells/AudioMessageView.swift @@ -436,8 +436,6 @@ class AudioMessageView: ManualStackView { } private func updateViewedState(animated: Bool = true) { - var isViewed = self.isViewed - let destination: AnimationProgressTime = isViewed ? 1 : 0 // Do nothing if we're already there. diff --git a/Signal/src/ViewControllers/ConversationView/ConversationViewController+GestureRecognizers.swift b/Signal/src/ViewControllers/ConversationView/ConversationViewController+GestureRecognizers.swift index 231c000f3d..ede37d54da 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationViewController+GestureRecognizers.swift +++ b/Signal/src/ViewControllers/ConversationView/ConversationViewController+GestureRecognizers.swift @@ -378,8 +378,6 @@ public struct CVLongPressHandler { return } - let shouldAllowReply = delegate.cvc_shouldAllowReplyForItem(itemViewModel) - switch gestureLocation { case .bodyText(let item): delegate.cvc_didLongPressBodyTextItem(.init(item: item)) diff --git a/Signal/src/ViewControllers/Registration/RegistrationPinAttemptsExhaustedViewController.swift b/Signal/src/ViewControllers/Registration/RegistrationPinAttemptsExhaustedViewController.swift index fb1ccf4867..123b8327b2 100644 --- a/Signal/src/ViewControllers/Registration/RegistrationPinAttemptsExhaustedViewController.swift +++ b/Signal/src/ViewControllers/Registration/RegistrationPinAttemptsExhaustedViewController.swift @@ -1,5 +1,5 @@ // -// Copyright (c) 2021 Open Whisper Systems. All rights reserved. +// Copyright (c) 2022 Open Whisper Systems. All rights reserved. // import UIKit @@ -106,7 +106,7 @@ public class RegistrationPinAttemptsExhaustedViewController: RegistrationBaseVie func primaryButtonPressed() { Logger.info("") - guard let navigationController = navigationController else { + guard navigationController != nil else { owsFailDebug("Missing navigationController") return } From ef2f9b3937454437fac6cf6ee707b7ee19a9a8de Mon Sep 17 00:00:00 2001 From: Igor Solomennikov Date: Sat, 29 Jan 2022 16:33:54 -0800 Subject: [PATCH 5/8] Fix use of deprecated -[UIApplication openURL:]. Use -[UIApplication openURL:options:completionHandler:] with empty second and third parameters. --- Signal/src/util/Pastelog.m | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Signal/src/util/Pastelog.m b/Signal/src/util/Pastelog.m index 27e83a2f51..8ab2f99369 100644 --- a/Signal/src/util/Pastelog.m +++ b/Signal/src/util/Pastelog.m @@ -1,5 +1,5 @@ // -// Copyright (c) 2021 Open Whisper Systems. All rights reserved. +// Copyright (c) 2022 Open Whisper Systems. All rights reserved. // #import "Pastelog.h" @@ -304,7 +304,9 @@ typedef NS_ERROR_ENUM(PastelogErrorDomain, PastelogError) { [UIApplication.sharedApplication openURL:[NSURL URLWithString:[[NSBundle mainBundle] - objectForInfoDictionaryKey:@"LOGS_URL"]]]; + objectForInfoDictionaryKey:@"LOGS_URL"]] + options:@{ } + completionHandler:nil]; completion(); }]]; From 71ac19adae2c9cb2918712495deaf029db0dafe4 Mon Sep 17 00:00:00 2001 From: Igor Solomennikov Date: Sat, 29 Jan 2022 16:54:04 -0800 Subject: [PATCH 6/8] Do not use -[UIApplication setStatusBarHidden:animated:]. Deprecated in iOS 9. --- .../MediaGallery/MediaPageViewController.swift | 3 +-- Signal/src/util/MainAppContext.m | 7 +------ SignalNSE/NSEContext.swift | 2 -- SignalServiceKit/src/TestUtils/TestAppContext.m | 6 +----- SignalServiceKit/src/Util/AppContext.h | 4 +--- SignalShareExtension/utils/ShareAppExtensionContext.m | 7 +------ 6 files changed, 5 insertions(+), 24 deletions(-) diff --git a/Signal/src/ViewControllers/MediaGallery/MediaPageViewController.swift b/Signal/src/ViewControllers/MediaGallery/MediaPageViewController.swift index 5ff7d297ce..d1ac5afd64 100644 --- a/Signal/src/ViewControllers/MediaGallery/MediaPageViewController.swift +++ b/Signal/src/ViewControllers/MediaGallery/MediaPageViewController.swift @@ -1,5 +1,5 @@ // -// Copyright (c) 2021 Open Whisper Systems. All rights reserved. +// Copyright (c) 2022 Open Whisper Systems. All rights reserved. // import UIKit @@ -653,7 +653,6 @@ class MediaPageViewController: UIPageViewController, UIPageViewControllerDataSou currentViewController.zoomOut(animated: true) currentViewController.stopAnyVideo() - UIApplication.shared.setStatusBarHidden(false, with: .none) self.navigationController?.setNavigationBarHidden(false, animated: false) dismiss(animated: isAnimated, completion: completion) diff --git a/Signal/src/util/MainAppContext.m b/Signal/src/util/MainAppContext.m index 45f4b519d8..c7332f7254 100644 --- a/Signal/src/util/MainAppContext.m +++ b/Signal/src/util/MainAppContext.m @@ -1,5 +1,5 @@ // -// Copyright (c) 2021 Open Whisper Systems. All rights reserved. +// Copyright (c) 2022 Open Whisper Systems. All rights reserved. // #import "MainAppContext.h" @@ -214,11 +214,6 @@ NSString *const ReportedApplicationStateDidChangeNotification = @"ReportedApplic return isRTL; } -- (void)setStatusBarHidden:(BOOL)isHidden animated:(BOOL)isAnimated -{ - [[UIApplication sharedApplication] setStatusBarHidden:isHidden animated:isAnimated]; -} - - (CGFloat)statusBarHeight { return [UIApplication sharedApplication].statusBarFrame.size.height; diff --git a/SignalNSE/NSEContext.swift b/SignalNSE/NSEContext.swift index 009ae6abdf..a85dc10c6e 100644 --- a/SignalNSE/NSEContext.swift +++ b/SignalNSE/NSEContext.swift @@ -106,8 +106,6 @@ class NSEContext: NSObject, AppContext { desiredBadgeNumber.set(value) } - func setStatusBarHidden(_ isHidden: Bool, animated isAnimated: Bool) {} - func frontmostViewController() -> UIViewController? { nil } func openSystemSettings() {} diff --git a/SignalServiceKit/src/TestUtils/TestAppContext.m b/SignalServiceKit/src/TestUtils/TestAppContext.m index 9ebe2c324d..c75e204b24 100644 --- a/SignalServiceKit/src/TestUtils/TestAppContext.m +++ b/SignalServiceKit/src/TestUtils/TestAppContext.m @@ -1,5 +1,5 @@ // -// Copyright (c) 2021 Open Whisper Systems. All rights reserved. +// Copyright (c) 2022 Open Whisper Systems. All rights reserved. // #import "TestAppContext.h" @@ -90,10 +90,6 @@ NS_ASSUME_NONNULL_BEGIN return NO; } -- (void)setStatusBarHidden:(BOOL)isHidden animated:(BOOL)isAnimated -{ -} - - (CGFloat)statusBarHeight { return 20; diff --git a/SignalServiceKit/src/Util/AppContext.h b/SignalServiceKit/src/Util/AppContext.h index 83338a2f42..79be146166 100755 --- a/SignalServiceKit/src/Util/AppContext.h +++ b/SignalServiceKit/src/Util/AppContext.h @@ -1,5 +1,5 @@ // -// Copyright (c) 2021 Open Whisper Systems. All rights reserved. +// Copyright (c) 2022 Open Whisper Systems. All rights reserved. // NS_ASSUME_NONNULL_BEGIN @@ -102,8 +102,6 @@ NSString *NSStringForUIApplicationState(UIApplicationState value); - (void)setMainAppBadgeNumber:(NSInteger)value; -- (void)setStatusBarHidden:(BOOL)isHidden animated:(BOOL)isAnimated; - @property (nonatomic, readonly) CGFloat statusBarHeight; // Returns the VC that should be used to present alerts, modals, etc. diff --git a/SignalShareExtension/utils/ShareAppExtensionContext.m b/SignalShareExtension/utils/ShareAppExtensionContext.m index 1ad06500b6..77956015d0 100644 --- a/SignalShareExtension/utils/ShareAppExtensionContext.m +++ b/SignalShareExtension/utils/ShareAppExtensionContext.m @@ -1,5 +1,5 @@ // -// Copyright (c) 2021 Open Whisper Systems. All rights reserved. +// Copyright (c) 2022 Open Whisper Systems. All rights reserved. // #import "ShareAppExtensionContext.h" @@ -180,11 +180,6 @@ NS_ASSUME_NONNULL_BEGIN return isRTL; } -- (void)setStatusBarHidden:(BOOL)isHidden animated:(BOOL)isAnimated -{ - OWSLogInfo(@"Ignoring request to show/hide status bar since we're in an app extension"); -} - - (CGFloat)statusBarHeight { return 20; From d1a726f467c8f9fd81442d57dc5a5f04f349f437 Mon Sep 17 00:00:00 2001 From: Igor Solomennikov Date: Mon, 31 Jan 2022 15:41:18 -0800 Subject: [PATCH 7/8] Do not use UIVC.automaticallyAdjustsScrollViewInsets - deprecated. Use UIScrollView.contentInsetAdjustmentBehavior instead. --- .../AttachmentApproval/AttachmentPrepViewController.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SignalUI/ViewControllers/AttachmentApproval/AttachmentPrepViewController.swift b/SignalUI/ViewControllers/AttachmentApproval/AttachmentPrepViewController.swift index 6ba36ac963..979769a14f 100644 --- a/SignalUI/ViewControllers/AttachmentApproval/AttachmentPrepViewController.swift +++ b/SignalUI/ViewControllers/AttachmentApproval/AttachmentPrepViewController.swift @@ -81,7 +81,7 @@ public class AttachmentPrepViewController: OWSViewController { // We want scroll view content up and behind the system status bar content // but we want other content (e.g. bar buttons) to respect the top layout guide. - self.automaticallyAdjustsScrollViewInsets = false + scrollView.contentInsetAdjustmentBehavior = .never scrollView.autoPinEdgesToSuperviewEdges() From 6c037a84af597ecf80d98c5e8d8baa52ed78c8bb Mon Sep 17 00:00:00 2001 From: Igor Solomennikov Date: Mon, 31 Jan 2022 17:57:15 -0800 Subject: [PATCH 8/8] Fix typo in a comment. --- SignalUI/ViewControllers/OWSViewController.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SignalUI/ViewControllers/OWSViewController.m b/SignalUI/ViewControllers/OWSViewController.m index 2a9adb3a94..10fa94d891 100644 --- a/SignalUI/ViewControllers/OWSViewController.m +++ b/SignalUI/ViewControllers/OWSViewController.m @@ -270,7 +270,7 @@ NS_ASSUME_NONNULL_BEGIN // Adjust the position of the bottom view to account for the keyboard's // intrusion into the view. // - // On iPhones no physical home button, when no keyboard is present, we include a buffer at the bottom of the screen so the bottom view + // On iPhones with no physical home button, when no keyboard is present, we include a buffer at the bottom of the screen so the bottom view // clears the floating "home button". But because the keyboard includes it's own buffer, we subtract the size of bottom "safe area", // else we'd have an unnecessary buffer between the popped keyboard and the input bar. CGFloat newInset = MAX(0,