Steven 1 سال پیش
والد
کامیت
8c3620f910

+ 21 - 112
KulexiuForTeacher/KulexiuForTeacher/AppDelegate.m

@@ -96,8 +96,7 @@
     
     // 配置极光推送
     [self configJPUSHWithLaunchOptions:launchOptions];
-    // 融云相关配置
-//    [self configIM];
+
     
      // 腾讯群相关
     [self configTXIM];
@@ -276,69 +275,6 @@
             advertisingIdentifier:nil];
 }
 
-- (void)configIM {
-//    [RCNaviDataManager sharedInstance].naviData.uploadVideoDurationLimit = 480.0f;
-//    // 6tnym1br6pv07 正式环境key   c9kqb3rdc451j test
-//    [[RCIM sharedRCIM] initWithAppKey:RCIM_KEY];
-//
-//    //IMKit连接状态的监听器
-//    [[RCIM sharedRCIM] setConnectionStatusDelegate:KSRMLINK];
-//    //IMKit消息接收的监听器
-//    [[RCIM sharedRCIM] setReceiveMessageDelegate:self];
-//    // 信息提供者
-//    [RCIM sharedRCIM].userInfoDataSource = KSRMDataSource;
-//    [[RCIM sharedRCIM] setGroupInfoDataSource:KSRMDataSource];
-//    // 群名片信息提供者
-//    [[RCIM sharedRCIM] setGroupUserInfoDataSource:KSRMDataSource];
-//    // 群成员数据源
-//    [RCIM sharedRCIM].groupMemberDataSource = KSRMDataSource;
-//
-//    //开启消息@功能(只支持群聊和讨论组, App需要实现群成员数据源groupMemberDataSource)
-//    RCKitConfigCenter.message.enableMessageMentioned = YES;
-//    //是否关闭本地通知,默认是打开的
-//    RCKitConfigCenter.message.disableMessageNotificaiton = NO;
-//    // 会话界面设置
-//    RCKitConfigCenter.ui.globalMessageAvatarStyle = RC_USER_AVATAR_RECTANGLE;
-//    RCKitConfigCenter.ui.globalMessagePortraitSize = CGSizeMake(40, 40);
-//    // 会话列表头像设置
-//    RCKitConfigCenter.ui.globalConversationAvatarStyle = RC_USER_AVATAR_RECTANGLE;
-//    RCKitConfigCenter.ui.globalConversationPortraitSize = CGSizeMake(44, 44);
-//
-//    //开启消息撤回功能
-//    RCKitConfigCenter.message.enableMessageRecall = YES;
-//    // 开启消息合并转发
-//    RCKitConfigCenter.message.enableSendCombineMessage = YES;
-//    //选择媒体资源时,包含视频文件
-//    RCKitConfigCenter.message.isMediaSelectorContainVideo = YES;
-//    //设置显示未注册的消息
-//    RCKitConfigCenter.message.showUnkownMessage = YES;
-//
-//    //开启发送已读回执
-//    RCKitConfigCenter.message.enabledReadReceiptConversationTypeList = @[ @(ConversationType_PRIVATE), @(ConversationType_GROUP)];
-//
-//    //开启输入状态监听
-//    RCKitConfigCenter.message.enableTypingStatus = YES;
-//
-//    //开启用户信息和群组信息的持久化
-//    [RCIM sharedRCIM].enablePersistentUserInfoCache = YES;
-//    // 在发送的所有消息中携带当前登录的用户信息
-//    [RCIM sharedRCIM].enableMessageAttachUserInfo = YES;
-//    // 关闭所有提示音
-//    RCKitConfigCenter.message.disableMessageAlertSound = YES;
-//
-//    // 设置断线重连时是否踢出重连设备
-//        [[RCIMClient sharedRCIMClient] setReconnectKickEnable:YES];
-//
-//    // 左右上角按钮颜色
-//    RCKitConfigCenter.ui.globalNavigationBarTintColor = HexRGB(0x000000);
-//    // 注册消息
-//    [[RCIM sharedRCIM] registerMessageType:NSClassFromString(@"KSChatLiveMessage")];
-//    [[RCIM sharedRCIM] registerMessageType:NSClassFromString(@"KSChatMusicMessage")];
-//
-//    //    [[RCIMClient sharedRCIMClient] setLogLevel:RC_Log_Level_Verbose];
-//    //    [self redirectNSlogToDocumentFolder];
-    
-}
 
 - (void)configTXIM {
     TUIConfig *config = [TUIConfig defaultConfig];
@@ -412,9 +348,6 @@ didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
     /// Required - 注册 DeviceToken
     [JPUSHService registerDeviceToken:deviceToken];
     
-    // 融云
-    [[RCIMClient sharedRCIMClient] setDeviceTokenData:deviceToken];
-    
     if ([TXIM_LINSENTER isCurrentUserLoginIM]) {
         [self registerTXIMDeviceToken:deviceToken];
     }
@@ -439,25 +372,8 @@ didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
 
 
 - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
-    /**
-     * 获取融云推送服务扩展字段2
-     */
-    NSDictionary *pushServiceData = [[RCIMClient sharedRCIMClient] getPushExtraFromRemoteNotification:userInfo];
-    if (pushServiceData) {
-        NSLog(@"该远程推送包含来自融云的推送服务");
-        /**
-         * 统计推送打开率2
-         */
-        [[RCIMClient sharedRCIMClient] recordRemoteNotificationEvent:userInfo];
-        
-        for (id key in [pushServiceData allKeys]) {
-            NSLog(@"key = %@, value = %@", key, pushServiceData[key]);
-        }
-    } else {
-        NSLog(@"该远程推送不包含来自融云的推送服务");
-        // 极光推送
-        [JPUSHService handleRemoteNotification:userInfo];
-    }
+    // 极光推送
+    [JPUSHService handleRemoteNotification:userInfo];
 }
 
 /**
@@ -468,27 +384,20 @@ didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
 #pragma clang diagnostic ignored "-Wdeprecated-implementations"
 - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
     
-    /**
-     * 获取融云推送服务扩展字段2
-     */
-    NSDictionary *pushServiceData = [[RCIMClient sharedRCIMClient] getPushExtraFromRemoteNotification:userInfo];
-    if (pushServiceData) {
-        NSLog(@"该远程推送包含来自融云的推送服务");
-        for (id key in [pushServiceData allKeys]) {
-            /**
-             * 统计推送打开率2
-             */
-            [[RCIMClient sharedRCIMClient] recordRemoteNotificationEvent:userInfo];
-            NSLog(@"key = %@, value = %@", key, pushServiceData[key]);
-        }
-    } else {
-        NSLog(@"该远程推送不包含来自融云的推送服务");
-        // 极光推送
-        [JPUSHService handleRemoteNotification:userInfo];
-    }
+    // 极光推送
+    [JPUSHService handleRemoteNotification:userInfo];
 }
 #pragma clang diagnostic pop
 
