@@ -62,17 +62,21 @@ -(void)initNotifications {
6262 [[NSNotificationCenter defaultCenter ] removeObserver: self ];
6363
6464 NSNotificationCenter *defaultCenter = [NSNotificationCenter defaultCenter ];
65- // have
6665 [defaultCenter addObserver: self
6766 selector: @selector (didReceiveJMessageMessage: )
6867 name: kJJMessageReceiveMessage
6968 object: nil ];
7069
70+ [defaultCenter addObserver: self
71+ selector: @selector (didReceiveJMessageChatRoomMessage: )
72+ name: kJJMessageReceiveChatRoomMessage
73+ object: nil ];
74+
7175 [defaultCenter addObserver: self
7276 selector: @selector (conversationChanged: )
7377 name: kJJMessageConversationChanged
7478 object: nil ];
75- // have
79+
7680 [defaultCenter addObserver: self
7781 selector: @selector (didSendMessage: )
7882 name: kJJMessageSendMessageRespone
@@ -82,7 +86,7 @@ -(void)initNotifications {
8286// selector:@selector(unreadChanged:)
8387// name:kJJMessageUnreadChanged
8488// object:nil];
85- // have
89+
8690 [defaultCenter addObserver: self
8791 selector: @selector (loginStateChanged: )
8892 name: kJJMessageLoginStateChanged
@@ -399,6 +403,11 @@ - (void)didReceiveJMessageMessage:(NSNotification *)notification {
399403 [self .bridge.eventDispatcher sendAppEventWithName: receiveMsgEvent body: notification.object];
400404}
401405
406+ - (void )didReceiveJMessageChatRoomMessage : (NSNotification *)notification {
407+ [self .bridge.eventDispatcher sendAppEventWithName: receiveChatRoomMsgEvent body: notification.object];
408+ }
409+
410+
402411- (void )conversationChanged : (NSNotification *)notification {
403412 [self .bridge.eventDispatcher sendAppEventWithName: conversationChangeEvent body: notification.object];
404413}
@@ -2416,5 +2425,35 @@ - (JMSGOptionalContent *)convertDicToJMSGOptionalContent:(NSDictionary *)dic {
24162425 }];
24172426}
24182427
2428+ RCT_EXPORT_METHOD (getChatRoomOwner:(NSDictionary *)param
2429+ successCallback:(RCTResponseSenderBlock)successCallback
2430+ failCallBack:(RCTResponseSenderBlock)failCallback) {
2431+ if (!param[@" roomId" ]) {
2432+ failCallback (@[[self getParamError ]]);
2433+ return ;
2434+ }
2435+
2436+ [JMSGChatRoom getChatRoomInfosWithRoomIds: @[param[@" roomId" ]] completionHandler: ^(id resultObject, NSError *error) {
2437+ if (error) {
2438+ failCallback (@[[error errorToDictionary ]]);
2439+ return ;
2440+ }
2441+ NSArray *chatRoomArr = resultObject;
2442+ if (chatRoomArr == nil || chatRoomArr.count == 0 ) {
2443+ failCallback (@[[self getErrorWithLog: @" cann't found chat room from this roomId!" ]]);
2444+ return ;
2445+ }
2446+ JMSGChatRoom *chatRoom = chatRoomArr[0 ];
2447+ [chatRoom getChatRoomOwnerInfo: ^(id resultObject, NSError *error) {
2448+ if (error) {
2449+ failCallback (@[[error errorToDictionary ]]);
2450+ return ;
2451+ }
2452+ JMSGUser *user = resultObject;
2453+ successCallback (@[[user userToDictionary ]]);
2454+ }];
2455+ }];
2456+ }
2457+
24192458
24202459@end
0 commit comments