File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed
ios/RNNeteaseIm/RNNeteaseIm Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -520,13 +520,33 @@ - (void)onRecvMessages:(NSArray *)messages
520520 completion: nil ];
521521 // 标记已读消息
522522 [[NIMSDK sharedSDK ].conversationManager markAllMessagesReadInSession: _session];
523+ [self playTipsMusicWithMessage: message];
524+ }
525+ }
526+
527+ - (void )playTipsMusicWithMessage : (NIMMessage *)message {
528+ BOOL needToPlay = NO ;
529+ if (message.messageType == 100 ) {
530+ NIMCustomObject *customObject = message.messageObject ;
531+ DWCustomAttachment *obj = customObject.attachment ;
532+ if (obj.custType == CustomMessgeTypeRedPacketOpenMessage) return ;
533+ }
534+ if (message.session .sessionType == NIMSessionTypeP2P) {// 个人
535+ NIMUser *user = [[NIMSDK sharedSDK ].userManager userInfo: message.from];
536+ needToPlay = user.notifyForNewMsg ;
537+
538+ }else if (message.session .sessionType == NIMSessionTypeTeam){// 群
539+
540+ NIMTeam *team = [[[NIMSDK sharedSDK ] teamManager ]teamById:message.session.sessionId];
541+ needToPlay = team.notifyForNewMsg ;
542+ }
543+ if (needToPlay) {
523544 [self .player stop ];
524545 [[AVAudioSession sharedInstance ] setCategory: AVAudioSessionCategoryAmbient error: nil ];
525546 [self .player play ];
526547 }
527548}
528549
529-
530550- (void )fetchMessageAttachment : (NIMMessage *)message progress : (float )progress
531551{
532552 NSLog (@" 下载图片" );
You can’t perform that action at this time.
0 commit comments