Respond to post-holiday code reviews.

// FREEBIE
pull/1/head
Matthew Chen 8 years ago
parent a9bac8bce7
commit 18e6a1b1cb

@ -176,9 +176,6 @@ NS_ASSUME_NONNULL_BEGIN
// data loss and will resolve all known issues.
- (void)updateWithMutedUntilDate:(NSDate *)mutedUntilDate;
// Returns YES IFF the interaction should show up in the inbox as the last message.
+ (BOOL)shouldInteractionAppearInInbox:(TSInteraction *)interaction;
@end
NS_ASSUME_NONNULL_END

@ -283,6 +283,7 @@ NS_ASSUME_NONNULL_BEGIN
}
}
// Returns YES IFF the interaction should show up in the inbox as the last message.
+ (BOOL)shouldInteractionAppearInInbox:(TSInteraction *)interaction
{
OWSAssert(interaction);

@ -33,7 +33,7 @@ extern const NSUInteger kIdentityKeyLength;
- (void)setVerificationState:(OWSVerificationState)verificationState
identityKey:(NSData *)identityKey
recipientId:(NSString *)recipientId
sendSyncMessage:(BOOL)sendSyncMessage;
isUserInitiatedChange:(BOOL)isUserInitiatedChange;
- (OWSVerificationState)verificationStateForRecipientId:(NSString *)recipientId;

@ -205,7 +205,7 @@ NSString *const kNSNotificationName_IdentityStateDidChange = @"kNSNotificationNa
- (void)setVerificationState:(OWSVerificationState)verificationState
identityKey:(NSData *)identityKey
recipientId:(NSString *)recipientId
sendSyncMessage:(BOOL)sendSyncMessage
isUserInitiatedChange:(BOOL)isUserInitiatedChange
{
OWSAssert(identityKey.length > 0);
OWSAssert(recipientId.length > 0);
@ -235,7 +235,7 @@ NSString *const kNSNotificationName_IdentityStateDidChange = @"kNSNotificationNa
[recipientIdentity updateWithVerificationState:verificationState];
if (sendSyncMessage) {
if (isUserInitiatedChange) {
[self enqueueSyncMessageForVerificationState:verificationState
identityKey:identityKey
recipientId:recipientId];

@ -159,7 +159,6 @@ NSUInteger const OWSSendMessageOperationMaxRetries = 4;
@property (nonatomic, readonly) void (^failureHandler)(NSError *_Nonnull error);
@property (nonatomic) OWSSendMessageOperationState operationState;
@property (nonatomic) UIBackgroundTaskIdentifier backgroundTaskIdentifier;
@property (nonatomic) BOOL hasCompleted;
@end
@ -191,18 +190,17 @@ NSUInteger const OWSSendMessageOperationMaxRetries = 4;
return;
}
// Ensure we call the success or failure handler exactly once.
@synchronized(strongSelf)
{
OWSCAssert(!strongSelf.hasCompleted);
strongSelf.hasCompleted = YES;
}
[message updateWithMessageState:TSOutgoingMessageStateSentToService];
DDLogDebug(@"%@ succeeded.", strongSelf.tag);
aSuccessHandler();
[strongSelf markAsComplete];
// Ensure we call the success or failure handler exactly once.
@synchronized(strongSelf)
{
OWSCAssert(strongSelf.operationState != OWSSendMessageOperationStateFinished);
[strongSelf markAsComplete];
}
};
_failureHandler = ^(NSError *_Nonnull error) {
@ -212,18 +210,17 @@ NSUInteger const OWSSendMessageOperationMaxRetries = 4;
return;
}
// Ensure we call the success or failure handler exactly once.
@synchronized(strongSelf)
{
OWSCAssert(!strongSelf.hasCompleted);
strongSelf.hasCompleted = YES;
}
[strongSelf.message updateWithSendingError:error];
DDLogDebug(@"%@ failed with error: %@", strongSelf.tag, error);
aFailureHandler(error);
[strongSelf markAsComplete];
// Ensure we call the success or failure handler exactly once.
@synchronized(strongSelf)
{
OWSCAssert(strongSelf.operationState != OWSSendMessageOperationStateFinished);
[strongSelf markAsComplete];
}
};
return self;

@ -102,8 +102,6 @@ NSUInteger TSCallCurrentSchemaVersion = 1;
[self touchThreadWithTransaction:transaction];
// Ignore sendReadReceipt and updateExpiration; they don't apply to calls.
//
// TODO: Should we update expiration of calls?
}
#pragma mark - Methods

Loading…
Cancel
Save