Merge branch 'igor/fix-warnings'
This commit is contained in:
commit
5460fff7ff
@ -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.
|
||||
|
||||
@ -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))
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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()
|
||||
|
||||
@ -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];
|
||||
}
|
||||
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
}
|
||||
|
||||
@ -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",
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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();
|
||||
}]];
|
||||
|
||||
@ -106,8 +106,6 @@ class NSEContext: NSObject, AppContext {
|
||||
desiredBadgeNumber.set(value)
|
||||
}
|
||||
|
||||
func setStatusBarHidden(_ isHidden: Bool, animated isAnimated: Bool) {}
|
||||
|
||||
func frontmostViewController() -> UIViewController? { nil }
|
||||
func openSystemSettings() {}
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2021 Open Whisper Systems. All rights reserved.
|
||||
// Copyright (c) 2022 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
#import <PureLayout/PureLayout.h>
|
||||
@ -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;
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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()
|
||||
|
||||
|
||||
@ -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];
|
||||
|
||||
@ -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 {
|
||||
|
||||
@ -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 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,
|
||||
(self.view.height + self.keyboardAdjustmentOffsetForAutoPinnedToBottomView - self.bottomLayoutGuide.length
|
||||
(self.view.height + self.keyboardAdjustmentOffsetForAutoPinnedToBottomView - self.view.safeAreaInsets.bottom
|
||||
- keyboardEndFrameConverted.origin.y));
|
||||
self.lastBottomLayoutInset = newInset;
|
||||
|
||||
|
||||
@ -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)
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user