keep enhancing chat room management

This commit is contained in:
Benjamin Reis 2017-11-30 10:54:25 +01:00
parent 539f68fa1f
commit 838ed67037
6 changed files with 15 additions and 7 deletions

View file

@ -173,7 +173,7 @@
if (cell == nil)
cell = [[NSClassFromString(kCellId) alloc] initWithIdentifier:kCellId];
[cell setChatMessage:chat];
[cell setEvent:event];
if (chat)
[cell update];

View file

@ -675,7 +675,7 @@ didInvalidatePushTokenForType:(NSString *)type {
objectForKey:@"from_addr"];
[LinphoneManager.instance send:replyText to:from_address];
} else if ([response.actionIdentifier isEqual:@"Seen"]) {
NSString *from = [response.notification.request.content.userInfo objectForKey:@"chat_room_address"];
NSString *from = [response.notification.request.content.userInfo objectForKey:@"from_addr"];
LinphoneChatRoom *room = linphone_core_get_chat_room_from_uri(LC, [from UTF8String]);
if (room) {
linphone_chat_room_mark_as_read(room);
@ -844,7 +844,7 @@ didInvalidatePushTokenForType:(NSString *)type {
// use the standard handler
[PhoneMainView.instance changeCurrentView:ChatsListView.compositeViewDescription];
} else if ([identifier isEqualToString:@"mark_read"]) {
NSString *from = [notification.userInfo objectForKey:@"chat_room_address"];
NSString *from = [notification.userInfo objectForKey:@"from_addr"];
LinphoneChatRoom *room = linphone_core_get_chat_room_from_uri(LC, [from UTF8String]);
if (room) {
if ([UIApplication sharedApplication].applicationState == UIApplicationStateActive)

View file

@ -35,6 +35,7 @@
@property(weak, nonatomic) IBOutlet UIView *totalView;
@property(strong, nonatomic) IBOutlet UITapGestureRecognizer *imageGestureRecognizer;
- (void)setEvent:(LinphoneEventLog *)event;
- (void)setChatMessage:(LinphoneChatMessage *)message;
- (void)connectToFileDelegate:(FileTransferDelegate *)ftd;
- (IBAction)onDownloadClick:(id)event;

View file

@ -51,6 +51,12 @@
}
#pragma mark -
- (void)setEvent:(LinphoneEventLog *)event {
if (!event || !(linphone_event_log_get_type(event) == LinphoneEventLogTypeConferenceChatMessage))
return;
[self setChatMessage:linphone_event_log_get_chat_message(event)];
}
- (void)setChatMessage:(LinphoneChatMessage *)amessage {
_imageGestureRecognizer.enabled = NO;

View file

@ -44,6 +44,7 @@
}
- (void)dealloc {
[self setEvent:NULL];
[self setChatMessage:NULL];
}
@ -79,7 +80,7 @@
linphone_chat_message_set_user_data(_message, (void *)CFBridgingRetain(self));
LinphoneChatMessageCbs *cbs = linphone_chat_message_get_callbacks(_message);
linphone_chat_message_cbs_set_msg_state_changed(cbs, message_status);
linphone_chat_message_cbs_set_user_data(cbs, (__bridge void *)self);
linphone_chat_message_cbs_set_user_data(cbs, (void *)_event);
}
}
@ -263,9 +264,9 @@
#pragma mark - State changed handling
static void message_status(LinphoneChatMessage *msg, LinphoneChatMessageState state) {
LOGI(@"State for message [%p] changed to %s", msg, linphone_chat_message_state_to_string(state));
UIChatBubbleTextCell *data = (__bridge UIChatBubbleTextCell *)linphone_chat_message_cbs_get_user_data(linphone_chat_message_get_callbacks(msg));
LinphoneEventLog *event = (LinphoneEventLog *)linphone_chat_message_cbs_get_user_data(linphone_chat_message_get_callbacks(msg));
ChatConversationView *view = VIEW(ChatConversationView);
[view.tableController updateEventEntry:data.event];
[view.tableController updateEventEntry:event];
}
- (void)displayImdmStatus:(LinphoneChatMessageState)state {

@ -1 +1 @@
Subproject commit cea7ca8bb14a2cf087e6417f5ab49aa45eb04a66
Subproject commit af709ad4c943c735787d2b5acd6b20c5fc4d9667