Respond to CR.

// FREEBIE
This commit is contained in:
Matthew Chen 2017-08-21 17:13:36 -04:00
parent a340c9ebdc
commit 14d472781f
8 changed files with 31 additions and 31 deletions

View File

@ -43,7 +43,7 @@ PODS:
- Reachability (3.2)
- SAMKeychain (1.5.2)
- SignalServiceKit (0.9.0):
- 25519
- '25519'
- AFNetworking
- AxolotlKit
- CocoaLumberjack
@ -149,7 +149,7 @@ CHECKOUT OPTIONS:
:git: https://github.com/facebook/SocketRocket.git
SPEC CHECKSUMS:
25519: dc4bad7e2dbcbf1efa121068a705a44cd98c80fc
'25519': dc4bad7e2dbcbf1efa121068a705a44cd98c80fc
AFNetworking: 5e0e199f73d8626b11e79750991f5d173d1f8b67
ATAppUpdater: a9f7027060959d47e58733d3b48f6b9a28cb8de1
AxolotlKit: ba0ab24b879d34559a68e1270b079cc9bd7b3417
@ -173,4 +173,4 @@ SPEC CHECKSUMS:
PODFILE CHECKSUM: 2f847bb25e70d1d376f38cf21ae08624fa6ed67d
COCOAPODS: 1.3.1
COCOAPODS: 1.2.1

View File

@ -2034,7 +2034,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
showEnvVarsInLog = 0;
};
3465F381B1856CC06933B3A8 /* [CP] Copy Pods Resources */ = {
@ -2142,7 +2142,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
showEnvVarsInLog = 0;
};
B4E9B04E862FB64FC9A8F79B /* [CP] Embed Pods Frameworks */ = {

View File

@ -11,7 +11,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, readonly) BOOL hasBlockOffer;
@property (nonatomic, readonly) BOOL hasAddToContactsOffer;
@property (nonatomic, readonly) BOOL hasAddToProfileWhitelistOffer;
@property (nonatomic, readonly) NSString *contactId;
@property (nonatomic, readonly) NSString *recipientId;
- (instancetype)initWithCoder:(NSCoder *)coder NS_DESIGNATED_INITIALIZER;
@ -20,7 +20,7 @@ NS_ASSUME_NONNULL_BEGIN
hasBlockOffer:(BOOL)hasBlockOffer
hasAddToContactsOffer:(BOOL)hasAddToContactsOffer
hasAddToProfileWhitelistOffer:(BOOL)hasAddToProfileWhitelistOffer
contactId:(NSString *)contactId NS_DESIGNATED_INITIALIZER;
recipientId:(NSString *)recipientId NS_DESIGNATED_INITIALIZER;
@end

View File

@ -18,7 +18,7 @@ NS_ASSUME_NONNULL_BEGIN
hasBlockOffer:(BOOL)hasBlockOffer
hasAddToContactsOffer:(BOOL)hasAddToContactsOffer
hasAddToProfileWhitelistOffer:(BOOL)hasAddToProfileWhitelistOffer
contactId:(NSString *)contactId
recipientId:(NSString *)recipientId
{
self = [super initWithTimestamp:timestamp inThread:thread];
@ -29,8 +29,8 @@ NS_ASSUME_NONNULL_BEGIN
_hasBlockOffer = hasBlockOffer;
_hasAddToContactsOffer = hasAddToContactsOffer;
_hasAddToProfileWhitelistOffer = hasAddToProfileWhitelistOffer;
OWSAssert(contactId.length > 0);
_contactId = contactId;
OWSAssert(recipientId.length > 0);
_recipientId = recipientId;
return self;
}

View File

