Merge tag '3.3.0.5'

This commit is contained in:
Matthew Chen 2020-01-27 12:00:09 -03:00
commit 2734f01dcd
26 changed files with 123 additions and 34 deletions

View File

@ -108,10 +108,10 @@ PODS:
- HKDFKit
- SignalCoreKit
- SwiftProtobuf
- SignalRingRTC (0.3.2):
- SignalRingRTC (0.3.3):
- SignalCoreKit
- SignalRingRTC/WebRTC (= 0.3.2)
- SignalRingRTC/WebRTC (0.3.2):
- SignalRingRTC/WebRTC (= 0.3.3)
- SignalRingRTC/WebRTC (0.3.3):
- SignalCoreKit
- SignalServiceKit (0.9.0):
- AFNetworking
@ -357,7 +357,7 @@ CHECKOUT OPTIONS:
:commit: b72c2d1e6132501db906de2cffa8ded7803c54f4
:git: https://github.com/signalapp/Mantle
SignalCoreKit:
:commit: b053c9ecb1579e34cb9bac89a9947f9eaeb75bfc
:commit: be8b50315a5cd18bc5474e8c63b5cb56c1140b6b
:git: https://github.com/signalapp/SignalCoreKit.git
SignalMetadataKit:
:commit: 33dc101ee66b25ba6f4310dce04d48276a934781
@ -395,7 +395,7 @@ SPEC CHECKSUMS:
SAMKeychain: 483e1c9f32984d50ca961e26818a534283b4cd5c
SignalCoreKit: 4562b2bbd9830077439ca003f952a798457d4ea5
SignalMetadataKit: a7aacedf262d947c22e2c619f0fd217163d2a637
SignalRingRTC: a6ebe5dd4e33a747a9ee63c9a99105e074e6344a
SignalRingRTC: 02c1229fa80b5168bbfb9a8541905dbfe1594046
SignalServiceKit: f8fa79a211d0bafa4d8b149b62fdea389b6eafc5
SQLCipher: 4636a257060f6f1b4e143a143028b61a2b462d0d
SSZipArchive: 41455d4b8d2b6ab93990820b50dc697c2554a322

2
Pods

@ -1 +1 @@
Subproject commit 8816d5504804f60c4939b8cb038b609d69a4e1ed
Subproject commit da05a603066a00aa160bbeebdae432b508e1902b

View File

@ -7,7 +7,7 @@
<key>OSXVersion</key>
<string>10.15.2</string>
<key>WebRTCCommit</key>
<string>7115a09728e023ca6132e14bd9d5f8bc5e1f0b92 Production build of v0.3.1 (Xcode 10.3)</string>
<string>340f483e44db600c8055f2eaac44ff6c5e478297 Production build of v0.3.3</string>
</dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
@ -45,7 +45,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>3.3.0.2</string>
<string>3.3.0.5</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LOGS_EMAIL</key>

View File

