Show proper thread from notification

// FREEBIE
pull/1/head
Michael Kirk 8 years ago
parent 36d55fb7a5
commit 344903fa5b

@ -66,8 +66,7 @@ NS_ASSUME_NONNULL_BEGIN
[ThreadUtil addThreadToProfileWhitelistIfEmptyContactThread:thread];
[ThreadUtil sendMessageWithAttachment:self.attachment inThread:thread messageSender:self.messageSender];
[Environment presentConversationForRecipientId:thread.uniqueId];
[Environment presentConversationForThread:thread];
}
- (BOOL)canSelectBlockedContact

@ -3,7 +3,6 @@
//
#import "OWSPreferences.h"
#import "TSGroupModel.h"
#import "TSStorageHeaders.h"
/**
@ -14,6 +13,7 @@
*
**/
@class TSThread;
@class UINavigationController;
@class OWSContactsManager;
@class OutboundCallInitiator;
@ -64,6 +64,7 @@
+ (void)presentConversationForRecipientId:(NSString *)recipientId;
+ (void)presentConversationForRecipientId:(NSString *)recipientId withCompose:(BOOL)compose;
+ (void)callRecipientId:(NSString *)recipientId;
+ (void)presentConversationForThread:(TSGroupThread *)groupThread;
+ (void)presentConversationForThreadId:(NSString *)threadId;
+ (void)presentConversationForThread:(TSThread *)thread;
@end

@ -215,6 +215,19 @@ static Environment *environment = nil;
});
}
+ (void)presentConversationForThreadId:(NSString *)threadId
{
OWSAssert(threadId.length > 0);
TSThread *thread = [TSThread fetchObjectWithUniqueID:threadId];
if (thread == nil) {
OWSFail(@"%@ unable to find thread with id: %@", self.tag, threadId);
return;
}
[self presentConversationForThread:thread];
}
+ (void)presentConversationForThread:(TSThread *)thread
{
[self presentConversationForThread:thread keyboardOnViewAppearing:YES callOnViewAppearing:NO];

@ -135,8 +135,11 @@ NSString *const Signal_Message_MarkAsRead_Identifier = @"Signal_Message_MarkAsRe
DDLogInfo(@"received: %s", __PRETTY_FUNCTION__);
NSString *threadId = notification.userInfo[Signal_Thread_UserInfo_Key];
if (threadId && [TSThread fetchObjectWithUniqueID:threadId]) {
[Environment presentConversationForRecipientId:threadId];
if (threadId) {
[Environment presentConversationForThreadId:threadId];
} else {
OWSFail(@"%@ threadId was unexpectedly nil in %s", self.tag, __PRETTY_FUNCTION__);
}
}
@ -231,12 +234,21 @@ NSString *const Signal_Message_MarkAsRead_Identifier = @"Signal_Message_MarkAsRe
completionHandler();
} else if ([identifier isEqualToString:PushManagerActionsShowThread]) {
NSString *threadId = notification.userInfo[Signal_Thread_UserInfo_Key];
[Environment presentConversationForRecipientId:threadId];
if (threadId) {
[Environment presentConversationForThreadId:threadId];
} else {
OWSFail(@"%@ threadId was unexpectedly nil in action with identifier: %@", self.tag, identifier);
}
completionHandler();
} else {
OWSFail(@"%@ Unhandled action with identifier: %@", self.tag, identifier);
NSString *threadId = notification.userInfo[Signal_Thread_UserInfo_Key];
[Environment presentConversationForRecipientId:threadId];
if (threadId) {
[Environment presentConversationForThreadId:threadId];
} else {
OWSFail(@"%@ threadId was unexpectedly nil in action with identifier: %@", self.tag, identifier);
}
completionHandler();
}
}

Loading…
Cancel
Save