+
+- (void)applicationWillResignActive:(UIApplication *)application {
+    // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
+    // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
+    
+    [self countUnreadMessage];
+}
+
+
 - (void)applicationDidEnterBackground:(UIApplication *)application {
     // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
     // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
@@ -514,17 +423,17 @@ didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
     if (self.isNeedUpdate) {
         [self versionCheck];
     }
-    RCConnectionStatus status = [[RCIMClient sharedRCIMClient] getConnectionStatus];
-    if (status == ConnectionStatus_Unconnected) {  // 连接失败或未连接 需要重新连接
-        NSString *token = UserDefault(TokenKey);
-        if (![NSString isEmptyString:token]) {
-            [USER_MANAGER checkTokenEnableConnectIM];
-        }
-    }
+    [self checkConnectionStatus];
     
     [[NSNotificationCenter defaultCenter] postNotificationName:@"appBecomeActive" object:nil];
 }
 
+- (void)checkConnectionStatus {
+    BOOL isConnected = [TXIM_LINSENTER isCurrentUserLoginIM];
+    if (isConnected == NO) { // 连接失败或未连接 需要重新连接
+        [USER_MANAGER checkTokenEnableConnectIM];
+    }
+}
 
 - (void)applicationDidBecomeActive:(UIApplication *)application {
     // app启动或者app从后台进入前台都会调用这个方法

+ 0 - 1
KulexiuForTeacher/KulexiuForTeacher/Module/Login/Model/UserInfoManager.h

@@ -7,7 +7,6 @@
 
 #import <Foundation/Foundation.h>
 #import "UserInfo.h"
-#import <RongIMKit/RongIMKit.h>
 
 
 typedef void(^UserInfoCallback)(UserInfo * _Nonnull userInfo);

+ 0 - 12
KulexiuForTeacher/KulexiuForTeacher/Module/Mine/CreateStyle/Controller/MyStyleViewController.m

@@ -746,7 +746,6 @@
             [LOADING_MANAGER MBShowAUTOHidingInWindow:@"修改成功"];
             if (![NSString isEmptyString:imgUrl]) {
                 UserDefaultSetObjectForKey(imgUrl, AvatarUrlKey);
-                [self updateRongCloudUserInfo];
             }
             [self requestUserMessage];
         }
