瀏覽代碼

不在群组弹窗

Steven 1 年之前
父節點
當前提交
2e9a451fc7

+ 20 - 9
KulexiuForTeacher/KulexiuForTeacher/Module/Chat/Controller/KSGroupConversationController.m

@@ -7,10 +7,13 @@
 
 #import "KSGroupConversationController.h"
 #import "GroupSettingViewController.h"
-
+#import "KSPublicAlertView.h"
 @interface KSGroupConversationController ()
+
 @property (nonatomic, strong) KSTXGroupChatViewController *vc;
 
+@property (nonatomic, strong) KSPublicAlertView *alertView;
+
 @end
 
 @implementation KSGroupConversationController
@@ -77,20 +80,28 @@
             [self allocTitle:groupName];
         }
         else if ([dic ks_integerValueForKey:@"code"] == 204) {
-//            // 弹窗提示是否删除群组
-//            MJWeakSelf;
-//            self.alertView = [KSPublicAlertView shareInstanceWithTitle:@"提示" descMessage:@"当前群组已被解散,是否删除聊天记录?" leftTitle:@"取消" rightTitle:@"确定" cancelAction:^{
-//
-//            } sureAction:^{
-//                [weakSelf removeNoExistGroup];
-//            }];
+            // 弹窗提示是否删除群组
+            MJWeakSelf;
+            self.alertView = [KSPublicAlertView shareInstanceWithTitle:@"提示" descMessage:MESSAGEKEY leftTitle:@"取消" rightTitle:@"确定" cancelAction:^{
+
+            } sureAction:^{
+                [weakSelf removeCurrentConversation];
+            }];
         }
         } faliure:^(NSError * _Nonnull error) {
             
         }];
 }
 
-#pragma mark ----- delegate
+- (void)removeCurrentConversation {
+    MJWeakSelf;
+    NSString *conversationID = [NSString stringWithFormat:@"group_%@", self.conversation.groupID];
+    [[V2TIMManager sharedInstance] deleteConversation:conversationID
+                                                 succ:^{
+        [weakSelf.navigationController popViewControllerAnimated:YES];
+    }
+                                                 fail:nil];
+}
 
 
 /*

+ 9 - 6
KulexiuForTeacher/KulexiuForTeacher/Module/Chat/Group/Controller/GroupSettingViewController.m

@@ -100,11 +100,16 @@
             self.sourceModel = [[GroupListModel alloc] initWithDictionary:subDic];
             [self refreshUI];
         }
+        else if ([dic ks_integerValueForKey:@"code"] == 204) {
+            [LOADING_MANAGER KSShowMsg:@"获取群信息失败" promptCompletion:^{
+                [self backAction];
+            }];
+        }
         else {
             [LOADING_MANAGER MBShowAUTOHidingInWindow:MESSAGEKEY];
         }
         [self getGroupStudent];
-
+        
     } faliure:^(NSError * _Nonnull error) {
         [self getGroupStudent];
     }];
@@ -131,7 +136,7 @@
 
 - (void)getGroupMessageNotiferStatus {
     [[V2TIMManager sharedInstance] getGroupsInfo:@[self.groupId] succ:^(NSArray<V2TIMGroupInfoResult *> * groupResultList) {
-        for (V2TIMGroupInfoResult *result in groupResultList){
+        for (V2TIMGroupInfoResult *result in groupResultList) {
             V2TIMGroupInfo *info = result.info;
             NSLog(@"recvOpt, %d", (int)info.recvOpt);
             if (info.recvOpt == V2TIM_RECEIVE_MESSAGE) {
@@ -143,9 +148,7 @@
         }
     } fail:^(int code, NSString *desc) {
         NSLog(@"failure, code:%d, desc:%@", code, desc);
-        [LOADING_MANAGER KSShowMsg:@"获取群信息失败" promptCompletion:^{
-            [self backAction];
-        }];
+        
     }];
 }
 
@@ -277,7 +280,7 @@
         if ([dic ks_integerValueForKey:@"code"] == 200 && [dic ks_boolValueForKey:@"status"]) {
             
             [LOADING_MANAGER KSShowMsg:@"群已解散" promptCompletion:^{
-//                [self removeCurrentConversation];
+                [self removeCurrentConversation];
                 [self.navigationController popToRootViewControllerAnimated:YES];
             }];
         }