@ -754,7 +754,8 @@ NSString *NSStringForLaunchFailure(LaunchFailure launchFailure)
reminderVC.modalPresentationStyle = UIModalPresentationFullScreen;
}
if ([frontmostViewController isKindOfClass:[reminderVC class]]) {
if ([frontmostViewController isKindOfClass:[OWSPinReminderViewController class]] ||
[frontmostViewController isKindOfClass:[OWS2FAReminderViewController class]]) {
// We're already presenting this
return;
}

View File

@ -30,7 +30,7 @@ typedef NS_CLOSED_ENUM(NSUInteger, KeyboardType) { KeyboardType_System, Keyboard
static void *kConversationInputTextViewObservingContext = &kConversationInputTextViewObservingContext;
const CGFloat kMinTextViewHeight = 38;
const CGFloat kMinTextViewHeight = 36;
const CGFloat kMinToolbarItemHeight = 44;
const CGFloat kMaxTextViewHeight = 98;
const CGFloat kMaxIPadTextViewHeight = 142;

View File

@ -3829,7 +3829,9 @@ typedef enum : NSUInteger {
- (void)showApprovalDialogForAttachments:(NSArray<SignalAttachment *> *)attachments
{
OWSNavigationController *modal =
[AttachmentApprovalViewController wrappedInNavControllerWithAttachments:attachments approvalDelegate:self];
[AttachmentApprovalViewController wrappedInNavControllerWithAttachments:attachments
initialMessageText:self.inputToolbar.messageText
approvalDelegate:self];
[self presentFullScreenViewController:modal animated:YES completion:nil];
}

View File

@ -62,7 +62,7 @@ public class Onboarding2FAViewController: OnboardingBaseViewController {
let titleText: String
let explanationText: String
if (FeatureFlags.pinsForEveryone) {
if FeatureFlags.pinsForEveryone {
titleText = NSLocalizedString("ONBOARDING_PIN_TITLE", comment: "Title of the 'onboarding PIN' view.")
explanationText = NSLocalizedString("ONBOARDING_PIN_EXPLANATION", comment: "Title of the 'onboarding PIN' view.")
} else {
@ -199,7 +199,7 @@ public class Onboarding2FAViewController: OnboardingBaseViewController {
pinToUse = pinToUse?.substring(to: Int(kLegacyTruncated2FAv1PinLength))
}
guard let pin = pinToUse?.ows_stripped(), pin.count >= (isUsingKBS ? kMin2FAv2PinLength : kMin2FAPinLength) else {
guard let pin = pinToUse?.ows_stripped(), pin.count >= kMin2FAPinLength else {
// Check if we're already in an invalid state, if so we can do nothing
guard !attemptState.isInvalid else { return }
attemptState = .invalid(remainingAttempts: nil)

View File

@ -130,6 +130,7 @@ public class AttachmentApprovalViewController: UIPageViewController, UIPageViewC
@objc
public class func wrappedInNavController(attachments: [SignalAttachment],
initialMessageText: String?,
approvalDelegate: AttachmentApprovalViewControllerDelegate)
-> OWSNavigationController {
@ -137,6 +138,7 @@ public class AttachmentApprovalViewController: UIPageViewController, UIPageViewC
let vc = AttachmentApprovalViewController(options: [.hasCancel],
sendButtonImageName: "send-solid-24",
attachmentApprovalItems: attachmentApprovalItems)
vc.messageText = initialMessageText
vc.approvalDelegate = approvalDelegate
let navController = OWSNavigationController(rootViewController: vc)
navController.ows_prefersStatusBarHidden = true

View File

@ -1,5 +1,5 @@
//
// Copyright (c) 2019 Open Whisper Systems. All rights reserved.
// Copyright (c) 2020 Open Whisper Systems. All rights reserved.
//
import UIKit
@ -294,7 +294,7 @@ extension AttachmentCaptionViewController: UITextViewDelegate {
// Accept as much of the input as we can
let charBudget: Int = Int(kMaxCaptionCharacterCount) - charsAfterDelete
if charBudget >= 0 {
let acceptableNewText = String(text.prefix(charBudget))
let acceptableNewText = text.safePrefix(charBudget)
textView.text = (existingText as NSString).replacingCharacters(in: range, with: acceptableNewText)
}

View File

@ -62,7 +62,7 @@ class AttachmentTextToolbar: UIView, UITextViewDelegate {
// Layout Constants
let kMinToolbarItemHeight: CGFloat = 40
let kMinTextViewHeight: CGFloat = 38
let kMinTextViewHeight: CGFloat = 36
var maxTextViewHeight: CGFloat {
// About ~4 lines in portrait and ~3 lines in landscape.
// Otherwise we risk obscuring too much of the content.

View File

@ -1,5 +1,5 @@
//
// Copyright (c) 2019 Open Whisper Systems. All rights reserved.
// Copyright (c) 2020 Open Whisper Systems. All rights reserved.
//
#import "SharingThreadPickerViewController.h"
@ -151,7 +151,9 @@ typedef void (^SendMessageBlock)(SendCompletionBlock completion);
}
OWSNavigationController *approvalModal =
[AttachmentApprovalViewController wrappedInNavControllerWithAttachments:self.attachments approvalDelegate:self];
[AttachmentApprovalViewController wrappedInNavControllerWithAttachments:self.attachments
initialMessageText:nil
approvalDelegate:self];
[self presentViewController:approvalModal animated:YES completion:nil];
}

View File

@ -1,5 +1,5 @@
//
// Copyright (c) 2019 Open Whisper Systems. All rights reserved.
// Copyright (c) 2020 Open Whisper Systems. All rights reserved.
//
#import "AttachmentSharing.h"
@ -17,16 +17,14 @@ NS_ASSUME_NONNULL_BEGIN
{
OWSAssertDebug(stream);
[self showShareUIForURL:stream.originalMediaURL sender:sender];
[self showShareUIForAttachments:@[ stream ] sender:sender];
}
+ (void)showShareUIForAttachments:(NSArray<TSAttachmentStream *> *)attachments sender:(nullable id)sender
{
OWSAssertDebug(attachments.count > 0);
[self showShareUIForURLs:[attachments map:^(TSAttachmentStream *attachment){
return attachment.originalMediaURL;
}] sender:sender completion:nil];
[self showShareUIForActivityItems:attachments sender:sender completion:nil];
}
+ (void)showShareUIForURL:(NSURL *)url sender:(nullable id)sender
@ -148,4 +146,34 @@ NS_ASSUME_NONNULL_BEGIN
@end
@interface TSAttachmentStream (AttachmentSharing) <UIActivityItemSource>
@end
@implementation TSAttachmentStream (AttachmentSharing)
// called to determine data type. only the class of the return type is consulted. it should match what
// -itemForActivityType: returns later
- (id)activityViewControllerPlaceholderItem:(UIActivityViewController *)activityViewController
{
// HACK: If this is an image we want to provide the image object to
// the share sheet rather than the file path. This ensures that when
// the user saves multiple images to their camera roll the OS doesn't
// asynchronously read the files and save them to them in a random
// order. Note: when sharing a mixture of image and non-image data
// (e.g. an album with photos and videos) the OS will still incorrectly
// order the video items. I haven't found any way to work around this
// since videos may only be shared as URLs.
return self.isImage ? [UIImage new] : self.originalMediaURL;
}
// called to fetch data after an activity is selected. you can return nil.
- (nullable id)activityViewController:(UIActivityViewController *)activityViewController
itemForActivityType:(nullable UIActivityType)activityType
{
return self.isImage ? self.originalImage : self.originalMediaURL;
}
@end
NS_ASSUME_NONNULL_END

View File

@ -157,7 +157,7 @@ import Foundation
let truncatedContent: Content?
if fullText.count > kMaxTextDisplayLength {
// Trim whitespace before _AND_ after slicing the snipper from the string.
let snippet = String(fullText.prefix(kMaxTextDisplayLength)).ows_stripped()
let snippet = fullText.safePrefix(kMaxTextDisplayLength).ows_stripped()
let truncatedText = String(format: NSLocalizedString("OVERSIZE_TEXT_DISPLAY_FORMAT", comment:
"A display format for oversize text messages."),
snippet)

View File

@ -151,7 +151,8 @@ typedef NS_ENUM(NSUInteger, TSVerificationTransport) { TSVerificationTransportVo
enclaveName:(NSString *)enclaveName
authUsername:(NSString *)authUsername
authPassword:(NSString *)authPassword
cookies:(NSArray<NSHTTPCookie *> *)cookies;
cookies:(NSArray<NSHTTPCookie *> *)cookies
requestType:(NSString *)requestType;
#pragma mark - UD

View File

@ -723,6 +723,7 @@ NSString *const OWSRequestKey_AuthKey = @"AuthKey";
authUsername:(NSString *)authUsername
authPassword:(NSString *)authPassword
cookies:(NSArray<NSHTTPCookie *> *)cookies
requestType:(NSString *)requestType
{
NSString *path = [NSString stringWithFormat:@"v1/backup/%@", enclaveName];
@ -733,6 +734,7 @@ NSString *const OWSRequestKey_AuthKey = @"AuthKey";
@"data" : data.base64EncodedString,
@"iv" : cryptIv.base64EncodedString,
@"mac" : cryptMac.base64EncodedString,
@"type" : requestType
}];
request.authUsername = authUsername;

View File

@ -174,6 +174,10 @@ class IncomingGroupsV2MessageQueue: NSObject {
// Don't process queues.
return
}
guard FeatureFlags.incomingGroupsV2 else {
// Don't process this queue.
return
}
// We want a value that is just high enough to yield perf benefits.
let kIncomingMessageBatchSize: UInt = 32
@ -644,6 +648,11 @@ public class GroupsV2MessageProcessor: NSObject {
return
}
guard FeatureFlags.incomingGroupsV2 else {
// Discard envelope.
return
}
// We need to persist the decrypted envelope data ASAP to prevent data loss.
processingQueue.enqueue(envelopeData: envelopeData,
plaintextData: plaintextData,

View File

@ -163,8 +163,8 @@ private class TSConstantsProduction: TSConstantsProtocol {
return contactDiscoveryEnclaveName
}
public let keyBackupEnclaveName = "f2e2a5004794a6c1bac5c4949eadbc243dd02e02d1a93f10fe24584fb70815d8"
public let keyBackupMrEnclave = "f51f435802ada769e67aaf5744372bb7e7d519eecf996d335eb5b46b872b5789"
public let keyBackupEnclaveName = "fe7c1bfae98f9b073d220366ea31163ee82f6d04bead774f71ca8e5c40847bfe"
public let keyBackupMrEnclave = "a3baab19ef6ce6f34ab9ebb25ba722725ae44a8872dc0ff08ad6d83a9489de87"
public var keyBackupServiceId: String {
return keyBackupEnclaveName
}

View File

@ -18,7 +18,7 @@ extension FeatureBuild {
}
}
let build: FeatureBuild = OWSIsDebugBuild() ? .dev : .beta
let build: FeatureBuild = .production
// MARK: -

View File

@ -376,7 +376,7 @@ public class KeyBackupService: NSObject {
var normalizedPin = pin.ows_stripped()
// If this pin contains only numerals, ensure they are arabic numerals.
if pin.digitsOnly() == pin { normalizedPin = pin.ensureArabicNumerals }
if pin.digitsOnly() == normalizedPin { normalizedPin = normalizedPin.ensureArabicNumerals }
// NFKD unicode normalization.
return normalizedPin.decomposedStringWithCompatibilityMapping
@ -562,7 +562,8 @@ public class KeyBackupService: NSObject {
enclaveName: remoteAttestation.enclaveName,
authUsername: remoteAttestation.auth.username,
authPassword: remoteAttestation.auth.password,
cookies: remoteAttestation.cookies
cookies: remoteAttestation.cookies,
requestType: RequestType.stringRepresentation
)
return (request, remoteAttestation)
@ -850,6 +851,8 @@ private protocol KBSRequestOption {
associatedtype ResponseOptionType
static func responseOption(from response: KeyBackupProtoResponse) -> ResponseOptionType?
func set(on builder: KeyBackupProtoRequest.KeyBackupProtoRequestBuilder)
static var stringRepresentation: String { get }
}
extension KeyBackupProtoBackupRequest: KBSRequestOption {
@ -860,6 +863,7 @@ extension KeyBackupProtoBackupRequest: KBSRequestOption {
func set(on builder: KeyBackupProtoRequest.KeyBackupProtoRequestBuilder) {
builder.setBackup(self)
}
static var stringRepresentation: String { "backup" }
}
extension KeyBackupProtoRestoreRequest: KBSRequestOption {
typealias ResponseOptionType = KeyBackupProtoRestoreResponse
@ -869,6 +873,7 @@ extension KeyBackupProtoRestoreRequest: KBSRequestOption {
func set(on builder: KeyBackupProtoRequest.KeyBackupProtoRequestBuilder) {
builder.setRestore(self)
}
static var stringRepresentation: String { "restore" }
}
extension KeyBackupProtoDeleteRequest: KBSRequestOption {
typealias ResponseOptionType = KeyBackupProtoDeleteResponse
@ -878,4 +883,5 @@ extension KeyBackupProtoDeleteRequest: KBSRequestOption {
func set(on builder: KeyBackupProtoRequest.KeyBackupProtoRequestBuilder) {
builder.setDelete(self)
}
static var stringRepresentation: String { "delete" }
}

View File

@ -63,5 +63,15 @@
"name": "NFKD Test, Single Char",
"pin": "Ä",
"bytes": "41cc88"
},
{
"name": "Leading and trailing spaces around non-arabic digits",
"pin": " ١٢٣٤٥ ",
"bytes": "3132333435"
},
{
"name": "Space in non-arabic digits",
"pin": "١٢٣ ٤٥٦",
"bytes": "d9a1d9a2d9a320d9a4d9a5d9a6"
}
]

View File

@ -17,4 +17,22 @@
"iv_and_cipher":"9d9b05402ea39c17ff1c9298c8a0e86784a352aa02a74943bf8bcf07ec0f4b574a5b786ad0182c8d308d9eb06538b8c9",
"registration_lock":"4a458afa1b07493b23ee9b3f287b70416b2388ca39b5b8c27b4b7585bf73f413"
},
{
"pin": " Pass६örd ",
"backup_id": "cba811749042b303a6a7efa5ccd160aea5e3ea243c8d2692bd13d515732f51a8",
"argon2_hash": "54853336a666eb66fbe8eb7a224b3ad3f457991ed74895b22ea9c6a4a46eda40ab645acdccc1652a48a34b2ac6926340ff35c03034013f68760f20013f028dd8",
"master_key": "9571f3fde1e58588ba49bcf82be1b301ca3859a6f59076f79a8f47181ef952bf",
"kbs_access_key": "ab645acdccc1652a48a34b2ac6926340ff35c03034013f68760f20013f028dd8",
"iv_and_cipher": "11c0ba1834db15e47c172f6c987c64bd4cfc69c6047dd67a022afeec0165a10943f204d5b8f37b3cb7bab21c6dfc39c8",
"registration_lock": "577939bccb2b6638c39222d5a97998a867c5e154e30b82cc120f2dd07a3de987"
},
{
"pin": " ६१८ ",
"backup_id": "717dc111a98423a57196512606822fca646c653facd037c10728f14ba0be2ab3",
"argon2_hash": "8e9082faa57488f9ef98a6423c416a9974fb4d7c6bfc5b4f24de8e93afea199cd2fedabd0d4c17a371491c9722578843a26be3b4923e28d452ab2fc5491e794b",
"master_key": "0432d735b32f66d0e3a70d4f9cc821a8529521a4937d26b987715d8eff4e4c54",
"kbs_access_key": "d2fedabd0d4c17a371491c9722578843a26be3b4923e28d452ab2fc5491e794b",
"iv_and_cipher": "877ef871ef1fc668401c717ef21aa12e8523579fb1ff4474b76f28c2293537c80cc7569996c9e0229bea7f378e3a824e",
"registration_lock": "23a75cb1df1a87df45cc2ed167c2bdc85ab1220b847c88761b0005cac907fce5"
}
]

View File

@ -19,7 +19,7 @@
<key>CFBundleShortVersionString</key>
<string>3.3.0</string>
<key>CFBundleVersion</key>
<string>3.3.0.2</string>
<string>3.3.0.5</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>NSAppTransportSecurity</key>

View File

@ -679,6 +679,14 @@ public class ShareViewController: UIViewController, ShareViewDelegate, SAEFailed
return UnloadedItem(itemProvider: itemProvider, itemType: .other)
}
// Prefer a URL if available. If there's an image item and a URL item,
// the URL is generally more useful. e.g. when sharing an app from the
// App Store the image would be the app icon and the URL is the link
// to the application.
if let urlItem = itemsToLoad.first(where: { $0.itemType == .webUrl }) {
return [urlItem]
}
let visualMediaItems = itemsToLoad.filter { ShareViewController.isVisualMediaItem(itemProvider: $0.itemProvider) }
// We only allow sharing 1 item, unless they are visual media items. And if they are

2
ThirdParty/RingRTC vendored

@ -1 +1 @@
Subproject commit 939fff4cca0d3b9703a4147226932a784e622d72
Subproject commit adbcd0196a3afa589dd2e1e3ac50624ac6491752

View File

@ -8,7 +8,7 @@
Pod::Spec.new do |s|
s.name = "SignalRingRTC"
s.version = "0.3.2"
s.version = "0.3.3"
s.summary = "A Swift & Objective-C library used by the Signal iOS app for WebRTC interactions."
s.description = <<-DESC

2
ThirdParty/WebRTC vendored

@ -1 +1 @@
Subproject commit 7115a09728e023ca6132e14bd9d5f8bc5e1f0b92
Subproject commit 340f483e44db600c8055f2eaac44ff6c5e478297