@@ -758,17 +757,6 @@
     }];
 }
 
-- (void)updateRongCloudUserInfo {
-    // 设置个人信息
-    RCUserInfo *currentUserInfo =
-    [[RCUserInfo alloc] initWithUserId:UserDefault(UIDKey) name:UserDefault(NicknameKey) portrait:UserDefault(AvatarUrlKey)];
-    NSMutableDictionary *extraDic = [NSMutableDictionary dictionary];
-    [extraDic setValue:@"TEACHER" forKey:@"role"];
-    currentUserInfo.extra = [extraDic mj_JSONString];
-    [RCIM sharedRCIM].currentUserInfo = currentUserInfo;
-    [[RCIM sharedRCIM] refreshUserInfoCache:currentUserInfo withUserId:UserDefault(UIDKey)];
-}
-
 
 #pragma mark --- RSKImageCropViewControllerDelegate
 

+ 0 - 11
KulexiuForTeacher/KulexiuForTeacher/Module/Mine/Setting/Controller/ModifyNameViewController.m

@@ -120,17 +120,6 @@
     }
 }
 
-- (void)updateRongCloudUserInfo {
-    // 设置个人信息
-    RCUserInfo *currentUserInfo =
-    [[RCUserInfo alloc] initWithUserId:UserDefault(UIDKey) name:UserDefault(NicknameKey) portrait:UserDefault(AvatarUrlKey)];
-    // 附加字段
-    NSMutableDictionary *extraDic = [NSMutableDictionary dictionary];
-    [extraDic setValue:@"TEACHER" forKey:@"role"];
-    currentUserInfo.extra = [extraDic mj_JSONString];
-    [RCIM sharedRCIM].currentUserInfo = currentUserInfo;
-    [[RCIM sharedRCIM] refreshUserInfoCache:currentUserInfo withUserId:UserDefault(UIDKey)];
-}
 
 /*
 #pragma mark - Navigation

+ 0 - 11
KulexiuForTeacher/KulexiuForTeacher/Module/Mine/Setting/Controller/UserSettingViewController.m

@@ -216,7 +216,6 @@
             [LOADING_MANAGER MBShowAUTOHidingInWindow:@"修改成功"];
             if (![NSString isEmptyString:imgUrl]) {
                 UserDefaultSetObjectForKey(imgUrl, AvatarUrlKey);
-                [self updateRongCloudUserInfo];
             }
             
             [self requestUserMessage];
@@ -229,16 +228,6 @@
     }];
 }
 
-- (void)updateRongCloudUserInfo {
-    // 设置个人信息
-    RCUserInfo *currentUserInfo =
-    [[RCUserInfo alloc] initWithUserId:UserDefault(UIDKey) name:UserDefault(NicknameKey) portrait:UserDefault(AvatarUrlKey)];
-    NSMutableDictionary *extraDic = [NSMutableDictionary dictionary];
-    [extraDic setValue:@"TEACHER" forKey:@"role"];
-    currentUserInfo.extra = [extraDic mj_JSONString];
-    [RCIM sharedRCIM].currentUserInfo = currentUserInfo;
-    [[RCIM sharedRCIM] refreshUserInfoCache:currentUserInfo withUserId:UserDefault(UIDKey)];
-}
 
 - (void)showModifySexAlert {
     KSSmallChoosePicker *picker = [[KSSmallChoosePicker alloc] initWithTitle:@"修改性别" sourceData:@[@"男",@"女"] lastChoose:self.lastChooseIndex chooseReturnWithBlock:^(NSString * _Nonnull returnValue, NSInteger chooseIndex) {