Merge branch 'mkirk/fixup-tests-5'
This commit is contained in:
commit
e00f4b30f3
26
Gemfile.lock
26
Gemfile.lock
|
@ -54,7 +54,7 @@ GEM
|
|||
declarative-option (0.1.0)
|
||||
domain_name (0.5.20180417)
|
||||
unf (>= 0.0.5, < 1.0.0)
|
||||
dotenv (2.4.0)
|
||||
dotenv (2.5.0)
|
||||
emoji_regex (0.1.1)
|
||||
escape (0.0.4)
|
||||
excon (0.62.0)
|
||||
|
@ -66,7 +66,7 @@ GEM
|
|||
faraday_middleware (0.12.2)
|
||||
faraday (>= 0.7.4, < 1.0)
|
||||
fastimage (2.1.3)
|
||||
fastlane (2.96.1)
|
||||
fastlane (2.99.1)
|
||||
CFPropertyList (>= 2.3, < 4.0.0)
|
||||
addressable (>= 2.3, < 3.0.0)
|
||||
babosa (>= 1.0.2, < 2.0.0)
|
||||
|
@ -90,7 +90,7 @@ GEM
|
|||
multipart-post (~> 2.0.0)
|
||||
plist (>= 3.1.0, < 4.0.0)
|
||||
public_suffix (~> 2.0.0)
|
||||
rubyzip (>= 1.1.0, < 2.0.0)
|
||||
rubyzip (>= 1.2.1, < 2.0.0)
|
||||
security (= 0.1.3)
|
||||
simctl (~> 1.6.3)
|
||||
slack-notifier (>= 2.0.0, < 3.0.0)
|
||||
|
@ -100,7 +100,7 @@ GEM
|
|||
tty-spinner (>= 0.8.0, < 1.0.0)
|
||||
word_wrap (~> 1.0.0)
|
||||
xcodeproj (>= 1.5.7, < 2.0.0)
|
||||
xcpretty (>= 0.2.4, < 1.0.0)
|
||||
xcpretty (~> 0.2.8)
|
||||
xcpretty-travis-formatter (>= 0.0.3)
|
||||
fourflusher (2.0.1)
|
||||
fuzzy_match (2.0.4)
|
||||
|
@ -142,9 +142,9 @@ GEM
|
|||
multi_json (1.13.1)
|
||||
multi_xml (0.6.0)
|
||||
multipart-post (2.0.0)
|
||||
nanaimo (0.2.5)
|
||||
nanaimo (0.2.6)
|
||||
nap (1.1.0)
|
||||
naturally (2.1.0)
|
||||
naturally (2.2.0)
|
||||
netrc (0.11.0)
|
||||
os (0.9.6)
|
||||
plist (3.4.0)
|
||||
|
@ -153,9 +153,9 @@ GEM
|
|||
declarative (< 0.1.0)
|
||||
declarative-option (< 0.2.0)
|
||||
uber (< 0.2.0)
|
||||
retriable (3.1.1)
|
||||
retriable (3.1.2)
|
||||
rouge (2.0.7)
|
||||
ruby-macho (1.1.0)
|
||||
ruby-macho (1.2.0)
|
||||
rubyzip (1.2.1)
|
||||
security (0.1.3)
|
||||
signet (0.8.1)
|
||||
|
@ -163,7 +163,7 @@ GEM
|
|||
faraday (~> 0.9)
|
||||
jwt (>= 1.5, < 3.0)
|
||||
multi_json (~> 1.10)
|
||||
simctl (1.6.4)
|
||||
simctl (1.6.5)
|
||||
CFPropertyList
|
||||
naturally
|
||||
slack-notifier (2.3.2)
|
||||
|
@ -171,8 +171,8 @@ GEM
|
|||
terminal-table (1.8.0)
|
||||
unicode-display_width (~> 1.1, >= 1.1.1)
|
||||
thread_safe (0.3.6)
|
||||
tty-cursor (0.5.0)
|
||||
tty-screen (0.6.4)
|
||||
tty-cursor (0.6.0)
|
||||
tty-screen (0.6.5)
|
||||
tty-spinner (0.8.0)
|
||||
tty-cursor (>= 0.5.0)
|
||||
tzinfo (1.2.5)
|
||||
|
@ -181,7 +181,7 @@ GEM
|
|||
unf (0.1.4)
|
||||
unf_ext
|
||||
unf_ext (0.0.7.5)
|
||||
unicode-display_width (1.3.2)
|
||||
unicode-display_width (1.4.0)
|
||||
word_wrap (1.0.0)
|
||||
xcodeproj (1.5.9)
|
||||
CFPropertyList (>= 2.3.3, < 4.0)
|
||||
|
@ -202,4 +202,4 @@ DEPENDENCIES
|
|||
fastlane
|
||||
|
||||
BUNDLED WITH
|
||||
1.16.1
|
||||
1.16.2
|
||||
|
|
|
@ -308,7 +308,6 @@
|
|||
452C7CA72037628B003D51A5 /* Weak.swift in Sources */ = {isa = PBXBuildFile; fileRef = 45F170D51E315310003FC1F2 /* Weak.swift */; };
|
||||
452D1AF12081059C00A67F7F /* StringAdditionsTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 452D1AF02081059C00A67F7F /* StringAdditionsTest.swift */; };
|
||||
452D1AF320810B6F00A67F7F /* String+OWS.swift in Sources */ = {isa = PBXBuildFile; fileRef = 452D1AF220810B6F00A67F7F /* String+OWS.swift */; };
|
||||
452D1EE81DCA90D100A57EC4 /* MesssagesBubblesSizeCalculatorTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 452D1EE71DCA90D100A57EC4 /* MesssagesBubblesSizeCalculatorTest.swift */; };
|
||||
452EA09E1EA7ABE00078744B /* AttachmentPointerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 452EA09D1EA7ABE00078744B /* AttachmentPointerView.swift */; };
|
||||
452EC6DF205E9E30000E787C /* MediaGalleryViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 452EC6DE205E9E30000E787C /* MediaGalleryViewController.swift */; };
|
||||
452EC6E1205FF5DC000E787C /* Bench.swift in Sources */ = {isa = PBXBuildFile; fileRef = 452EC6E0205FF5DC000E787C /* Bench.swift */; };
|
||||
|
@ -951,7 +950,6 @@
|
|||
452C468E1E427E200087B011 /* OutboundCallInitiator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OutboundCallInitiator.swift; sourceTree = "<group>"; };
|
||||
452D1AF02081059C00A67F7F /* StringAdditionsTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StringAdditionsTest.swift; sourceTree = "<group>"; };
|
||||
452D1AF220810B6F00A67F7F /* String+OWS.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+OWS.swift"; sourceTree = "<group>"; };
|
||||
452D1EE71DCA90D100A57EC4 /* MesssagesBubblesSizeCalculatorTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = MesssagesBubblesSizeCalculatorTest.swift; path = Models/MesssagesBubblesSizeCalculatorTest.swift; sourceTree = "<group>"; };
|
||||
452EA09D1EA7ABE00078744B /* AttachmentPointerView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AttachmentPointerView.swift; sourceTree = "<group>"; };
|
||||
452EC6DE205E9E30000E787C /* MediaGalleryViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MediaGalleryViewController.swift; sourceTree = "<group>"; };
|
||||
452EC6E0205FF5DC000E787C /* Bench.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Bench.swift; sourceTree = "<group>"; };
|
||||
|
@ -2004,7 +2002,6 @@
|
|||
children = (
|
||||
458E38391D6699FA0094BD24 /* OWSDeviceProvisioningURLParserTest.m */,
|
||||
458967101DC117CC00E9DD21 /* AccountManagerTest.swift */,
|
||||
452D1EE71DCA90D100A57EC4 /* MesssagesBubblesSizeCalculatorTest.swift */,
|
||||
);
|
||||
name = Models;
|
||||
sourceTree = "<group>";
|
||||
|
@ -3395,7 +3392,6 @@
|
|||
458967111DC117CC00E9DD21 /* AccountManagerTest.swift in Sources */,
|
||||
340B02BA1FA0D6C700F9CFEC /* ConversationViewItemTest.m in Sources */,
|
||||
458E383A1D6699FA0094BD24 /* OWSDeviceProvisioningURLParserTest.m in Sources */,
|
||||
452D1EE81DCA90D100A57EC4 /* MesssagesBubblesSizeCalculatorTest.swift in Sources */,
|
||||
45360B901F9527DA00FA666C /* SearcherTest.swift in Sources */,
|
||||
B660F7561C29988E00687D6E /* PushManager.m in Sources */,
|
||||
34DB0BED2011548B007B313F /* OWSDatabaseConverterTest.m in Sources */,
|
||||
|
|
|
@ -925,7 +925,7 @@ static NSTimeInterval launchStartedAt;
|
|||
- (void)application:(UIApplication *)application
|
||||
handleActionWithIdentifier:(NSString *)identifier
|
||||
forLocalNotification:(UILocalNotification *)notification
|
||||
completionHandler:(void (^)())completionHandler
|
||||
completionHandler:(void (^)(void))completionHandler
|
||||
{
|
||||
OWSAssertIsOnMainThread();
|
||||
|
||||
|
|
|
@ -26,7 +26,8 @@ public class MessageFetcherJob: NSObject {
|
|||
SwiftSingletons.register(self)
|
||||
}
|
||||
|
||||
@discardableResult public func run() -> Promise<Void> {
|
||||
@discardableResult
|
||||
public func run() -> Promise<Void> {
|
||||
Logger.debug("\(self.logTag) in \(#function)")
|
||||
|
||||
guard signalService.isCensorshipCircumventionActive else {
|
||||
|
@ -58,7 +59,9 @@ public class MessageFetcherJob: NSObject {
|
|||
return promise
|
||||
}
|
||||
|
||||
@objc public func run() -> AnyPromise {
|
||||
@objc
|
||||
@discardableResult
|
||||
public func run() -> AnyPromise {
|
||||
return AnyPromise(run())
|
||||
}
|
||||
|
||||
|
|
|
@ -138,8 +138,8 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
NSString *attachmentID = [userinfo objectForKey:kAttachmentUploadAttachmentIDKey];
|
||||
if ([self.attachment.uniqueId isEqual:attachmentID]) {
|
||||
if (!isnan(progress)) {
|
||||
[self.progressView setProgress:progress];
|
||||
self.lastProgress = progress;
|
||||
[self.progressView setProgress:(CGFloat)progress];
|
||||
self.lastProgress = (CGFloat)progress;
|
||||
self.isAttachmentReady = self.attachment.isUploaded;
|
||||
} else {
|
||||
OWSFail(@"%@ Invalid attachment progress.", self.logTag);
|
||||
|
|
|
@ -67,7 +67,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
|
||||
UIView *selectedBackgroundView = [UIView new];
|
||||
selectedBackgroundView.backgroundColor =
|
||||
[(UIColor.isThemeEnabled ? [UIColor ows_whiteColor] : [UIColor ows_blackColor]) colorWithAlphaComponent:0.08];
|
||||
[(UIColor.isThemeEnabled ? [UIColor ows_whiteColor] : [UIColor ows_blackColor]) colorWithAlphaComponent:0.08f];
|
||||
|
||||
self.selectedBackgroundView = selectedBackgroundView;
|
||||
|
||||
|
|
|
@ -1,117 +0,0 @@
|
|||
//
|
||||
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
import SignalServiceKit
|
||||
@testable import Signal
|
||||
|
||||
/**
|
||||
* This is a brittle test, which will break if our layout changes.
|
||||
*
|
||||
* It serves mostly as documentation for cases to consider when changing the cell measurement logic.
|
||||
* Primarily these test cases came out of a bug introduced in iOS10,
|
||||
* which prevents us from computing proper bounding box for text that uses the UIEmoji font.
|
||||
*
|
||||
* If one of these tests breaks, it should be OK to update the expected value so long as you've tested the result renders
|
||||
* correctly in the running app (the reference sizes were computed in the context of an iphone6 layout.
|
||||
* @see `FakeiPhone6JSQMessagesCollectionViewFlowLayout`
|
||||
*/
|
||||
class MesssagesBubblesSizeCalculatorTest: XCTestCase {
|
||||
|
||||
let thread = TSContactThread()!
|
||||
let contactsManager = OWSContactsManager()
|
||||
|
||||
func viewItemForText(_ text: String?) -> ConversationViewItem {
|
||||
let interaction = TSOutgoingMessage(in: thread, messageBody: text, attachmentId: nil)
|
||||
interaction.save()
|
||||
|
||||
var viewItem: ConversationViewItem!
|
||||
interaction.dbReadWriteConnection().readWrite { transaction in
|
||||
viewItem = ConversationViewItem(interaction: interaction, isGroupThread: false, transaction: transaction)
|
||||
}
|
||||
|
||||
viewItem.shouldShowDate = false
|
||||
viewItem.shouldHideRecipientStatus = true
|
||||
return viewItem
|
||||
}
|
||||
|
||||
func messageBubbleSize(for viewItem: ConversationViewItem) -> CGSize {
|
||||
viewItem.clearCachedLayoutState()
|
||||
// These are the expected values on iPhone SE.
|
||||
let viewWidth = 320
|
||||
let contentWidth = 300
|
||||
return viewItem.cellSize(forViewWidth: Int32(viewWidth), contentWidth: Int32(contentWidth))
|
||||
}
|
||||
|
||||
func testHeightForEmptyMessage() {
|
||||
let text: String? = ""
|
||||
let viewItem = self.viewItemForText(text)
|
||||
let actual = messageBubbleSize(for: viewItem)
|
||||
XCTAssertEqual(36, actual.height)
|
||||
}
|
||||
|
||||
func testHeightForShort1LineMessage() {
|
||||
let text = "foo"
|
||||
let viewItem = self.viewItemForText(text)
|
||||
let actual = messageBubbleSize(for: viewItem)
|
||||
XCTAssertEqual(36, actual.height)
|
||||
}
|
||||
|
||||
func testHeightForLong1LineMessage() {
|
||||
let text = "1 2 3 4 5 6 7 8 9 10 11 12 13 14 x"
|
||||
let viewItem = self.viewItemForText(text)
|
||||
let actual = messageBubbleSize(for: viewItem)
|
||||
XCTAssertEqual(58, actual.height)
|
||||
}
|
||||
|
||||
func testHeightForShort2LineMessage() {
|
||||
let text = "1 2 3 4 5 6 7 8 9 10 11 12 13 14 x 1"
|
||||
let viewItem = self.viewItemForText(text)
|
||||
let actual = messageBubbleSize(for: viewItem)
|
||||
XCTAssertEqual(58, actual.height)
|
||||
}
|
||||
|
||||
func testHeightForLong2LineMessage() {
|
||||
let text = "1 2 3 4 5 6 7 8 9 10 11 12 13 14 x 1 2 3 4 5 6 7 8 9 10 11 12 13 14 x"
|
||||
let viewItem = self.viewItemForText(text)
|
||||
let actual = messageBubbleSize(for: viewItem)
|
||||
XCTAssertEqual(80, actual.height)
|
||||
}
|
||||
|
||||
func testHeightForiOS10EmojiBug() {
|
||||
let viewItem = self.viewItemForText("Wunderschönen Guten Morgaaaahhhn 😝 - hast du gut geschlafen ☺️😘")
|
||||
let actual = messageBubbleSize(for: viewItem)
|
||||
|
||||
XCTAssertEqual(80, actual.height)
|
||||
}
|
||||
|
||||
func testHeightForiOS10EmojiBug2() {
|
||||
let viewItem = self.viewItemForText("Test test test test test test test test test test test test 😊❤️❤️")
|
||||
let actual = messageBubbleSize(for: viewItem)
|
||||
|
||||
XCTAssertEqual(80, actual.height)
|
||||
}
|
||||
|
||||
func testHeightForChineseWithEmojiBug() {
|
||||
let viewItem = self.viewItemForText("一二三四五六七八九十甲乙丙😝戊己庚辛壬圭咖啡牛奶餅乾水果蛋糕")
|
||||
let actual = messageBubbleSize(for: viewItem)
|
||||
// erroneously seeing 69 with the emoji fix in place.
|
||||
XCTAssertEqual(80, actual.height)
|
||||
}
|
||||
|
||||
func testHeightForChineseWithoutEmojiBug() {
|
||||
let viewItem = self.viewItemForText("一二三四五六七八九十甲乙丙丁戊己庚辛壬圭咖啡牛奶餅乾水果蛋糕")
|
||||
let actual = messageBubbleSize(for: viewItem)
|
||||
// erroneously seeing 69 with the emoji fix in place.
|
||||
XCTAssertEqual(80, actual.height)
|
||||
}
|
||||
|
||||
func testHeightForiOS10DoubleSpaceNumbersBug() {
|
||||
let viewItem = self.viewItemForText("12345678901234567890")
|
||||
let actual = messageBubbleSize(for: viewItem)
|
||||
// erroneously seeing 51 with emoji fix in place. It's the call to "fix string"
|
||||
XCTAssertEqual(58, actual.height)
|
||||
}
|
||||
|
||||
}
|
|
@ -4,14 +4,20 @@
|
|||
|
||||
#import "ConversationViewItem.h"
|
||||
#import <MobileCoreServices/MobileCoreServices.h>
|
||||
#import <SignalMessaging/SignalMessaging-Swift.h>
|
||||
#import <SignalServiceKit/MIMETypeUtil.h>
|
||||
#import <SignalServiceKit/SecurityUtils.h>
|
||||
#import <SignalServiceKit/TSAttachmentStream.h>
|
||||
#import <SignalServiceKit/TSContactThread.h>
|
||||
#import <SignalServiceKit/TSOutgoingMessage.h>
|
||||
#import <XCTest/XCTest.h>
|
||||
#import <YapDatabase/YapDatabaseConnection.h>
|
||||
|
||||
@interface ConversationViewItemTest : XCTestCase
|
||||
|
||||
@property TSThread *thread;
|
||||
@property ConversationStyle *conversationStyle;
|
||||
|
||||
@end
|
||||
|
||||
@implementation ConversationViewItemTest
|
||||
|
@ -19,6 +25,8 @@
|
|||
- (void)setUp
|
||||
{
|
||||
[super setUp];
|
||||
self.thread = [TSContactThread getOrCreateThreadWithContactId:@"+15555555"];
|
||||
self.conversationStyle = [[ConversationStyle alloc] initWithThread:self.thread];
|
||||
}
|
||||
|
||||
- (void)tearDown
|
||||
|
@ -27,8 +35,6 @@
|
|||
[super tearDown];
|
||||
}
|
||||
|
||||
// Test canPerformAction
|
||||
|
||||
- (NSString *)fakeTextMessageText
|
||||
{
|
||||
return @"abc";
|
||||
|
@ -37,11 +43,14 @@
|
|||
- (ConversationViewItem *)textViewItem
|
||||
{
|
||||
TSOutgoingMessage *message =
|
||||
[TSOutgoingMessage outgoingMessageInThread:nil messageBody:self.fakeTextMessageText attachmentId:nil];
|
||||
[TSOutgoingMessage outgoingMessageInThread:self.thread messageBody:self.fakeTextMessageText attachmentId:nil];
|
||||
[message save];
|
||||
__block ConversationViewItem *viewItem = nil;
|
||||
[TSYapDatabaseObject.dbReadConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) {
|
||||
viewItem = [[ConversationViewItem alloc] initWithInteraction:message isGroupThread:NO transaction:transaction];
|
||||
viewItem = [[ConversationViewItem alloc] initWithInteraction:message
|
||||
isGroupThread:NO
|
||||
transaction:transaction
|
||||
conversationStyle:self.conversationStyle];
|
||||
}];
|
||||
return viewItem;
|
||||
}
|
||||
|
@ -63,12 +72,15 @@
|
|||
OWSAssert(success);
|
||||
[attachment save];
|
||||
TSOutgoingMessage *message =
|
||||
[TSOutgoingMessage outgoingMessageInThread:nil messageBody:nil attachmentId:attachment.uniqueId];
|
||||
[TSOutgoingMessage outgoingMessageInThread:self.thread messageBody:nil attachmentId:attachment.uniqueId];
|
||||
[message save];
|
||||
|
||||
__block ConversationViewItem *viewItem = nil;
|
||||
[TSYapDatabaseObject.dbReadConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) {
|
||||
viewItem = [[ConversationViewItem alloc] initWithInteraction:message isGroupThread:NO transaction:transaction];
|
||||
viewItem = [[ConversationViewItem alloc] initWithInteraction:message
|
||||
isGroupThread:NO
|
||||
transaction:transaction
|
||||
conversationStyle:self.conversationStyle];
|
||||
}];
|
||||
|
||||
return viewItem;
|
||||
|
|
|
@ -39,10 +39,10 @@ class FakePeerConnectionClientDelegate: PeerConnectionClientDelegate {
|
|||
dataChannelMessages.append(dataChannelMessage)
|
||||
}
|
||||
|
||||
func peerConnectionClient(_ peerconnectionClient: PeerConnectionClient, didUpdateLocal videoTrack: RTCVideoTrack?) {
|
||||
func peerConnectionClient(_ peerconnectionClient: PeerConnectionClient, didUpdateLocalVideoCaptureSession captureSession: AVCaptureSession?) {
|
||||
}
|
||||
|
||||
func peerConnectionClient(_ peerconnectionClient: PeerConnectionClient, didUpdateRemote videoTrack: RTCVideoTrack?) {
|
||||
func peerConnectionClient(_ peerconnectionClient: PeerConnectionClient, didUpdateRemoteVideoTrack videoTrack: RTCVideoTrack?) {
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@ class StubbableEnvironment: TextSecureKitEnv {
|
|||
|
||||
@objc
|
||||
class FakeContactsManager: NSObject, ContactsManagerProtocol {
|
||||
|
||||
func displayName(forPhoneIdentifier phoneNumber: String?) -> String {
|
||||
if phoneNumber == aliceRecipientId {
|
||||
return "Alice"
|
||||
|
@ -70,6 +71,18 @@ class FakeContactsManager: NSObject, ContactsManagerProtocol {
|
|||
|
||||
return .orderedAscending
|
||||
}
|
||||
|
||||
func cnContact(withId contactId: String?) -> CNContact? {
|
||||
return nil
|
||||
}
|
||||
|
||||
func avatarData(forCNContactId contactId: String?) -> Data? {
|
||||
return nil
|
||||
}
|
||||
|
||||
func avatarImage(forCNContactId contactId: String?) -> UIImage? {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
let bobRecipientId = "+49030183000"
|
||||
|
@ -99,13 +112,14 @@ class ConversationSearcherTest: XCTestCase {
|
|||
override func setUp() {
|
||||
super.setUp()
|
||||
|
||||
FullTextSearchFinder.syncRegisterDatabaseExtension(storage: OWSPrimaryStorage.shared())
|
||||
FullTextSearchFinder.ensureDatabaseExtensionRegistered(storage: OWSPrimaryStorage.shared())
|
||||
|
||||
TSContactThread.removeAllObjectsInCollection()
|
||||
TSGroupThread.removeAllObjectsInCollection()
|
||||
TSMessage.removeAllObjectsInCollection()
|
||||
|
||||
originalEnvironment = TextSecureKitEnv.shared()
|
||||
assert(originalEnvironment != nil)
|
||||
|
||||
let testEnvironment: StubbableEnvironment = StubbableEnvironment(proxy: originalEnvironment!)
|
||||
testEnvironment.stubbedContactsManager = FakeContactsManager()
|
||||
|
|
|
@ -34,12 +34,14 @@ FOUNDATION_EXPORT const unsigned char SignalMessagingVersionString[];
|
|||
#import <SignalMessaging/OWSQuotedReplyModel.h>
|
||||
#import <SignalMessaging/OWSSounds.h>
|
||||
#import <SignalMessaging/OWSTableViewController.h>
|
||||
#import <SignalMessaging/OWSUnreadIndicator.h>
|
||||
#import <SignalMessaging/OWSUserProfile.h>
|
||||
#import <SignalMessaging/OWSWindowManager.h>
|
||||
#import <SignalMessaging/Release.h>
|
||||
#import <SignalMessaging/ScreenLockViewController.h>
|
||||
#import <SignalMessaging/SharingThreadPickerViewController.h>
|
||||
#import <SignalMessaging/SignalKeyingStorage.h>
|
||||
#import <SignalMessaging/TSUnreadIndicatorInteraction.h>
|
||||
#import <SignalMessaging/ThreadUtil.h>
|
||||
#import <SignalMessaging/ThreadViewHelper.h>
|
||||
#import <SignalMessaging/UIColor+OWS.h>
|
||||
|
|
|
@ -53,7 +53,7 @@ NSString *NSStringForScreenLockUIState(ScreenLockUIState value)
|
|||
|
||||
const CGSize screenSize = UIScreen.mainScreen.bounds.size;
|
||||
const CGFloat shortScreenDimension = MIN(screenSize.width, screenSize.height);
|
||||
const CGFloat imageSize = round(shortScreenDimension / 3.f);
|
||||
const CGFloat imageSize = (CGFloat)round(shortScreenDimension / 3.f);
|
||||
[imageView autoSetDimension:ALDimensionWidth toSize:imageSize];
|
||||
[imageView autoSetDimension:ALDimensionHeight toSize:imageSize];
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
#import "OWSMath.h"
|
||||
#import "UIColor+OWS.h"
|
||||
#import "OWSMath.h"
|
||||
#import "UIUtil.h"
|
||||
#import <SignalServiceKit/Cryptography.h>
|
||||
#import <SignalServiceKit/NSNotificationCenter+OWS.h>
|
||||
|
@ -42,7 +42,7 @@ NSString *const UIColorKeyThemeEnabled = @"UIColorKeyThemeEnabled";
|
|||
|
||||
+ (UIColor *)ows_signalBrandBlueColor
|
||||
{
|
||||
return [UIColor colorWithRed:0.1135657504 green:0.4787300229 blue:0.89595204589999999 alpha:1.];
|
||||
return [UIColor colorWithRed:0.1135657504f green:0.4787300229f blue:0.89595204589999999f alpha:1.];
|
||||
}
|
||||
|
||||
+ (UIColor *)ows_materialBlueColor
|
||||
|
|
|
@ -19,7 +19,7 @@ static const CGFloat kIPhone7PlusScreenWidth = 414.f;
|
|||
CGFloat ScaleFromIPhone5To7Plus(CGFloat iPhone5Value, CGFloat iPhone7PlusValue)
|
||||
{
|
||||
CGFloat screenShortDimension = ScreenShortDimension();
|
||||
return round(CGFloatLerp(iPhone5Value,
|
||||
return (CGFloat)round(CGFloatLerp(iPhone5Value,
|
||||
iPhone7PlusValue,
|
||||
CGFloatInverseLerp(screenShortDimension, kIPhone5ScreenWidth, kIPhone7PlusScreenWidth)));
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ CGFloat ScaleFromIPhone5To7Plus(CGFloat iPhone5Value, CGFloat iPhone7PlusValue)
|
|||
CGFloat ScaleFromIPhone5(CGFloat iPhone5Value)
|
||||
{
|
||||
CGFloat screenShortDimension = ScreenShortDimension();
|
||||
return round(iPhone5Value * screenShortDimension / kIPhone5ScreenWidth);
|
||||
return (CGFloat)round(iPhone5Value * screenShortDimension / kIPhone5ScreenWidth);
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
@ -135,7 +135,7 @@ CGFloat ScaleFromIPhone5(CGFloat iPhone5Value)
|
|||
- (NSLayoutConstraint *)autoPinToAspectRatio:(CGFloat)ratio
|
||||
{
|
||||
// Clamp to ensure view has reasonable aspect ratio.
|
||||
CGFloat clampedRatio = CGFloatClamp(ratio, 0.05, 95.0);
|
||||
CGFloat clampedRatio = CGFloatClamp(ratio, 0.05f, 95.0f);
|
||||
if (clampedRatio != ratio) {
|
||||
OWSFail(@"Invalid aspect ratio: %f for view: %@", ratio, self);
|
||||
}
|
||||
|
@ -254,10 +254,9 @@ CGFloat ScaleFromIPhone5(CGFloat iPhone5Value)
|
|||
{
|
||||
OWSAssert(self.superview);
|
||||
|
||||
self.frame = CGRectMake(round((self.superview.width - self.width) * 0.5f),
|
||||
round((self.superview.height - self.height) * 0.5f),
|
||||
self.width,
|
||||
self.height);
|
||||
CGFloat x = (CGFloat)round((self.superview.width - self.width) * 0.5f);
|
||||
CGFloat y = (CGFloat)round((self.superview.height - self.height) * 0.5f);
|
||||
self.frame = CGRectMake(x, y, self.width, self.height);
|
||||
}
|
||||
|
||||
#pragma mark - RTL
|
||||
|
|
|
@ -332,7 +332,7 @@ NSString *const OWSContactsManagerSignalAccountsDidChangeNotification
|
|||
NSMutableSet<NSString *> *seenRecipientIds = [NSMutableSet new];
|
||||
for (Contact *contact in contacts) {
|
||||
NSArray<SignalRecipient *> *signalRecipients = contactIdToSignalRecipientsMap[contact.uniqueId];
|
||||
for (SignalRecipient *signalRecipient in [signalRecipients sortedArrayUsingSelector:@selector(compare:)]) {
|
||||
for (SignalRecipient *signalRecipient in [signalRecipients sortedArrayUsingSelector:@selector((compare:))]) {
|
||||
if ([seenRecipientIds containsObject:signalRecipient.recipientId]) {
|
||||
DDLogDebug(@"Ignoring duplicate contact: %@, %@", signalRecipient.recipientId, contact.fullName);
|
||||
continue;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
|
||||
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
#import "OWS105AttachmentFilePaths.h"
|
||||
|
@ -32,7 +32,7 @@ static NSString *const OWS105AttachmentFilePathsMigrationId = @"105";
|
|||
[attachmentStreams addObject:attachmentStream];
|
||||
}];
|
||||
|
||||
DDLogInfo(@"Saving %zd attachment streams.", attachmentStreams.count);
|
||||
DDLogInfo(@"Saving %lu attachment streams.", (unsigned long)attachmentStreams.count);
|
||||
|
||||
// Persist the new localRelativeFilePath property of TSAttachmentStream.
|
||||
// For performance, we want to upgrade all existing attachment streams in
|
||||
|
|
|
@ -22,7 +22,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
NSMutableArray<NSString *> *recordIds = [NSMutableArray new];
|
||||
[dbConnection asyncReadWriteWithBlock:^(YapDatabaseReadWriteTransaction *_Nonnull transaction) {
|
||||
[recordIds addObjectsFromArray:[transaction allKeysInCollection:collection]];
|
||||
DDLogInfo(@"%@ Migrating %zd records from: %@.", self.logTag, recordIds.count, collection);
|
||||
DDLogInfo(@"%@ Migrating %lu records from: %@.", self.logTag, (unsigned long)recordIds.count, collection);
|
||||
}
|
||||
completionQueue:dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)
|
||||
completionBlock:^{
|
||||
|
@ -45,7 +45,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
OWSAssert(dbConnection);
|
||||
OWSAssert(completion);
|
||||
|
||||
DDLogVerbose(@"%@ %s: %zd", self.logTag, __PRETTY_FUNCTION__, recordIds.count);
|
||||
DDLogVerbose(@"%@ %s: %lu", self.logTag, __PRETTY_FUNCTION__, (unsigned long)recordIds.count);
|
||||
|
||||
if (recordIds.count < 1) {
|
||||
completion();
|
||||
|
|
|
@ -531,14 +531,14 @@ const NSUInteger kOWSProfileManager_MaxAvatarDiameter = 640;
|
|||
- (void)logProfileWhitelist
|
||||
{
|
||||
[self.dbConnection asyncReadWithBlock:^(YapDatabaseReadTransaction *transaction) {
|
||||
DDLogError(@"kOWSProfileManager_UserWhitelistCollection: %zd",
|
||||
[transaction numberOfKeysInCollection:kOWSProfileManager_UserWhitelistCollection]);
|
||||
DDLogError(@"kOWSProfileManager_UserWhitelistCollection: %lu",
|
||||
(unsigned long)[transaction numberOfKeysInCollection:kOWSProfileManager_UserWhitelistCollection]);
|
||||
[transaction enumerateKeysInCollection:kOWSProfileManager_UserWhitelistCollection
|
||||
usingBlock:^(NSString *_Nonnull key, BOOL *_Nonnull stop) {
|
||||
DDLogError(@"\t profile whitelist user: %@", key);
|
||||
}];
|
||||
DDLogError(@"kOWSProfileManager_GroupWhitelistCollection: %zd",
|
||||
[transaction numberOfKeysInCollection:kOWSProfileManager_GroupWhitelistCollection]);
|
||||
DDLogError(@"kOWSProfileManager_GroupWhitelistCollection: %lu",
|
||||
(unsigned long)[transaction numberOfKeysInCollection:kOWSProfileManager_GroupWhitelistCollection]);
|
||||
[transaction enumerateKeysInCollection:kOWSProfileManager_GroupWhitelistCollection
|
||||
usingBlock:^(NSString *_Nonnull key, BOOL *_Nonnull stop) {
|
||||
DDLogError(@"\t profile whitelist group: %@", key);
|
||||
|
|
|
@ -330,11 +330,11 @@ NSString *const kLocalProfileUniqueId = @"kLocalProfileUniqueId";
|
|||
// This should only be used in verbose, developer-only logs.
|
||||
- (NSString *)debugDescription
|
||||
{
|
||||
return [NSString stringWithFormat:@"%@ %p %@ %zd %@ %@ %@",
|
||||
return [NSString stringWithFormat:@"%@ %p %@ %lu %@ %@ %@",
|
||||
self.logTag,
|
||||
self,
|
||||
self.recipientId,
|
||||
self.profileKey.keyData.length,
|
||||
(unsigned long)self.profileKey.keyData.length,
|
||||
self.profileName,
|
||||
self.avatarUrlPath,
|
||||
self.avatarFileName];
|
||||
|
|
|
@ -155,7 +155,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
self.delegate.audioPlaybackState = AudioPlaybackState_Paused;
|
||||
[self.audioPlayer pause];
|
||||
[self.audioPlayerPoller invalidate];
|
||||
[self.delegate setAudioProgress:[self.audioPlayer currentTime] duration:[self.audioPlayer duration]];
|
||||
[self.delegate setAudioProgress:(CGFloat)[self.audioPlayer currentTime] duration:(CGFloat)[self.audioPlayer duration]];
|
||||
|
||||
[OWSAudioSession.shared endAudioActivity:self.audioActivity];
|
||||
[DeviceSleepManager.sharedInstance removeBlockWithBlockObject:self];
|
||||
|
@ -194,7 +194,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
OWSAssert(self.audioPlayer);
|
||||
OWSAssert(self.audioPlayerPoller);
|
||||
|
||||
[self.delegate setAudioProgress:[self.audioPlayer currentTime] duration:[self.audioPlayer duration]];
|
||||
[self.delegate setAudioProgress:(CGFloat)[self.audioPlayer currentTime] duration:(CGFloat)[self.audioPlayer duration]];
|
||||
}
|
||||
|
||||
- (void)audioPlayerDidFinishPlaying:(AVAudioPlayer *)player successfully:(BOOL)flag
|
||||
|
|
|
@ -124,7 +124,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
[initials appendString:@"#"];
|
||||
}
|
||||
|
||||
CGFloat fontSize = (CGFloat)self.diameter / 2.8;
|
||||
CGFloat fontSize = (CGFloat)self.diameter / 2.8f;
|
||||
|
||||
UIImage *image = [[JSQMessagesAvatarImageFactory avatarImageWithUserInitials:initials
|
||||
backgroundColor:self.color
|
||||
|
|
|
@ -30,7 +30,7 @@ static inline CGFloat CGFloatInverseLerp(CGFloat value, CGFloat minValue, CGFloa
|
|||
// Ceil to an even number
|
||||
static inline CGFloat CeilEven(CGFloat value)
|
||||
{
|
||||
return 2.f * ceil(value * 0.5f);
|
||||
return 2.f * (CGFloat)ceil(value * 0.5f);
|
||||
}
|
||||
|
||||
void SetRandFunctionSeed(void);
|
||||
|
|
|
@ -731,7 +731,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
OWSProdLogAndFail(@"%@ couldn't load uniqueIds for collection: %@.", self.logTag, collection);
|
||||
return;
|
||||
}
|
||||
DDLogInfo(@"%@ Deleting %zd objects from: %@", self.logTag, uniqueIds.count, collection);
|
||||
DDLogInfo(@"%@ Deleting %lu objects from: %@", self.logTag, (unsigned long)uniqueIds.count, collection);
|
||||
NSUInteger count = 0;
|
||||
for (NSString *uniqueId in uniqueIds) {
|
||||
// We need to fetch each object, since [TSYapDatabaseObject removeWithTransaction:] sometimes does important
|
||||
|
@ -744,7 +744,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
[object removeWithTransaction:transaction];
|
||||
count++;
|
||||
};
|
||||
DDLogInfo(@"%@ Deleted %zd/%zd objects from: %@", self.logTag, count, uniqueIds.count, collection);
|
||||
DDLogInfo(@"%@ Deleted %lu/%lu objects from: %@", self.logTag, (unsigned long)count, (unsigned long)uniqueIds.count, collection);
|
||||
}
|
||||
|
||||
#pragma mark - Find Content
|
||||
|
|
|
@ -414,7 +414,7 @@ NSString *const TSAccountManager_ServerSignalingKey = @"TSStorageServerSignaling
|
|||
case 423: {
|
||||
NSString *localizedMessage = NSLocalizedString(@"REGISTRATION_VERIFICATION_FAILED_WRONG_PIN",
|
||||
"Error message indicating that registration failed due to a missing or incorrect 2FA PIN.");
|
||||
DDLogError(@"%@ 2FA PIN required: %ld", self.logTag, error.code);
|
||||
DDLogError(@"%@ 2FA PIN required: %ld", self.logTag, (long)error.code);
|
||||
NSError *error
|
||||
= OWSErrorWithCodeDescription(OWSErrorCodeRegistrationMissing2FAPIN, localizedMessage);
|
||||
failureBlock(error);
|
||||
|
|
|
@ -85,7 +85,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
|
||||
- (NSString *)debugDescription
|
||||
{
|
||||
return [NSString stringWithFormat:@"%@ with message timestamps: %zd", self.logTag, self.messageTimestamps.count];
|
||||
return [NSString stringWithFormat:@"%@ with message timestamps: %lu", self.logTag, (unsigned long)self.messageTimestamps.count];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -36,17 +36,6 @@ typedef NS_ENUM(int32_t, TSErrorMessageType) {
|
|||
quotedMessage:(nullable TSQuotedMessage *)quotedMessage
|
||||
contactShare:(nullable OWSContact *)contact NS_UNAVAILABLE;
|
||||
|
||||
- (nullable instancetype)initWithCoder:(NSCoder *)coder NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
- (instancetype)initWithTimestamp:(uint64_t)timestamp
|
||||
inThread:(TSThread *)thread
|
||||
failedMessageType:(TSErrorMessageType)errorMessageType
|
||||
recipientId:(nullable NSString *)recipientId NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
- (instancetype)initWithTimestamp:(uint64_t)timestamp
|
||||
inThread:(TSThread *)thread
|
||||
failedMessageType:(TSErrorMessageType)errorMessageType;
|
||||
|
||||
- (instancetype)initWithTimestamp:(uint64_t)timestamp
|
||||
inThread:(nullable TSThread *)thread
|
||||
messageBody:(nullable NSString *)body
|
||||
|
@ -54,6 +43,17 @@ typedef NS_ENUM(int32_t, TSErrorMessageType) {
|
|||
expiresInSeconds:(uint32_t)expiresInSeconds
|
||||
expireStartedAt:(uint64_t)expireStartedAt NS_UNAVAILABLE;
|
||||
|
||||
- (nullable instancetype)initWithCoder:(NSCoder *)coder NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
- (instancetype)initWithTimestamp:(uint64_t)timestamp
|
||||
inThread:(nullable TSThread *)thread
|
||||
failedMessageType:(TSErrorMessageType)errorMessageType
|
||||
recipientId:(nullable NSString *)recipientId NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
- (instancetype)initWithTimestamp:(uint64_t)timestamp
|
||||
inThread:(nullable TSThread *)thread
|
||||
failedMessageType:(TSErrorMessageType)errorMessageType;
|
||||
|
||||
+ (instancetype)corruptedMessageWithEnvelope:(OWSSignalServiceProtosEnvelope *)envelope
|
||||
withTransaction:(YapDatabaseReadWriteTransaction *)transaction;
|
||||
|
||||
|
|
|
@ -48,14 +48,7 @@ NSUInteger TSErrorMessageSchemaVersion = 1;
|
|||
}
|
||||
|
||||
- (instancetype)initWithTimestamp:(uint64_t)timestamp
|
||||
inThread:(TSThread *)thread
|
||||
failedMessageType:(TSErrorMessageType)errorMessageType
|
||||
{
|
||||
return [self initWithTimestamp:timestamp inThread:thread failedMessageType:errorMessageType recipientId:nil];
|
||||
}
|
||||
|
||||
- (instancetype)initWithTimestamp:(uint64_t)timestamp
|
||||
inThread:(TSThread *)thread
|
||||
inThread:(nullable TSThread *)thread
|
||||
failedMessageType:(TSErrorMessageType)errorMessageType
|
||||
recipientId:(nullable NSString *)recipientId
|
||||
{
|
||||
|
@ -83,6 +76,13 @@ NSUInteger TSErrorMessageSchemaVersion = 1;
|
|||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)initWithTimestamp:(uint64_t)timestamp
|
||||
inThread:(nullable TSThread *)thread
|
||||
failedMessageType:(TSErrorMessageType)errorMessageType
|
||||
{
|
||||
return [self initWithTimestamp:timestamp inThread:thread failedMessageType:errorMessageType recipientId:nil];
|
||||
}
|
||||
|
||||
- (instancetype)initWithEnvelope:(OWSSignalServiceProtosEnvelope *)envelope
|
||||
withTransaction:(YapDatabaseReadWriteTransaction *)transaction
|
||||
failedMessageType:(TSErrorMessageType)errorMessageType
|
||||
|
|
|
@ -356,11 +356,11 @@ NSString *const OWSMessageContentJobFinderExtensionGroup = @"OWSMessageContentJo
|
|||
|
||||
backgroundTask = nil;
|
||||
|
||||
DDLogVerbose(@"%@ completed %lu/%lu jobs. %zd jobs left.",
|
||||
DDLogVerbose(@"%@ completed %lu/%lu jobs. %lu jobs left.",
|
||||
self.logTag,
|
||||
(unsigned long)processedJobs.count,
|
||||
(unsigned long)batchJobs.count,
|
||||
[OWSMessageContentJob numberOfKeysInCollection]);
|
||||
(unsigned long)[OWSMessageContentJob numberOfKeysInCollection]);
|
||||
|
||||
// Wait a bit in hopes of increasing the batch size.
|
||||
// This delay won't affect the first message to arrive when this queue is idle,
|
||||
|
|
|
@ -257,9 +257,9 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
DDLogInfo(@"%@ Missing message for delivery receipt: %llu", self.logTag, timestamp);
|
||||
} else {
|
||||
if (messages.count > 1) {
|
||||
DDLogInfo(@"%@ More than one message (%zd) for delivery receipt: %llu",
|
||||
DDLogInfo(@"%@ More than one message (%lu) for delivery receipt: %llu",
|
||||
self.logTag,
|
||||
messages.count,
|
||||
(unsigned long)messages.count,
|
||||
timestamp);
|
||||
}
|
||||
for (TSOutgoingMessage *outgoingMessage in messages) {
|
||||
|
|
|
@ -226,9 +226,9 @@ NSString *const OWSReadReceiptManagerAreReadReceiptsEnabled = @"areReadReceiptsE
|
|||
|
||||
[self.messageSender enqueueMessage:message
|
||||
success:^{
|
||||
DDLogInfo(@"%@ Successfully sent %zd read receipt to linked devices.",
|
||||
DDLogInfo(@"%@ Successfully sent %lu read receipt to linked devices.",
|
||||
self.logTag,
|
||||
readReceiptsForLinkedDevices.count);
|
||||
(unsigned long)readReceiptsForLinkedDevices.count);
|
||||
}
|
||||
failure:^(NSError *error) {
|
||||
DDLogError(@"%@ Failed to send read receipt to linked devices with error: %@", self.logTag, error);
|
||||
|
@ -250,7 +250,7 @@ NSString *const OWSReadReceiptManagerAreReadReceiptsEnabled = @"areReadReceiptsE
|
|||
|
||||
[self.messageSender enqueueMessage:message
|
||||
success:^{
|
||||
DDLogInfo(@"%@ Successfully sent %zd read receipts to sender.", self.logTag, timestamps.count);
|
||||
DDLogInfo(@"%@ Successfully sent %lu read receipts to sender.", self.logTag, (unsigned long)timestamps.count);
|
||||
}
|
||||
failure:^(NSError *error) {
|
||||
DDLogError(@"%@ Failed to send read receipts to sender with error: %@", self.logTag, error);
|
||||
|
|
|
@ -202,7 +202,7 @@ typedef void (^failureBlock)(NSURLSessionDataTask *task, NSError *error);
|
|||
break;
|
||||
}
|
||||
case 411: {
|
||||
DDLogInfo(@"Multi-device pairing: %zd, %@, %@", statusCode, networkError.debugDescription, request);
|
||||
DDLogInfo(@"Multi-device pairing: %ld, %@, %@", (long)statusCode, networkError.debugDescription, request);
|
||||
failureBlock(task,
|
||||
[self errorWithHTTPCode:statusCode
|
||||
description:NSLocalizedString(@"MULTIDEVICE_PAIRING_MAX_DESC", nil)
|
||||
|
@ -239,7 +239,7 @@ typedef void (^failureBlock)(NSURLSessionDataTask *task, NSError *error);
|
|||
break;
|
||||
}
|
||||
default: {
|
||||
DDLogWarn(@"Unknown error: %zd, %@, %@", statusCode, networkError.debugDescription, request);
|
||||
DDLogWarn(@"Unknown error: %ld, %@, %@", (long)statusCode, networkError.debugDescription, request);
|
||||
failureBlock(task, error);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -584,8 +584,7 @@ NSString *const kNSNotification_SocketManagerStateDidChange = @"kNSNotification_
|
|||
if (message.hasBody) {
|
||||
responseData = message.body;
|
||||
}
|
||||
NSArray<NSString *> *_Nullable responseHeaders = message.headers;
|
||||
|
||||
|
||||
BOOL hasValidResponse = YES;
|
||||
id responseObject = responseData;
|
||||
if (responseData) {
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
// Copyright © 2016 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
#import "OWSWebsocketSecurityPolicy.h"
|
||||
|
||||
#import <SocketRocket/SRSecurityPolicy.h>
|
||||
#import "OWSHTTPSecurityPolicy.h"
|
||||
#import <SocketRocket/SRSecurityPolicy.h>
|
||||
|
||||
@implementation OWSWebsocketSecurityPolicy
|
||||
|
||||
|
@ -11,7 +12,11 @@
|
|||
static OWSWebsocketSecurityPolicy *websocketSecurityPolicy = nil;
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
// We use our own CA
|
||||
websocketSecurityPolicy = [[self alloc] initWithCertificateChainValidationEnabled:NO];
|
||||
#pragma clang diagnostic pop
|
||||
});
|
||||
return websocketSecurityPolicy;
|
||||
}
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
#import "OWSFileSystem.h"
|
||||
#import "OWSPrimaryStorage+SessionStore.h"
|
||||
#import "OWSFileSystem.h"
|
||||
#import "YapDatabaseConnection+OWS.h"
|
||||
#import "YapDatabaseTransaction+OWS.h"
|
||||
#import <AxolotlKit/SessionRecord.h>
|
||||
|
@ -66,6 +66,8 @@ NSString *const kSessionStoreDBConnectionKey = @"kSessionStoreDBConnectionKey";
|
|||
return record;
|
||||
}
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
- (NSArray *)subDevicesSessions:(NSString *)contactIdentifier protocolContext:(nullable id)protocolContext
|
||||
{
|
||||
OWSAssert(contactIdentifier.length > 0);
|
||||
|
@ -82,6 +84,7 @@ NSString *const kSessionStoreDBConnectionKey = @"kSessionStoreDBConnectionKey";
|
|||
|
||||
return dictionary ? dictionary.allKeys : @[];
|
||||
}
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
- (void)storeSession:(NSString *)contactIdentifier
|
||||
deviceId:(int)deviceId
|
||||
|
|
|
@ -264,7 +264,11 @@ public class FullTextSearchFinder: NSObject {
|
|||
}
|
||||
|
||||
// Only for testing.
|
||||
public class func syncRegisterDatabaseExtension(storage: OWSStorage) {
|
||||
public class func ensureDatabaseExtensionRegistered(storage: OWSStorage) {
|
||||
guard storage.registeredExtension(dbExtensionName) == nil else {
|
||||
return
|
||||
}
|
||||
|
||||
storage.register(dbExtensionConfig, withName: dbExtensionName)
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
|
||||
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
#import "TextSecureKitEnv.h"
|
||||
|
@ -59,7 +59,7 @@ static TextSecureKitEnv *sharedTextSecureKitEnv;
|
|||
+ (void)setSharedEnv:(TextSecureKitEnv *)env
|
||||
{
|
||||
OWSAssert(env);
|
||||
OWSAssert(!sharedTextSecureKitEnv || !CurrentAppContext().isMainApp);
|
||||
OWSAssert(!sharedTextSecureKitEnv || CurrentAppContext().isRunningTests);
|
||||
|
||||
sharedTextSecureKitEnv = env;
|
||||
}
|
||||
|
|
|
@ -213,7 +213,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
} else if (range.location != index || range.length < 1) {
|
||||
// This should never happen.
|
||||
OWSFail(
|
||||
@"%@ unexpected composed character sequence: %zd, %@", self.logTag, index, NSStringFromRange(range));
|
||||
@"%@ unexpected composed character sequence: %lu, %@", self.logTag, (unsigned long)index, NSStringFromRange(range));
|
||||
return YES;
|
||||
}
|
||||
index = range.location + range.length;
|
||||
|
|
|
@ -266,10 +266,10 @@ NSString *NSStringForOWSAnalyticsSeverity(OWSAnalyticsSeverity severity)
|
|||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
NSOperatingSystemVersion operatingSystemVersion = [[NSProcessInfo processInfo] operatingSystemVersion];
|
||||
result = [NSString stringWithFormat:@"%zd.%zd.%zd",
|
||||
(NSUInteger)operatingSystemVersion.majorVersion,
|
||||
(NSUInteger)operatingSystemVersion.minorVersion,
|
||||
(NSUInteger)operatingSystemVersion.patchVersion];
|
||||
result = [NSString stringWithFormat:@"%lu.%lu.%lu",
|
||||
(unsigned long)operatingSystemVersion.majorVersion,
|
||||
(unsigned long)operatingSystemVersion.minorVersion,
|
||||
(unsigned long)operatingSystemVersion.patchVersion];
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -98,12 +98,12 @@ NSString *const OWSOperationKeyIsFinished = @"isFinished";
|
|||
|
||||
- (void)reportError:(NSError *)error
|
||||
{
|
||||
DDLogDebug(@"%@ reportError: %@, fatal?: %d, retryable?: %d, remainingRetries: %zd",
|
||||
DDLogDebug(@"%@ reportError: %@, fatal?: %d, retryable?: %d, remainingRetries: %lu",
|
||||
self.logTag,
|
||||
error,
|
||||
error.isFatal,
|
||||
error.isRetryable,
|
||||
self.remainingRetries);
|
||||
(unsigned long)self.remainingRetries);
|
||||
|
||||
if (error.isFatal) {
|
||||
[self failOperationWithError:error];
|
||||
|
|
Loading…
Reference in New Issue