nonblocking SN change notifications don't percolate group threads to the

top unless there is a message in that thread.

Otherwise the user is overwhelmed by a bunch of group threads with
redundant notifications. The notifications will be there if the user
later enters the threads. The affect is that only the thread with the
relevant message will pop to the top.

// FREEBIE
pull/1/head
Michael Kirk 9 years ago
parent 4becd43973
commit fcbfde3874

@ -251,6 +251,19 @@ NS_ASSUME_NONNULL_BEGIN
- (void)updateWithLastMessage:(TSInteraction *)lastMessage transaction:(YapDatabaseReadWriteTransaction *)transaction {
NSDate *lastMessageDate = [lastMessage receiptDateForSorting];
if ([lastMessage isKindOfClass:[TSErrorMessage class]]) {
TSErrorMessage *errorMessage = (TSErrorMessage *)lastMessage;
if (errorMessage.errorType == TSErrorMessageNonBlockingIdentityChange) {
// Otherwise all group threads with the recipient will percolate to the top of the inbox, even though
// there was no meaningful interaction.
DDLogDebug(@"%@ not updating lastMessage for thread:%@ nonblocking identity change: %@",
self.tag,
self,
errorMessage.debugDescription);
return;
}
}
if (!_lastMessageDate || [lastMessageDate timeIntervalSinceDate:self.lastMessageDate] > 0) {
_lastMessageDate = lastMessageDate;

@ -23,7 +23,7 @@ NS_ASSUME_NONNULL_BEGIN
+ (NSString *)threadIdFromGroupId:(NSData *)groupId;
// all group threads conrtaining recipient as a member
// all group threads containing recipient as a member
+ (NSArray<TSGroupThread *> *)groupThreadsWithRecipientId:(NSString *)recipientId;
- (void)updateAvatarWithAttachmentStream:(TSAttachmentStream *)attachmentStream;

@ -84,8 +84,6 @@
- (void)createIdentityChangeInfoMessageForRecipientId:(NSString *)recipientId
{
// TODO But should they be marked as dirty/play an alert? Probably not.
UInt64 nowTimestamp = [NSDate ows_millisecondTimeStamp];
TSContactThread *contactThread = [TSContactThread getOrCreateThreadWithContactId:recipientId];

Loading…
Cancel
Save