Skip to content

Commit 6938de4

Browse files
guangyaoguangyao
authored andcommitted
Add 添加好友成功后消息提醒
1 parent 29f64e5 commit 6938de4

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

ios/RNNeteaseIm/RNNeteaseIm/NoticeViewController.m

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ -(void)setAllread{
252252
//同意
253253
-(void)onAccept:(NSString *)targetID timestamp:(NSString *)timestamp sucess:(Success)success error:(Errors)err{
254254

255-
255+
__weak typeof(self)weakSelf = self;
256256
for (int i = 0; i < _notiArr.count; i++) {
257257
if ([targetID isEqualToString:[[_notiArr objectAtIndex:i] objectForKey:@"fromAccount"]]) {
258258
if ([timestamp isEqualToString:[[_notiArr objectAtIndex:i] objectForKey:@"time"]]) {
@@ -320,6 +320,7 @@ -(void)onAccept:(NSString *)targetID timestamp:(NSString *)timestamp sucess:(Suc
320320
[self updateSourceMember:sourceMember andNoti:notices];
321321
}
322322
success(@"同意成功");
323+
[weakSelf sendMakeFriendSucessMessgae:request.userId];
323324
[self refrash];
324325
}
325326
else
@@ -340,6 +341,21 @@ -(void)onAccept:(NSString *)targetID timestamp:(NSString *)timestamp sucess:(Suc
340341

341342

342343
}
344+
345+
346+
//发送成为好友提醒
347+
- (void)sendMakeFriendSucessMessgae:(NSString *)strUserId{
348+
NIMMessage *message = [[NIMMessage alloc] init];
349+
message.text = @"我们已经是朋友啦,一起来聊天吧!";
350+
NIMMessageSetting *setting = [[NIMMessageSetting alloc]init];
351+
setting.apnsEnabled = NO;
352+
message.setting = setting;
353+
NIMSession *session = [NIMSession session:strUserId type:NIMSessionTypeP2P];
354+
//发送消息
355+
[[NIMSDK sharedSDK].chatManager sendMessage:message toSession:session error:nil];
356+
}
357+
358+
343359
//拒绝
344360
-(void)onRefuse:(NSString *)targetID timestamp:(NSString *)timestamp sucess:(Success)success error:(Errors)err{
345361
for (int i = 0; i < _notiArr.count; i++) {

0 commit comments

Comments
 (0)