|
@@ -11,8 +11,6 @@
|
|
|
#import "KSUpdateAlert.h"
|
|
|
#import "KSNetworkAccessibleManager.h"
|
|
|
#import <Bugly/Bugly.h>
|
|
|
-#import <RongIMLib/RongIMLib.h>
|
|
|
-#import <RongIMKit/RongIMKit.h>
|
|
|
#import <UMCommon/UMCommon.h>
|
|
|
#import <UMShare/UMShare.h>
|
|
|
#import <UShareUI/UShareUI.h>
|
|
@@ -27,9 +25,6 @@
|
|
|
#import "KSTouchCapturingWindow.h"
|
|
|
#import "KSBaseWKWebViewController.h"
|
|
|
#import "UserInfoManager.h"
|
|
|
-#import "KSIMService.h"
|
|
|
-#import "RCConnectionManager.h"
|
|
|
-#import "KSRCIMDataSource.h"
|
|
|
|
|
|
#import "KSBaseWKWebViewController.h"
|
|
|
#import "CustomNavViewController.h"
|
|
@@ -42,21 +37,12 @@
|
|
|
#import "MyMusicViewController.h"
|
|
|
#import "LaunchAnimationViewController.h"
|
|
|
|
|
|
-@interface RCNaviDataInfo : NSObject
|
|
|
+#import "TXIMLinsenter.h"
|
|
|
+#import <TUICore/TUIConfig.h>
|
|
|
+#import <TUIChat/TUIChat.h>
|
|
|
|
|
|
-@property (nonatomic, assign) NSTimeInterval uploadVideoDurationLimit;
|
|
|
|
|
|
-@end
|
|
|
-
|
|
|
-@interface RCNaviDataManager : NSObject
|
|
|
-
|
|
|
-@property (nonatomic, strong) RCNaviDataInfo *naviData;
|
|
|
-
|
|
|
-+ (instancetype)sharedInstance;
|
|
|
-
|
|
|
-@end
|
|
|
-
|
|
|
-@interface AppDelegate ()<RCIMReceiveMessageDelegate,JPUSHRegisterDelegate>
|
|
|
+@interface AppDelegate ()<JPUSHRegisterDelegate>
|
|
|
|
|
|
@property (nonatomic, assign) BOOL isNeedUpdate;
|
|
|
|
|
@@ -103,7 +89,7 @@
|
|
|
}
|
|
|
self.window = [[KSTouchCapturingWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
|
|
|
|
|
|
- [[UITabBar appearance] setTranslucent:NO];
|
|
|
+// [[UITabBar appearance] setTranslucent:NO];
|
|
|
// 全局配置光标颜色
|
|
|
[[UITextField appearance] setTintColor:THEMECOLOR];
|
|
|
[[UITextView appearance] setTintColor:THEMECOLOR];
|
|
@@ -111,7 +97,11 @@
|
|
|
// 配置极光推送
|
|
|
[self configJPUSHWithLaunchOptions:launchOptions];
|
|
|
// 融云相关配置
|
|
|
- [self configIM];
|
|
|
+// [self configIM];
|
|
|
+
|
|
|
+ // 腾讯群相关
|
|
|
+ [self configTXIM];
|
|
|
+
|
|
|
LaunchAnimationViewController *animationVC = [[LaunchAnimationViewController alloc] init];
|
|
|
MJWeakSelf;
|
|
|
[animationVC launchAnimationFinish:^{
|
|
@@ -179,13 +169,7 @@
|
|
|
}
|
|
|
|
|
|
- (void)displayUnreadMessageCount {
|
|
|
- int unreadMsgCount = [[RCIMClient sharedRCIMClient] getUnreadCount:@[ @(ConversationType_PRIVATE),@(ConversationType_APPSERVICE), @(ConversationType_GROUP),@(ConversationType_SYSTEM)
|
|
|
- ]];
|
|
|
- if (unreadMsgCount >= 1) {
|
|
|
- [self.tabBarController noteNewsWithIndex:2 count:unreadMsgCount];
|
|
|
- } else {
|
|
|
- [self.tabBarController clearNewsWithIndex:2];
|
|
|
- }
|
|
|
+ [self countUnreadMessage];
|
|
|
}
|
|
|
|
|
|
- (void)registerSDK {
|
|
@@ -230,7 +214,6 @@
|
|
|
|
|
|
// 自定义分享类型
|
|
|
[UMSocialUIManager addCustomPlatformWithoutFilted:UMSocialPlatformType_UserDefine_Begin+1 withPlatformIcon:[UIImage imageNamed:@"share_group"] withPlatformName:@"群聊"];
|
|
|
-// [UMSocialUIManager addCustomPlatformWithoutFilted:UMSocialPlatformType_UserDefine_Begin+2 withPlatformIcon:[UIImage imageNamed:@"share_savePic"] withPlatformName:@"保存图片"];
|
|
|
}
|
|
|
|
|
|
- (void)versionCheck {
|
|
@@ -290,67 +273,87 @@
|
|
|
}
|
|
|
|
|
|
- (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")];
|
|
|
+// [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];
|
|
|
|
|
|
- // [[RCIMClient sharedRCIMClient] setLogLevel:RC_Log_Level_Verbose];
|
|
|
- // [self redirectNSlogToDocumentFolder];
|
|
|
+}
|
|
|
+
|
|
|
+- (void)configTXIM {
|
|
|
+ TUIConfig *config = [TUIConfig defaultConfig];
|
|
|
+ // 修改默认头像
|
|
|
+ config.defaultAvatarImage = [UIImage imageNamed:USERDEFAULT_LOGO];
|
|
|
+ // 修改默认群组头像
|
|
|
+ config.defaultGroupAvatarImage = [UIImage imageNamed:GROUP_DEFAULT_LOGO];
|
|
|
+ // 禁用群组九宫格头像
|
|
|
+ config.avatarType = TAvatarTypeRadiusCorner;
|
|
|
+ config.enableGroupGridAvatar = NO;
|
|
|
+ config.avatarCornerRadius = 4.0f;
|
|
|
+ // 关闭toaset
|
|
|
+ config.enableToast = NO;
|
|
|
|
|
|
+ TUIChatConfig *chatConfig = [TUIChatConfig defaultConfig];
|
|
|
+ chatConfig.backgroudColor = HexRGB(0xF8F8F8);
|
|
|
+ chatConfig.enableWelcomeCustomMessage = NO;
|
|
|
+ chatConfig.enableTypingStatus = YES;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
#pragma mark - private method
|
|
@@ -407,8 +410,27 @@ didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
|
|
|
|
|
|
// 融云
|
|
|
[[RCIMClient sharedRCIMClient] setDeviceTokenData:deviceToken];
|
|
|
+
|
|
|
+ if ([TXIM_LINSENTER isCurrentUserLoginIM]) {
|
|
|
+ [self registerTXIMDeviceToken:deviceToken];
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ self.deviceToken = deviceToken;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+- (void)registerTXIMDeviceToken:(NSData *)deviceToken {
|
|
|
+ if (deviceToken) {
|
|
|
+ V2TIMAPNSConfig *config = [[V2TIMAPNSConfig alloc] init];
|
|
|
+ config.businessID = TXOfflinePushCertificateIDForAPNS;
|
|
|
+ config.token = deviceToken;
|
|
|
+ [[V2TIMManager sharedInstance] setAPNS:config succ:^{
|
|
|
+ NSLog(@"%s, succ", __func__);
|
|
|
+ } fail:^(int code, NSString *desc) {
|
|
|
+ NSLog(@"%s, fail, %d, %@", __func__, code, desc);
|
|
|
+ }];
|
|
|
+ }
|
|
|
+}
|
|
|
|
|
|
|
|
|
|
|
@@ -492,7 +514,7 @@ didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
|
|
|
if (status == ConnectionStatus_Unconnected) { // 连接失败或未连接 需要重新连接
|
|
|
NSString *token = UserDefault(TokenKey);
|
|
|
if (![NSString isEmptyString:token]) {
|
|
|
- [USER_MANAGER checkTokenEnableConnectRongCloud];
|
|
|
+ [USER_MANAGER checkTokenEnableConnectIM];
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -510,42 +532,6 @@ didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
|
|
|
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
|
|
|
}
|
|
|
|
|
|
-- (void)onRCIMReceiveMessage:(RCMessage *)message left:(int)left {
|
|
|
-
|
|
|
- NSLog(@"conversationType----%lu",(unsigned long)message.conversationType);
|
|
|
- // 此处根据消息类型处理对应信息
|
|
|
- if (message.conversationType == ConversationType_CHATROOM) { // 聊天室类型为直播
|
|
|
- [[KSIMService sharedService] ksOnReceivedChatroom:message left:left object:@""];
|
|
|
- }
|
|
|
- if (message.conversationType == ConversationType_GROUP && ![message.targetId containsString:@"COURSE"] && ![message.targetId containsString:@"FAN"]) { // 网络教室视频聊天
|
|
|
- [[RCIMClient sharedRCIMClient] clearMessagesUnreadStatus:ConversationType_GROUP targetId:message.targetId];
|
|
|
- [[KSIMService sharedService] ksOnReceived:message left:left object:@""];
|
|
|
- }
|
|
|
- else {
|
|
|
- // 此处对单聊、群聊消息处理
|
|
|
- dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
-
|
|
|
- if ([message.content isMemberOfClass:[RCGroupNotificationMessage class]]) {
|
|
|
- RCGroupNotificationMessage *msg = (RCGroupNotificationMessage *)message.content;
|
|
|
- if ([msg.operation isEqualToString:GroupNotificationMessage_GroupOperationKicked]) {
|
|
|
- // [[RCIMClient sharedRCIMClient] removeConversation:ConversationType_GROUP targetId:message.targetId];
|
|
|
- }
|
|
|
- }
|
|
|
- else {
|
|
|
- int unreadMsgCount = [[RCIMClient sharedRCIMClient] getUnreadCount:@[
|
|
|
- @(ConversationType_PRIVATE), @(ConversationType_APPSERVICE), @(ConversationType_GROUP),@(ConversationType_SYSTEM)
|
|
|
- ]];
|
|
|
- [UIApplication sharedApplication].applicationIconBadgeNumber = unreadMsgCount;
|
|
|
- if (unreadMsgCount >= 1) {
|
|
|
- [self.tabBarController noteNewsWithIndex:2 count:unreadMsgCount];
|
|
|
- } else {
|
|
|
- [self.tabBarController clearNewsWithIndex:2];
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
-}
|
|
|
|
|
|
|
|
|
#pragma mark- JPUSHRegisterDelegate
|
|
@@ -776,9 +762,9 @@ didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
|
|
|
if ([dic ks_integerValueForKey:@"code"] == 200 && [dic ks_boolValueForKey:@"status"]) {
|
|
|
NSString *newToken = [dic ks_stringValueForKey:@"data"];
|
|
|
if (![NSString isEmptyString:newToken]) {
|
|
|
- UserDefaultSet(newToken, RongTokenKey);
|
|
|
+ UserDefaultSet(newToken, IM_TOKEN);
|
|
|
[[NSUserDefaults standardUserDefaults] synchronize];
|
|
|
- [USER_MANAGER checkTokenEnableConnectRongCloud];
|
|
|
+ [USER_MANAGER checkTokenEnableConnectIM];
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
@@ -796,16 +782,10 @@ didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
|
|
|
|
|
|
self.tabBarController = [[KSTabBarViewController alloc] init];
|
|
|
self.window.rootViewController = self.tabBarController;
|
|
|
- int unreadMsgCount = [[RCIMClient sharedRCIMClient] getUnreadCount:@[ @(ConversationType_PRIVATE),@(ConversationType_APPSERVICE), @(ConversationType_GROUP),@(ConversationType_SYSTEM)
|
|
|
- ]];
|
|
|
- if (unreadMsgCount >= 1) {
|
|
|
- [self.tabBarController noteNewsWithIndex:2 count:unreadMsgCount];
|
|
|
- } else {
|
|
|
- [self.tabBarController clearNewsWithIndex:2];
|
|
|
- }
|
|
|
|
|
|
[[UITabBar appearance] setBackgroundImage:[[UIImage alloc] init]];
|
|
|
[[UITabBar appearance] setShadowImage:[[UIImage alloc] init]];
|
|
|
+ [self countUnreadMessage];
|
|
|
}
|
|
|
|
|
|
- (void)initLoginView {
|
|
@@ -814,36 +794,8 @@ didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
|
|
|
self.window.rootViewController = navCtrl;
|
|
|
}
|
|
|
|
|
|
-- (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.
|
|
|
-
|
|
|
- RCConnectionStatus status = [[RCIMClient sharedRCIMClient] getConnectionStatus];
|
|
|
- if (status != ConnectionStatus_SignOut) {
|
|
|
- int unreadMsgCount = [[RCIMClient sharedRCIMClient] getUnreadCount:@[@(ConversationType_PRIVATE), @(ConversationType_APPSERVICE), @(ConversationType_GROUP),@(ConversationType_SYSTEM)]];
|
|
|
- application.applicationIconBadgeNumber = unreadMsgCount;
|
|
|
- if (unreadMsgCount >= 1) {
|
|
|
- [self.tabBarController noteNewsWithIndex:2 count:unreadMsgCount];
|
|
|
- } else {
|
|
|
- [self.tabBarController clearNewsWithIndex:2];
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
|
|
|
-- (void)didReceiveMessageNotification:(NSNotification *)notification {
|
|
|
- NSNumber *left = [notification.userInfo objectForKey:@"left"];
|
|
|
- if ([RCIMClient sharedRCIMClient].sdkRunningMode == RCSDKRunningMode_Background && 0 == left.integerValue) {
|
|
|
- int unreadMsgCount = [[RCIMClient sharedRCIMClient] getUnreadCount:@[@(ConversationType_PRIVATE), @(ConversationType_APPSERVICE), @(ConversationType_GROUP),@(ConversationType_SYSTEM)]];
|
|
|
- dispatch_async(dispatch_get_main_queue(),^{
|
|
|
- [UIApplication sharedApplication].applicationIconBadgeNumber = unreadMsgCount;
|
|
|
- if (unreadMsgCount >= 1) {
|
|
|
- [self.tabBarController noteNewsWithIndex:2 count:unreadMsgCount];
|
|
|
- } else {
|
|
|
- [self.tabBarController clearNewsWithIndex:2];
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
-}
|
|
|
+
|
|
|
- (BOOL)handleOutLink:(NSURL *)url {
|
|
|
NSString *detailUrl = [url absoluteString];
|
|
|
if ([detailUrl containsString:@"linkUrl="]) {
|
|
@@ -1048,6 +1000,27 @@ didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
|
|
|
}
|
|
|
self.outLinkParm = nil;
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
+
|
|
|
+// 统计消息数量
|
|
|
+- (void)countUnreadMessage {
|
|
|
+ if ([TXIM_LINSENTER isCurrentUserLoginIM]) {
|
|
|
+ [TXIM_LINSENTER getUnReadCountCallback:^(NSInteger count) {
|
|
|
+ dispatch_async(dispatch_get_main_queue(),^{
|
|
|
+ NSLog(@"----- %zd",count);
|
|
|
+ [UIApplication sharedApplication].applicationIconBadgeNumber = count;
|
|
|
+ if (count >= 1) {
|
|
|
+ [self.tabBarController noteNewsWithIndex:2 count:count];
|
|
|
+ } else {
|
|
|
+ [self.tabBarController clearNewsWithIndex:2];
|
|
|
+ }
|
|
|
+
|
|
|
+ NSDictionary *receiveMsg = @{@"unreadCount":@(count)};
|
|
|
+
|
|
|
+ [[NSNotificationCenter defaultCenter] postNotificationName:CHATVIEW_REFRESHSTATUS object:receiveMsg];
|
|
|
+ });
|
|
|
+ }];
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
@end
|