From f49309bf665d314f6b22b2bef27e464ceb56ee8c Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Tue, 30 May 2017 13:04:43 -0400 Subject: [PATCH 1/3] Add incoming and outgoing message database views. // FREEBIE --- Podfile | 4 +- Podfile.lock | 9 ++--- .../xcshareddata/Signal.xcscmblueprint | 11 +++++- Signal/src/util/ThreadUtil.m | 37 +++---------------- 4 files changed, 20 insertions(+), 41 deletions(-) diff --git a/Podfile b/Podfile index 55d7dcd08..058701680 100644 --- a/Podfile +++ b/Podfile @@ -5,8 +5,8 @@ target 'Signal' do pod 'SocketRocket', :git => 'https://github.com/facebook/SocketRocket.git' pod 'AxolotlKit', git: 'https://github.com/WhisperSystems/SignalProtocolKit.git' #pod 'AxolotlKit', path: '../SignalProtocolKit' - pod 'SignalServiceKit', git: 'https://github.com/WhisperSystems/SignalServiceKit.git' - #pod 'SignalServiceKit', path: '../SignalServiceKit' + #pod 'SignalServiceKit', git: 'https://github.com/WhisperSystems/SignalServiceKit.git' + pod 'SignalServiceKit', path: '../SignalServiceKit-2' pod 'OpenSSL' pod 'JSQMessagesViewController', git: 'https://github.com/WhisperSystems/JSQMessagesViewController.git', branch: 'mkirk/position-edit-menu' #pod 'JSQMessagesViewController' path: '../JSQMessagesViewController' diff --git a/Podfile.lock b/Podfile.lock index c993db8af..6e54621ca 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -114,7 +114,7 @@ DEPENDENCIES: - OpenSSL - PureLayout - Reachability - - SignalServiceKit (from `https://github.com/WhisperSystems/SignalServiceKit.git`) + - SignalServiceKit (from `../SignalServiceKit-2`) - SocketRocket (from `https://github.com/facebook/SocketRocket.git`) EXTERNAL SOURCES: @@ -124,7 +124,7 @@ EXTERNAL SOURCES: :branch: mkirk/position-edit-menu :git: https://github.com/WhisperSystems/JSQMessagesViewController.git SignalServiceKit: - :git: https://github.com/WhisperSystems/SignalServiceKit.git + :path: ../SignalServiceKit-2 SocketRocket: :git: https://github.com/facebook/SocketRocket.git @@ -135,9 +135,6 @@ CHECKOUT OPTIONS: JSQMessagesViewController: :commit: 7054e4b13ee5bcd6d524adb6dc9a726e8c466308 :git: https://github.com/WhisperSystems/JSQMessagesViewController.git - SignalServiceKit: - :commit: 888943a047ef818e0af2457b893662c8cae7406a - :git: https://github.com/WhisperSystems/SignalServiceKit.git SocketRocket: :commit: 877ac7438be3ad0b45ef5ca3969574e4b97112bf :git: https://github.com/facebook/SocketRocket.git @@ -164,6 +161,6 @@ SPEC CHECKSUMS: UnionFind: c33be5adb12983981d6e827ea94fc7f9e370f52d YapDatabase: cd911121580ff16675f65ad742a9eb0ab4d9e266 -PODFILE CHECKSUM: 48e80d7f1e049bbf544a689fdfdf33e8196c640a +PODFILE CHECKSUM: 09256f33f875f6a7b451b3d81a4acbdbb7fed9ad COCOAPODS: 1.2.1 diff --git a/Signal.xcworkspace/xcshareddata/Signal.xcscmblueprint b/Signal.xcworkspace/xcshareddata/Signal.xcscmblueprint index 5f588d65c..2709be386 100644 --- a/Signal.xcworkspace/xcshareddata/Signal.xcscmblueprint +++ b/Signal.xcworkspace/xcshareddata/Signal.xcscmblueprint @@ -8,12 +8,13 @@ "5D79A077E31B3FE97A3C6613CBFFDD71C314D14C+++0BB03DB" : 0, "01DE8628B025BC69C8C7D8B4612D57BE2C08B62C+++6A1C9FC" : 0, "ABB939127996C66F7E852A780552ADEEF03C6B13+++69179A3" : 0, - "5D79A077E31B3FE97A3C6613CBFFDD71C314D14C+++ED4C31A" : 0, "90530B99EB0008E7A50951FDFBE02169118FA649+++EF2C0B3" : 0, + "5D79A077E31B3FE97A3C6613CBFFDD71C314D14C+++ED4C31A" : 0, "D74FB800F048CB516BB4BC70047F7CC676D291B9+++375B249" : 0, "37054CE35CE656680D6FFFA9EE19249E0D149C5E+++901E7D4" : 0, "8176314449001F06FB0E5B588C62133EAA2FE911+++E19D6E3" : 9223372036854775807, "5D79A077E31B3FE97A3C6613CBFFDD71C314D14C+++03D0758" : 0, + "37054CE35CE656680D6FFFA9EE19249E0D149C5E+++3F8B703" : 9223372036854775807, "37054CE35CE656680D6FFFA9EE19249E0D149C5E+++E57A04A" : 0, "8176314449001F06FB0E5B588C62133EAA2FE911+++31C7255" : 9223372036854775807 }, @@ -23,12 +24,13 @@ "5D79A077E31B3FE97A3C6613CBFFDD71C314D14C+++0BB03DB" : "Signal-iOS-2\/", "01DE8628B025BC69C8C7D8B4612D57BE2C08B62C+++6A1C9FC" : "SignalProtocolKit\/", "ABB939127996C66F7E852A780552ADEEF03C6B13+++69179A3" : "SocketRocket\/", - "5D79A077E31B3FE97A3C6613CBFFDD71C314D14C+++ED4C31A" : "Signal-iOS\/", "90530B99EB0008E7A50951FDFBE02169118FA649+++EF2C0B3" : "JSQMessagesViewController\/", + "5D79A077E31B3FE97A3C6613CBFFDD71C314D14C+++ED4C31A" : "Signal-iOS\/", "D74FB800F048CB516BB4BC70047F7CC676D291B9+++375B249" : "Signal-iOS\/Pods\/", "37054CE35CE656680D6FFFA9EE19249E0D149C5E+++901E7D4" : "SignalServiceKit\/", "8176314449001F06FB0E5B588C62133EAA2FE911+++E19D6E3" : "Signal-iOS\/Carthage\/", "5D79A077E31B3FE97A3C6613CBFFDD71C314D14C+++03D0758" : "Signal-iOS-5\/", + "37054CE35CE656680D6FFFA9EE19249E0D149C5E+++3F8B703" : "SignalServiceKit-2\/", "37054CE35CE656680D6FFFA9EE19249E0D149C5E+++E57A04A" : "SignalServiceKit\/", "8176314449001F06FB0E5B588C62133EAA2FE911+++31C7255" : "Signal-iOS-5\/Carthage\/" }, @@ -41,6 +43,11 @@ "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "01DE8628B025BC69C8C7D8B4612D57BE2C08B62C+++6A1C9FC" }, + { + "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "github.com:WhisperSystems\/SignalServiceKit.git", + "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", + "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "37054CE35CE656680D6FFFA9EE19249E0D149C5E+++3F8B703" + }, { "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "github.com:WhisperSystems\/SignalProtocolKit.git", "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", diff --git a/Signal/src/util/ThreadUtil.m b/Signal/src/util/ThreadUtil.m index 0c46e2930..875cddee6 100644 --- a/Signal/src/util/ThreadUtil.m +++ b/Signal/src/util/ThreadUtil.m @@ -166,37 +166,12 @@ NS_ASSUME_NONNULL_BEGIN } } - __block TSIncomingMessage *firstIncomingMessage = nil; - __block TSOutgoingMessage *firstOutgoingMessage = nil; - __block long outgoingMessageCount = 0; - [[transaction ext:TSMessageDatabaseViewExtensionName] - enumerateRowsInGroup:thread.uniqueId - usingBlock:^( - NSString *collection, NSString *key, id object, id metadata, NSUInteger index, BOOL *stop) { - - if ([object isKindOfClass:[TSIncomingMessage class]]) { - TSIncomingMessage *incomingMessage = (TSIncomingMessage *)object; - if (!firstIncomingMessage) { - firstIncomingMessage = incomingMessage; - } else { - OWSAssert( - [firstIncomingMessage compareForSorting:incomingMessage] == NSOrderedAscending); - } - } else if ([object isKindOfClass:[TSOutgoingMessage class]]) { - TSOutgoingMessage *outgoingMessage = (TSOutgoingMessage *)object; - if (!firstOutgoingMessage) { - firstOutgoingMessage = outgoingMessage; - } else { - OWSAssert( - [firstOutgoingMessage compareForSorting:outgoingMessage] == NSOrderedAscending); - } - outgoingMessageCount++; - if (outgoingMessageCount >= kMaxBlockOfferOutgoingMessageCount) { - *stop = YES; - } - } - }]; - + TSIncomingMessage *firstIncomingMessage = + [[transaction ext:TSThreadIncomingMessageDatabaseViewExtensionName] firstObjectInGroup:thread.uniqueId]; + TSOutgoingMessage *firstOutgoingMessage = + [[transaction ext:TSThreadOutgoingMessageDatabaseViewExtensionName] firstObjectInGroup:thread.uniqueId]; + NSUInteger outgoingMessageCount = + [[transaction ext:TSThreadOutgoingMessageDatabaseViewExtensionName] numberOfItemsInGroup:thread.uniqueId]; // Enumerate in reverse to count the number of messages // after the unseen messages indicator. Not all of From b31ef7231a3d0f1e616ba64828b41bf7131fb78a Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Wed, 31 May 2017 10:01:56 -0400 Subject: [PATCH 2/3] Respond to CR. // FREEBIE --- Signal/src/ViewControllers/MessagesViewController.m | 2 -- 1 file changed, 2 deletions(-) diff --git a/Signal/src/ViewControllers/MessagesViewController.m b/Signal/src/ViewControllers/MessagesViewController.m index 608beeb6f..7e80ab698 100644 --- a/Signal/src/ViewControllers/MessagesViewController.m +++ b/Signal/src/ViewControllers/MessagesViewController.m @@ -690,8 +690,6 @@ typedef enum : NSUInteger { @property (nonatomic, readonly) UILabel *backButtonUnreadCountLabel; @property (nonatomic, readonly) NSUInteger backButtonUnreadCount; -@property (nonatomic) CGFloat previousCollectionViewFrameWidth; - @property (nonatomic) NSUInteger page; @property (nonatomic) BOOL composeOnOpen; @property (nonatomic) BOOL callOnOpen; From d752a9b03052dea3aed76669cd516780cb718020 Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Wed, 31 May 2017 10:05:25 -0400 Subject: [PATCH 3/3] [SSK] Add incoming and outgoing message database views. // FREEBIE --- Podfile | 4 ++-- Podfile.lock | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Podfile b/Podfile index 058701680..55d7dcd08 100644 --- a/Podfile +++ b/Podfile @@ -5,8 +5,8 @@ target 'Signal' do pod 'SocketRocket', :git => 'https://github.com/facebook/SocketRocket.git' pod 'AxolotlKit', git: 'https://github.com/WhisperSystems/SignalProtocolKit.git' #pod 'AxolotlKit', path: '../SignalProtocolKit' - #pod 'SignalServiceKit', git: 'https://github.com/WhisperSystems/SignalServiceKit.git' - pod 'SignalServiceKit', path: '../SignalServiceKit-2' + pod 'SignalServiceKit', git: 'https://github.com/WhisperSystems/SignalServiceKit.git' + #pod 'SignalServiceKit', path: '../SignalServiceKit' pod 'OpenSSL' pod 'JSQMessagesViewController', git: 'https://github.com/WhisperSystems/JSQMessagesViewController.git', branch: 'mkirk/position-edit-menu' #pod 'JSQMessagesViewController' path: '../JSQMessagesViewController' diff --git a/Podfile.lock b/Podfile.lock index 6e54621ca..3a98ca122 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -114,7 +114,7 @@ DEPENDENCIES: - OpenSSL - PureLayout - Reachability - - SignalServiceKit (from `../SignalServiceKit-2`) + - SignalServiceKit (from `https://github.com/WhisperSystems/SignalServiceKit.git`) - SocketRocket (from `https://github.com/facebook/SocketRocket.git`) EXTERNAL SOURCES: @@ -124,7 +124,7 @@ EXTERNAL SOURCES: :branch: mkirk/position-edit-menu :git: https://github.com/WhisperSystems/JSQMessagesViewController.git SignalServiceKit: - :path: ../SignalServiceKit-2 + :git: https://github.com/WhisperSystems/SignalServiceKit.git SocketRocket: :git: https://github.com/facebook/SocketRocket.git @@ -135,6 +135,9 @@ CHECKOUT OPTIONS: JSQMessagesViewController: :commit: 7054e4b13ee5bcd6d524adb6dc9a726e8c466308 :git: https://github.com/WhisperSystems/JSQMessagesViewController.git + SignalServiceKit: + :commit: 07b54039b231ae08a505cae2a14f65f7bb570f84 + :git: https://github.com/WhisperSystems/SignalServiceKit.git SocketRocket: :commit: 877ac7438be3ad0b45ef5ca3969574e4b97112bf :git: https://github.com/facebook/SocketRocket.git @@ -161,6 +164,6 @@ SPEC CHECKSUMS: UnionFind: c33be5adb12983981d6e827ea94fc7f9e370f52d YapDatabase: cd911121580ff16675f65ad742a9eb0ab4d9e266 -PODFILE CHECKSUM: 09256f33f875f6a7b451b3d81a4acbdbb7fed9ad +PODFILE CHECKSUM: 48e80d7f1e049bbf544a689fdfdf33e8196c640a COCOAPODS: 1.2.1