From 7a990ed1ff5b429fd75a28878b4be9683fc46994 Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Fri, 1 Feb 2019 10:13:44 -0500 Subject: [PATCH 1/8] Ensure 'link new device' view is portrait. --- .../AppSettings/OWSLinkDeviceViewController.m | 58 +++++++++++-------- .../categories/UIDevice+featureSupport.swift | 3 +- SignalMessaging/categories/UIView+OWS.swift | 32 ++++++++++ .../categories/UIViewController+OWS.m | 14 ++--- 4 files changed, 76 insertions(+), 31 deletions(-) diff --git a/Signal/src/ViewControllers/AppSettings/OWSLinkDeviceViewController.m b/Signal/src/ViewControllers/AppSettings/OWSLinkDeviceViewController.m index 7e707980a2..42c74cac7a 100644 --- a/Signal/src/ViewControllers/AppSettings/OWSLinkDeviceViewController.m +++ b/Signal/src/ViewControllers/AppSettings/OWSLinkDeviceViewController.m @@ -111,19 +111,16 @@ NS_ASSUME_NONNULL_BEGIN #pragma mark - -- (void)viewWillAppear:(BOOL)animated -{ - [super viewWillAppear:animated]; -} - - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; [self.qrScanningController startCapture]; + + [UIDevice.currentDevice ows_setOrientation:UIInterfaceOrientationPortrait]; } -// pragma mark - OWSQRScannerDelegate +#pragma mark - OWSQRScannerDelegate - (void)controller:(OWSQRCodeScanningViewController *)controller didDetectQRCodeWithString:(NSString *)string { @@ -137,14 +134,13 @@ NS_ASSUME_NONNULL_BEGIN UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title message:body preferredStyle:UIAlertControllerStyleAlert]; - UIAlertAction *cancelAction = - [UIAlertAction actionWithTitle:CommonStrings.cancelButton - style:UIAlertActionStyleCancel - handler:^(UIAlertAction *action) { - dispatch_async(dispatch_get_main_queue(), ^{ - [self.navigationController popViewControllerAnimated:YES]; - }); - }]; + UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:CommonStrings.cancelButton + style:UIAlertActionStyleCancel + handler:^(UIAlertAction *action) { + dispatch_async(dispatch_get_main_queue(), ^{ + [self popToLinkedDeviceList]; + }); + }]; [alertController addAction:cancelAction]; UIAlertAction *proceedAction = @@ -166,14 +162,13 @@ NS_ASSUME_NONNULL_BEGIN message:linkingDescription preferredStyle:UIAlertControllerStyleAlert]; - UIAlertAction *cancelAction = - [UIAlertAction actionWithTitle:CommonStrings.cancelButton - style:UIAlertActionStyleCancel - handler:^(UIAlertAction *action) { - dispatch_async(dispatch_get_main_queue(), ^{ - [self.navigationController popViewControllerAnimated:YES]; - }); - }]; + UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:CommonStrings.cancelButton + style:UIAlertActionStyleCancel + handler:^(UIAlertAction *action) { + dispatch_async(dispatch_get_main_queue(), ^{ + [self popToLinkedDeviceList]; + }); + }]; [alertController addAction:cancelAction]; UIAlertAction *proceedAction = @@ -214,7 +209,7 @@ NS_ASSUME_NONNULL_BEGIN OWSLogInfo(@"Successfully provisioned device."); dispatch_async(dispatch_get_main_queue(), ^{ [self.linkedDevicesTableViewController expectMoreDevices]; - [self.navigationController popToViewController:self.linkedDevicesTableViewController animated:YES]; + [self popToAppSettings]; // The service implementation of the socket connection caches the linked device state, // so all sync message sends will fail on the socket until it is cycled. @@ -264,6 +259,23 @@ NS_ASSUME_NONNULL_BEGIN return alertController; } +- (void)popToLinkedDeviceList +{ + [self.navigationController popViewControllerWithAnimated:YES + completion:^{ + [UIViewController attemptRotationToDeviceOrientation]; + }]; +} + +- (void)popToAppSettings +{ + [self.navigationController popToViewControllerWithViewController:self.linkedDevicesTableViewController + animated:YES + completion:^{ + [UIViewController attemptRotationToDeviceOrientation]; + }]; +} + #pragma mark - Orientation - (UIInterfaceOrientationMask)supportedInterfaceOrientations diff --git a/SignalMessaging/categories/UIDevice+featureSupport.swift b/SignalMessaging/categories/UIDevice+featureSupport.swift index c5c450eb95..26f1ba3a93 100644 --- a/SignalMessaging/categories/UIDevice+featureSupport.swift +++ b/SignalMessaging/categories/UIDevice+featureSupport.swift @@ -1,5 +1,5 @@ // -// Copyright (c) 2018 Open Whisper Systems. All rights reserved. +// Copyright (c) 2019 Open Whisper Systems. All rights reserved. // import Foundation @@ -54,6 +54,7 @@ public extension UIDevice { return isNativeIPad || isCompatabilityModeIPad } + @objc public func ows_setOrientation(_ orientation: UIInterfaceOrientation) { // XXX - This is not officially supported, but there's no other way to programmatically rotate // the interface. diff --git a/SignalMessaging/categories/UIView+OWS.swift b/SignalMessaging/categories/UIView+OWS.swift index 0893466652..1ea3c908c5 100644 --- a/SignalMessaging/categories/UIView+OWS.swift +++ b/SignalMessaging/categories/UIView+OWS.swift @@ -12,3 +12,35 @@ public extension UIEdgeInsets { right: CurrentAppContext().isRTL ? leading : trailing) } } + +@objc +public extension UINavigationController { + @objc + public func pushViewController(viewController: UIViewController, + animated: Bool, + completion: (() -> Void)?) { + CATransaction.begin() + CATransaction.setCompletionBlock(completion) + pushViewController(viewController, animated: animated) + CATransaction.commit() + } + + @objc + public func popViewController(animated: Bool, + completion: (() -> Void)?) { + CATransaction.begin() + CATransaction.setCompletionBlock(completion) + popViewController(animated: animated) + CATransaction.commit() + } + + @objc + public func popToViewController(viewController: UIViewController, + animated: Bool, + completion: (() -> Void)?) { + CATransaction.begin() + CATransaction.setCompletionBlock(completion) + self.popToViewController(viewController, animated: animated) + CATransaction.commit() + } +} diff --git a/SignalMessaging/categories/UIViewController+OWS.m b/SignalMessaging/categories/UIViewController+OWS.m index 86a231323a..eb923067f9 100644 --- a/SignalMessaging/categories/UIViewController+OWS.m +++ b/SignalMessaging/categories/UIViewController+OWS.m @@ -1,5 +1,5 @@ // -// Copyright (c) 2018 Open Whisper Systems. All rights reserved. +// Copyright (c) 2019 Open Whisper Systems. All rights reserved. // #import "Theme.h" @@ -19,13 +19,13 @@ NS_ASSUME_NONNULL_BEGIN while (YES) { UIViewController *_Nullable nextViewController = viewController.presentedViewController; if (nextViewController) { - if (ignoringAlerts) { - if ([nextViewController isKindOfClass:[UIAlertController class]]) { - break; - } + if (!ignoringAlerts || ![nextViewController isKindOfClass:[UIAlertController class]]) { + viewController = nextViewController; + continue; } - viewController = nextViewController; - } else if ([viewController isKindOfClass:[UINavigationController class]]) { + } + + if ([viewController isKindOfClass:[UINavigationController class]]) { UINavigationController *navigationController = (UINavigationController *)viewController; if (navigationController.topViewController) { viewController = navigationController.topViewController; From bf685776be5a647464c18dacecb319a54d0941e3 Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Fri, 1 Feb 2019 10:18:35 -0500 Subject: [PATCH 2/8] Ensure 'link new device' view is portrait. --- .../AppSettings/OWSLinkDeviceViewController.m | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Signal/src/ViewControllers/AppSettings/OWSLinkDeviceViewController.m b/Signal/src/ViewControllers/AppSettings/OWSLinkDeviceViewController.m index 42c74cac7a..ccb8593ed2 100644 --- a/Signal/src/ViewControllers/AppSettings/OWSLinkDeviceViewController.m +++ b/Signal/src/ViewControllers/AppSettings/OWSLinkDeviceViewController.m @@ -115,9 +115,11 @@ NS_ASSUME_NONNULL_BEGIN { [super viewDidAppear:animated]; - [self.qrScanningController startCapture]; - [UIDevice.currentDevice ows_setOrientation:UIInterfaceOrientationPortrait]; + + dispatch_async(dispatch_get_main_queue(), ^{ + [self.qrScanningController startCapture]; + }); } #pragma mark - OWSQRScannerDelegate From 6bfe0f0418df97b00fd9ee3fffa02b5b40a293d6 Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Fri, 1 Feb 2019 10:22:33 -0500 Subject: [PATCH 3/8] Ensure 'link new device' view is portrait. --- .../categories/UIViewController+OWS.m | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/SignalMessaging/categories/UIViewController+OWS.m b/SignalMessaging/categories/UIViewController+OWS.m index eb923067f9..04c1ba1d87 100644 --- a/SignalMessaging/categories/UIViewController+OWS.m +++ b/SignalMessaging/categories/UIViewController+OWS.m @@ -15,11 +15,19 @@ NS_ASSUME_NONNULL_BEGIN - (UIViewController *)findFrontmostViewController:(BOOL)ignoringAlerts { + NSMutableArray *visitedViewControllers = [NSMutableArray new]; + UIViewController *viewController = self; while (YES) { + [visitedViewControllers addObject:viewController]; + UIViewController *_Nullable nextViewController = viewController.presentedViewController; if (nextViewController) { if (!ignoringAlerts || ![nextViewController isKindOfClass:[UIAlertController class]]) { + if ([visitedViewControllers containsObject:nextViewController]) { + // Cycle detected. + return viewController; + } viewController = nextViewController; continue; } @@ -27,8 +35,13 @@ NS_ASSUME_NONNULL_BEGIN if ([viewController isKindOfClass:[UINavigationController class]]) { UINavigationController *navigationController = (UINavigationController *)viewController; - if (navigationController.topViewController) { - viewController = navigationController.topViewController; + nextViewController = navigationController.topViewController; + if (nextViewController) { + if ([visitedViewControllers containsObject:nextViewController]) { + // Cycle detected. + return viewController; + } + viewController = nextViewController; } else { break; } From 4cbe3236e40179f2ad982137a92757a726634034 Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Fri, 1 Feb 2019 17:39:37 -0500 Subject: [PATCH 4/8] Respond to CR. --- .../AppSettings/OWSLinkDeviceViewController.m | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/Signal/src/ViewControllers/AppSettings/OWSLinkDeviceViewController.m b/Signal/src/ViewControllers/AppSettings/OWSLinkDeviceViewController.m index ccb8593ed2..b704db862a 100644 --- a/Signal/src/ViewControllers/AppSettings/OWSLinkDeviceViewController.m +++ b/Signal/src/ViewControllers/AppSettings/OWSLinkDeviceViewController.m @@ -211,7 +211,7 @@ NS_ASSUME_NONNULL_BEGIN OWSLogInfo(@"Successfully provisioned device."); dispatch_async(dispatch_get_main_queue(), ^{ [self.linkedDevicesTableViewController expectMoreDevices]; - [self popToAppSettings]; + [self popToLinkedDeviceList]; // The service implementation of the socket connection caches the linked device state, // so all sync message sends will fail on the socket until it is cycled. @@ -269,15 +269,6 @@ NS_ASSUME_NONNULL_BEGIN }]; } -- (void)popToAppSettings -{ - [self.navigationController popToViewControllerWithViewController:self.linkedDevicesTableViewController - animated:YES - completion:^{ - [UIViewController attemptRotationToDeviceOrientation]; - }]; -} - #pragma mark - Orientation - (UIInterfaceOrientationMask)supportedInterfaceOrientations From 312cae9c37fbb7eceb7f9f9368f2e568128b6aa6 Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Fri, 1 Feb 2019 17:41:17 -0500 Subject: [PATCH 5/8] "Bump build to 2.35.0.11." --- Signal/Signal-Info.plist | 2 +- SignalShareExtension/Info.plist | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Signal/Signal-Info.plist b/Signal/Signal-Info.plist index 5188c6eac8..d0d901a271 100644 --- a/Signal/Signal-Info.plist +++ b/Signal/Signal-Info.plist @@ -47,7 +47,7 @@ CFBundleVersion - 2.35.0.10 + 2.35.0.11 ITSAppUsesNonExemptEncryption LOGS_EMAIL diff --git a/SignalShareExtension/Info.plist b/SignalShareExtension/Info.plist index 0602a4b3f8..33de27d69a 100644 --- a/SignalShareExtension/Info.plist +++ b/SignalShareExtension/Info.plist @@ -19,7 +19,7 @@ CFBundleShortVersionString 2.35.0 CFBundleVersion - 2.35.0.10 + 2.35.0.11 ITSAppUsesNonExemptEncryption NSAppTransportSecurity From a573bd4d3adeb73745073725ea963f2f83ee5de8 Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Fri, 1 Feb 2019 16:19:44 -0700 Subject: [PATCH 6/8] update WebRTC artifact to M72 --- Signal/Signal-Info.plist | 2 +- Signal/src/call/PeerConnectionClient.swift | 27 ++++++++++++++++++++++ ThirdParty/WebRTC | 2 +- 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/Signal/Signal-Info.plist b/Signal/Signal-Info.plist index d0d901a271..c6eaa04a15 100644 --- a/Signal/Signal-Info.plist +++ b/Signal/Signal-Info.plist @@ -9,7 +9,7 @@ OSXVersion 10.14.2 WebRTCCommit - aa8bee9bd6f69e388a9ca7506b8702ef8ab7f195 M71 + 55de5593cc261fa9368c5ccde98884ed1e278ba0 M72 CFBundleDevelopmentRegion en diff --git a/Signal/src/call/PeerConnectionClient.swift b/Signal/src/call/PeerConnectionClient.swift index 15d85c73f1..19eada7a5c 100644 --- a/Signal/src/call/PeerConnectionClient.swift +++ b/Signal/src/call/PeerConnectionClient.swift @@ -171,6 +171,10 @@ class PeerConnectionProxy: NSObject, RTCPeerConnectionDelegate, RTCDataChannelDe self.get()?.peerConnection(peerConnection, didOpen: dataChannel) } + public func peerConnection(_ peerConnection: RTCPeerConnection, didChange connectionState: RTCPeerConnectionState) { + self.get()?.peerConnection(peerConnection, didChange: connectionState) + } + // MARK: - RTCDataChannelDelegate public func dataChannelDidChangeState(_ dataChannel: RTCDataChannel) { @@ -1046,6 +1050,10 @@ class PeerConnectionClient: NSObject, RTCPeerConnectionDelegate, RTCDataChannelD } } + internal func peerConnection(_ peerConnectionParam: RTCPeerConnection, didChange connectionState: RTCPeerConnectionState) { + Logger.info("didChange PeerConnectionState:\(connectionState.debugDescription)") + } + // MARK: Helpers /** @@ -1349,3 +1357,22 @@ fileprivate extension RTCIceConnectionState { } } } + +fileprivate extension RTCPeerConnectionState { + var debugDescription: String { + switch self { + case .new: + return "new" + case .connecting: + return "connecting" + case .connected: + return "connected" + case .disconnected: + return "disconnected" + case .failed: + return "failed" + case .closed: + return "closed" + } + } +} diff --git a/ThirdParty/WebRTC b/ThirdParty/WebRTC index aa8bee9bd6..55de5593cc 160000 --- a/ThirdParty/WebRTC +++ b/ThirdParty/WebRTC @@ -1 +1 @@ -Subproject commit aa8bee9bd6f69e388a9ca7506b8702ef8ab7f195 +Subproject commit 55de5593cc261fa9368c5ccde98884ed1e278ba0 From f575c0f10056ef1d65cddea8e0c98b96e9b3d92e Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Mon, 4 Feb 2019 08:48:34 -0500 Subject: [PATCH 7/8] Add fbcdn.net to link previews media whitelist. --- .../src/Messages/Interactions/OWSLinkPreview.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/SignalServiceKit/src/Messages/Interactions/OWSLinkPreview.swift b/SignalServiceKit/src/Messages/Interactions/OWSLinkPreview.swift index 7c0cfd9a08..26df0bedbe 100644 --- a/SignalServiceKit/src/Messages/Interactions/OWSLinkPreview.swift +++ b/SignalServiceKit/src/Messages/Interactions/OWSLinkPreview.swift @@ -337,7 +337,8 @@ public class OWSLinkPreview: MTLModel { "imgur.com", // Instagram - "cdninstagram.com" + "cdninstagram.com", + "fbcdn.net" ] private static let protocolWhitelist = [ From 4afcb34c40c965422cd318c31b38753f7313ba9d Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Mon, 4 Feb 2019 12:38:12 -0500 Subject: [PATCH 8/8] "Bump build to 2.35.0.12." --- Signal/Signal-Info.plist | 2 +- SignalShareExtension/Info.plist | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Signal/Signal-Info.plist b/Signal/Signal-Info.plist index c6eaa04a15..c7a2eac5fc 100644 --- a/Signal/Signal-Info.plist +++ b/Signal/Signal-Info.plist @@ -47,7 +47,7 @@ CFBundleVersion - 2.35.0.11 + 2.35.0.12 ITSAppUsesNonExemptEncryption LOGS_EMAIL diff --git a/SignalShareExtension/Info.plist b/SignalShareExtension/Info.plist index 33de27d69a..450ad9b91b 100644 --- a/SignalShareExtension/Info.plist +++ b/SignalShareExtension/Info.plist @@ -19,7 +19,7 @@ CFBundleShortVersionString 2.35.0 CFBundleVersion - 2.35.0.11 + 2.35.0.12 ITSAppUsesNonExemptEncryption NSAppTransportSecurity