@ -1849,9 +1849,10 @@ typedef enum : NSUInteger {
id<OWSMessageData> previousMessage =
[self messageAtIndexPath:[NSIndexPath indexPathForItem:indexPath.row - 1 inSection:indexPath.section]];
// TODO: What about the contact offers?
if ([previousMessage.interaction isKindOfClass:[TSUnreadIndicatorInteraction class]]) {
// Always show timestamp between unread indicator and the following interaction
if ([previousMessage.interaction isKindOfClass:[TSUnreadIndicatorInteraction class]] ||
[previousMessage.interaction isKindOfClass:[OWSContactOffersInteraction class]]) {
// Always show timestamp between unread indicator / contacts offers
// and the following interaction.
return YES;
}
@ -2639,7 +2640,7 @@ typedef enum : NSUInteger {
}
TSContactThread *contactThread = (TSContactThread *)self.thread;
NSString *displayName = [self.contactsManager displayNameForPhoneIdentifier:interaction.contactId];
NSString *displayName = [self.contactsManager displayNameForPhoneIdentifier:interaction.recipientId];
NSString *title =
[NSString stringWithFormat:NSLocalizedString(@"BLOCK_OFFER_ACTIONSHEET_TITLE_FORMAT",
@"Title format for action sheet that offers to block an unknown user."
@ -2660,7 +2661,7 @@ typedef enum : NSUInteger {
style:UIAlertActionStyleDestructive
handler:^(UIAlertAction *_Nonnull action) {
DDLogInfo(@"%@ Blocking an unknown user.", self.tag);
[self.blockingManager addBlockedPhoneNumber:interaction.contactId];
[self.blockingManager addBlockedPhoneNumber:interaction.recipientId];
// Delete the offers.
[self.editingDatabaseConnection
readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
@ -4251,8 +4252,6 @@ typedef enum : NSUInteger {
TSInteraction *interaction = [self interactionAtIndexPath:indexPath];
// Show any top/bottom labels for all but the unread indicator
//
// TODO: What about the contact offers?
return !([interaction isKindOfClass:[TSUnreadIndicatorInteraction class]] ||
[interaction isKindOfClass:[OWSContactOffersInteraction class]]);
}

View File

@ -99,7 +99,7 @@ NS_ASSUME_NONNULL_BEGIN
+ (void)clearHasDismissedOffers
{
[TSStorageManager.sharedManager.dbReadConnection
[TSStorageManager.sharedManager.dbReadWriteConnection
readWriteWithBlock:^(YapDatabaseReadWriteTransaction *_Nonnull transaction) {
NSMutableArray<TSContactThread *> *contactThreads = [NSMutableArray new];
[transaction

View File

@ -153,22 +153,30 @@ NS_ASSUME_NONNULL_BEGIN
const int kMaxBlockOfferOutgoingMessageCount = 10;
// Find any "dynamic" interactions and safety number changes.
NSMutableArray<TSInteraction *> *interactionsToDelete = [NSMutableArray new];
//
// We use different views for performance reasons.
__block TSUnreadIndicatorInteraction *existingUnreadIndicator = nil;
__block OWSContactOffersInteraction *existingContactOffers = nil;
NSMutableArray<TSInvalidIdentityKeyErrorMessage *> *blockingSafetyNumberChanges = [NSMutableArray new];
NSMutableArray<TSInteraction *> *nonBlockingSafetyNumberChanges = [NSMutableArray new];
// We use different views for performance reasons.
// We want to delete legacy and duplicate interactions.
NSMutableArray<TSInteraction *> *interactionsToDelete = [NSMutableArray new];
[[TSDatabaseView threadSpecialMessagesDatabaseView:transaction]
enumerateRowsInGroup:thread.uniqueId
usingBlock:^(
NSString *collection, NSString *key, id object, id metadata, NSUInteger index, BOOL *stop) {
if ([object isKindOfClass:[OWSUnknownContactBlockOfferMessage class]]) {
// Delete this legacy interactions, which has been superseded by
// the OWSContactOffersInteraction.
[interactionsToDelete addObject:object];
} else if ([object isKindOfClass:[OWSAddToContactsOfferMessage class]]) {
// Delete this legacy interactions, which has been superseded by
// the OWSContactOffersInteraction.
[interactionsToDelete addObject:object];
} else if ([object isKindOfClass:[OWSAddToProfileWhitelistOfferMessage class]]) {
// Delete this legacy interactions, which has been superseded by
// the OWSContactOffersInteraction.
[interactionsToDelete addObject:object];
} else if ([object isKindOfClass:[TSUnreadIndicatorInteraction class]]) {
OWSAssert(!existingUnreadIndicator);
@ -469,7 +477,7 @@ NS_ASSUME_NONNULL_BEGIN
hasBlockOffer:shouldHaveBlockOffer
hasAddToContactsOffer:shouldHaveAddToContactsOffer
hasAddToProfileWhitelistOffer:shouldHaveAddToProfileWhitelistOffer
contactId:recipientId];
recipientId:recipientId];
[offersMessage saveWithTransaction:transaction];
DDLogInfo(@"%@ Creating contact offers: %@ (%llu)",

View File

@ -820,20 +820,13 @@
/* The subtitle for the messages view title indicates that the title can be tapped to access settings for this conversation. */
"MESSAGES_VIEW_TITLE_SUBTITLE" = "Tap here for settings";
/* Indicator that separates read from unread
// messages.
Indicator that separates read from unread messages. */
/* Indicator that separates read from unread messages. */
"MESSAGES_VIEW_UNREAD_INDICATOR" = "Unread Messages";
/* Messages that indicates that there are more unseen messages including safety number changes
// // that be revealed by tapping the 'load earlier messages' button. Embeds {{the name of the 'load
// // earlier messages' button}}.
Messages that indicates that there are more unseen messages including safety number changes that be revealed by tapping the 'load earlier messages' button. Embeds {{the name of the 'load earlier messages' button}}. */
/* Messages that indicates that there are more unseen messages including safety number changes that be revealed by tapping the 'load earlier messages' button. Embeds {{the name of the 'load earlier messages' button}}. */
"MESSAGES_VIEW_UNREAD_INDICATOR_HAS_MORE_UNSEEN_MESSAGES_AND_SAFETY_NUMBER_CHANGES_FORMAT" = "There are more unread messages (including safety number changes) above. Tap \"%@\" to see them.";
/* Messages that indicates that there are more unseen messages that be revealed by tapping the
// // 'load earlier messages' button. Embeds {{the name of the 'load earlier messages' button}}
Messages that indicates that there are more unseen messages that be revealed by tapping the 'load earlier messages' button. Embeds {{the name of the 'load earlier messages' button}} */
/* Messages that indicates that there are more unseen messages that be revealed by tapping the 'load earlier messages' button. Embeds {{the name of the 'load earlier messages' button}} */
"MESSAGES_VIEW_UNREAD_INDICATOR_HAS_MORE_UNSEEN_MESSAGES_FORMAT" = "There are more unread messages above. Tap \"%@\" to see them.";
/* notification title */