接入七鱼SDK

This commit is contained in:
fengshuo
2023-03-09 19:46:22 +08:00
parent 9647ae616f
commit 2870dd9b1b
10 changed files with 89 additions and 20 deletions

View File

@@ -38,7 +38,7 @@ target 'xplan-ios' do
#pop动画 #pop动画
pod 'pop', '~> 1.0.12' pod 'pop', '~> 1.0.12'
#云信 #云信
pod 'NIMSDK_LITE', '~> 9.0.1' pod 'NIMSDK_LITE', '~> 8.9.0'
#下拉刷新控件 #下拉刷新控件
pod 'MJRefresh' pod 'MJRefresh'
#登录的 #登录的
@@ -61,6 +61,7 @@ target 'xplan-ios' do
pod 'IQKeyboardManager', '~> 6.5.5' pod 'IQKeyboardManager', '~> 6.5.5'
pod 'TZImagePickerController' pod 'TZImagePickerController'
pod 'Bugly' pod 'Bugly'
pod 'QY_iOS_SDK', '~> 8.2.0'
#上传音乐 #上传音乐
pod 'CocoaAsyncSocket',:modular_headers => true pod 'CocoaAsyncSocket',:modular_headers => true
#调试 #调试

View File

@@ -48,7 +48,7 @@ PODS:
- mob_sharesdk/ShareSDK - mob_sharesdk/ShareSDK
- MOBFoundation (>= 3.2.9) - MOBFoundation (>= 3.2.9)
- MOBFoundation (3.2.27) - MOBFoundation (3.2.27)
- NIMSDK_LITE (9.0.1) - NIMSDK_LITE (8.9.110)
- NTESBaseComponent (1.4) - NTESBaseComponent (1.4)
- NTESQuickPass (3.2.6): - NTESQuickPass (3.2.6):
- NTESBaseComponent - NTESBaseComponent
@@ -57,6 +57,10 @@ PODS:
- QGVAPlayer (1.0.15) - QGVAPlayer (1.0.15)
- Qiniu (8.3.2): - Qiniu (8.3.2):
- HappyDNS (~> 0.3.17) - HappyDNS (~> 0.3.17)
- QY_iOS_SDK (8.2.0):
- QY_iOS_SDK/Default (= 8.2.0)
- QY_iOS_SDK/Default (8.2.0):
- NIMSDK_LITE (= 8.9.110)
- ReactiveObjC (3.1.1) - ReactiveObjC (3.1.1)
- SDCycleScrollView (1.82): - SDCycleScrollView (1.82):
- SDWebImage (>= 5.0.0) - SDWebImage (>= 5.0.0)
@@ -112,11 +116,12 @@ DEPENDENCIES:
- mob_sharesdk/ShareSDKPlatforms/Apple - mob_sharesdk/ShareSDKPlatforms/Apple
- mob_sharesdk/ShareSDKPlatforms/QQ - mob_sharesdk/ShareSDKPlatforms/QQ
- mob_sharesdk/ShareSDKPlatforms/WeChat - mob_sharesdk/ShareSDKPlatforms/WeChat
- NIMSDK_LITE (~> 9.0.1) - NIMSDK_LITE (~> 8.9.0)
- NTESQuickPass - NTESQuickPass
- pop (~> 1.0.12) - pop (~> 1.0.12)
- QGVAPlayer - QGVAPlayer
- Qiniu - Qiniu
- QY_iOS_SDK (~> 8.2.0)
- ReactiveObjC - ReactiveObjC
- SDCycleScrollView - SDCycleScrollView
- SDWebImage - SDWebImage
@@ -158,6 +163,7 @@ SPEC REPOS:
- Protobuf - Protobuf
- QGVAPlayer - QGVAPlayer
- Qiniu - Qiniu
- QY_iOS_SDK
- ReactiveObjC - ReactiveObjC
- SDCycleScrollView - SDCycleScrollView
- SDWebImage - SDWebImage
@@ -194,13 +200,14 @@ SPEC CHECKSUMS:
MJRefresh: ec9c53ff4abf3a9237b4283862f1bd51c2ee3fdb MJRefresh: ec9c53ff4abf3a9237b4283862f1bd51c2ee3fdb
mob_sharesdk: a60006891a079486ff3269ed326adfa05a967c01 mob_sharesdk: a60006891a079486ff3269ed326adfa05a967c01
MOBFoundation: efdc3ce6b843fbc10ae8c1c6122a02b0d845b39b MOBFoundation: efdc3ce6b843fbc10ae8c1c6122a02b0d845b39b
NIMSDK_LITE: c376a3f90c1cd79d9cca39fbdeb6a718e99e244a NIMSDK_LITE: 299ff39677d705b91413d14ad352b32a1b0e72fe
NTESBaseComponent: 9e97373eec7e5a26c39db26477bf99a37ee9e71a NTESBaseComponent: 9e97373eec7e5a26c39db26477bf99a37ee9e71a
NTESQuickPass: 781bd12ee63681389fe9b646c837fa76e3a00e6e NTESQuickPass: 781bd12ee63681389fe9b646c837fa76e3a00e6e
pop: d582054913807fd11fd50bfe6a539d91c7e1a55a pop: d582054913807fd11fd50bfe6a539d91c7e1a55a
Protobuf: 3724efa50cb2846d7ccebc8691c574e85fd74471 Protobuf: 3724efa50cb2846d7ccebc8691c574e85fd74471
QGVAPlayer: 002673a02b4e50f9f53d0673b87168b540a300ae QGVAPlayer: 002673a02b4e50f9f53d0673b87168b540a300ae
Qiniu: 61f1e2fdfb35b37f98c8f03a718faf12652f9994 Qiniu: 61f1e2fdfb35b37f98c8f03a718faf12652f9994
QY_iOS_SDK: d41d5d780195d7c46745e334376008a9671388e3
ReactiveObjC: 011caa393aa0383245f2dcf9bf02e86b80b36040 ReactiveObjC: 011caa393aa0383245f2dcf9bf02e86b80b36040
SDCycleScrollView: a0d74c3384caa72bdfc81470bdbc8c14b3e1fbcf SDCycleScrollView: a0d74c3384caa72bdfc81470bdbc8c14b3e1fbcf
SDWebImage: a7f831e1a65eb5e285e3fb046a23fcfbf08e696d SDWebImage: a7f831e1a65eb5e285e3fb046a23fcfbf08e696d
@@ -217,6 +224,6 @@ SPEC CHECKSUMS:
YYText: 5c461d709e24d55a182d1441c41dc639a18a4849 YYText: 5c461d709e24d55a182d1441c41dc639a18a4849
YYWebImage: 5f7f36aee2ae293f016d418c7d6ba05c4863e928 YYWebImage: 5f7f36aee2ae293f016d418c7d6ba05c4863e928
PODFILE CHECKSUM: 89b628f1802cd346dba7b8c67843e04ac421b2ed PODFILE CHECKSUM: b9959c2f321e9cc9dc656ce6b1e01f6367878718
COCOAPODS: 1.11.3 COCOAPODS: 1.11.3

View File

@@ -12,6 +12,8 @@
#import <UMCommon/UMCommon.h> #import <UMCommon/UMCommon.h>
#import <UserNotifications/UNUserNotificationCenter.h> #import <UserNotifications/UNUserNotificationCenter.h>
#import <Bugly/Bugly.h> #import <Bugly/Bugly.h>
#import <QYSDK/QYSDK.h>
#import <IQKeyboardManager.h>
///Tool ///Tool
#import "XPConstant.h" #import "XPConstant.h"
#import "CustomAttachmentDecoder.h" #import "CustomAttachmentDecoder.h"
@@ -37,6 +39,7 @@ UIKIT_EXTERN NSString * adImageName;
[self configUMengSDK]; [self configUMengSDK];
[self initEmojiData]; [self initEmojiData];
[self configBugly]; [self configBugly];
[self configQIYUSDK];
} }
- (void)configShareSDK { - (void)configShareSDK {
@@ -58,7 +61,7 @@ UIKIT_EXTERN NSString * adImageName;
// NIM SDK // NIM SDK
[NIMCustomObject registerCustomDecoder:[[CustomAttachmentDecoder alloc] init]]; [NIMCustomObject registerCustomDecoder:[[CustomAttachmentDecoder alloc] init]];
#ifdef DEBUG #ifdef DEBUG
[NIMSDKConfig sharedConfig].enabledHttpsForInfo = NO; [NIMSDKConfig sharedConfig].enabledHttpsForInfo = NO;
[NIMSDKConfig sharedConfig].enabledHttpsForMessage = NO; [NIMSDKConfig sharedConfig].enabledHttpsForMessage = NO;
@@ -71,9 +74,15 @@ UIKIT_EXTERN NSString * adImageName;
} }
[[UIApplication sharedApplication] registerForRemoteNotifications]; [[UIApplication sharedApplication] registerForRemoteNotifications];
} }
- (void)configQIYUSDK {
[[QYSDK sharedSDK] registerAppId:@"b6b7ca22f8ce319dea3a7456dc211fec" appName:@"音萌"];
[QYSDK sharedSDK].customUIConfig.sessionBackground.backgroundColor = [UIColor redColor];
[QYSDK sharedSDK].customUIConfig.showAudioEntry = NO;
[QYSDK sharedSDK].customUIConfig.autoShowKeyboard = NO;
[QYSDK sharedSDK].customUIConfig.serviceHeadImage = [UIImage imageNamed:@"ming_setting_about_us"];
}
/**ming_setting_about_us
/**
Bugly Bugly
*/ */
- (void) configBugly { - (void) configBugly {

View File

@@ -8,6 +8,7 @@
#import "BaseMvpPresenter.h" #import "BaseMvpPresenter.h"
#import "AccountInfoStorage.h" #import "AccountInfoStorage.h"
#import <NIMSDK/NIMSDK.h> #import <NIMSDK/NIMSDK.h>
#import <QYSDK/QYSDK.h>
@interface BaseMvpPresenter() @interface BaseMvpPresenter()
@@ -32,6 +33,11 @@
if ([NIMSDK sharedSDK].loginManager.isLogined) { if ([NIMSDK sharedSDK].loginManager.isLogined) {
[[NIMSDK sharedSDK].loginManager logout:nil]; [[NIMSDK sharedSDK].loginManager logout:nil];
} }
[[QYSDK sharedSDK] logout:^(BOOL success) {
NSLog(@"你好");
}];
// 2. // 2.
[[self getView] tokenInvalid]; [[self getView] tokenInvalid];
} }

View File

@@ -69,6 +69,7 @@
#pragma mark - Private Method #pragma mark - Private Method
- (void)initSubViews { - (void)initSubViews {
self.view.backgroundColor = [UIColor whiteColor];
[self.view addSubview:self.backImageView]; [self.view addSubview:self.backImageView];
[self.view addSubview:self.backButton]; [self.view addSubview:self.backButton];
[self.view addSubview:self.titleLabel]; [self.view addSubview:self.titleLabel];
@@ -283,9 +284,9 @@
- (UIButton *)retryCodeButton { - (UIButton *)retryCodeButton {
if (!_retryCodeButton) { if (!_retryCodeButton) {
_retryCodeButton = [UIButton buttonWithType:UIButtonTypeCustom]; _retryCodeButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_retryCodeButton setTitle:@"重新获取验证码" forState:UIControlStateNormal]; [_retryCodeButton setTitle:@"获取验证码" forState:UIControlStateNormal];
[_retryCodeButton setTitleColor:[ThemeColor appMainColor] forState:UIControlStateNormal]; [_retryCodeButton setTitleColor:[ThemeColor mainTextColor] forState:UIControlStateNormal];
_retryCodeButton.titleLabel.font = [UIFont systemFontOfSize:11]; _retryCodeButton.titleLabel.font = [UIFont systemFontOfSize:11 weight:UIFontWeightMedium];
_retryCodeButton.hidden = YES; _retryCodeButton.hidden = YES;
} }
return _retryCodeButton; return _retryCodeButton;

View File

@@ -36,6 +36,10 @@
break; break;
case NIMMessageTypeCustom: { case NIMMessageTypeCustom: {
NIMCustomObject *obj = (NIMCustomObject *) message.messageObject; NIMCustomObject *obj = (NIMCustomObject *) message.messageObject;
if (![obj.attachment isKindOfClass:[AttachmentModel class]]) {
text = @"";
break;
}
AttachmentModel *attachment = (AttachmentModel *) obj.attachment; AttachmentModel *attachment = (AttachmentModel *) obj.attachment;
if (attachment.first == CustomMessageType_Secretary) { if (attachment.first == CustomMessageType_Secretary) {
if (attachment.second == Custom_Message_Sub_Secretary_Router) { if (attachment.second == Custom_Message_Sub_Secretary_Router) {

View File

@@ -166,16 +166,19 @@ NSString * const kMessageShowReadDotKey = @"kMessageShowReadDotKey";
__block int unreadCount = 0; __block int unreadCount = 0;
NSMutableArray<NSString *> * uids = [[NSMutableArray alloc] init]; NSMutableArray<NSString *> * uids = [[NSMutableArray alloc] init];
NSMutableArray *officalArray = [NSMutableArray array]; NSMutableArray *officalArray = [NSMutableArray array];
NSMutableArray* sessionList = [NSMutableArray array];
[self.recentSessions enumerateObjectsUsingBlock:^(NIMRecentSession * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { [self.recentSessions enumerateObjectsUsingBlock:^(NIMRecentSession * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
if (self.openType != SessionListOpenTypeRoom && [[ClientConfig shareConfig].configInfo.officialMsgUids containsObject:obj.session.sessionId]) { if (self.openType != SessionListOpenTypeRoom && [[ClientConfig shareConfig].configInfo.officialMsgUids containsObject:obj.session.sessionId]) {
[officalArray addObject:obj]; [officalArray addObject:obj];
[self.headView updateBadgeWithSessionId:obj.session.sessionId unreadCount:obj.unreadCount]; [self.headView updateBadgeWithSessionId:obj.session.sessionId unreadCount:obj.unreadCount];
} else { } else {
[uids addObject:obj.session.sessionId]; if (obj.session.sessionId.integerValue > 0) {
unreadCount += obj.unreadCount; [sessionList addObject:obj];
unreadCount += obj.unreadCount;
}
} }
}]; }];
[self.recentSessions removeObjectsInArray:officalArray]; self.recentSessions = sessionList;
[self setTabBarItemBadge:unreadCount]; [self setTabBarItemBadge:unreadCount];
[[NIMSDK sharedSDK].userManager fetchUserInfos:uids completion:nil]; [[NIMSDK sharedSDK].userManager fetchUserInfos:uids completion:nil];
@@ -260,7 +263,9 @@ NSString * const kMessageShowReadDotKey = @"kMessageShowReadDotKey";
[self.headView updateBadgeWithSessionId:recentSession.session.sessionId unreadCount:recentSession.unreadCount]; [self.headView updateBadgeWithSessionId:recentSession.session.sessionId unreadCount:recentSession.unreadCount];
return; return;
} }
[self.recentSessions addObject:recentSession]; if (recentSession.session.sessionId.integerValue > 0) {
[self.recentSessions addObject:recentSession];
}
[self.recentSessions sortUsingComparator:^NSComparisonResult(id obj1, id obj2) { [self.recentSessions sortUsingComparator:^NSComparisonResult(id obj1, id obj2) {
NIMRecentSession *item1 = obj1; NIMRecentSession *item1 = obj1;
NIMRecentSession *item2 = obj2; NIMRecentSession *item2 = obj2;
@@ -289,7 +294,9 @@ NSString * const kMessageShowReadDotKey = @"kMessageShowReadDotKey";
} }
} }
NSInteger insert = [self findInsertPlace:recentSession]; NSInteger insert = [self findInsertPlace:recentSession];
[self.recentSessions insertObject:recentSession atIndex:insert]; if (recentSession.session.sessionId.integerValue > 0) {
[self.recentSessions insertObject:recentSession atIndex:insert];
}
[self.sessionListView reloadData]; [self.sessionListView reloadData];
[self setTabBarItemBadge:totalUnreadCount]; [self setTabBarItemBadge:totalUnreadCount];
} }

View File

@@ -251,9 +251,11 @@
- (void)didMoveToSuperview { - (void)didMoveToSuperview {
[super didMoveToSuperview]; [super didMoveToSuperview];
[self mas_makeConstraints:^(MASConstraintMaker *make) { if (self.superview) {
make.width.mas_equalTo(self.superview); [self mas_makeConstraints:^(MASConstraintMaker *make) {
}]; make.width.mas_equalTo(self.superview);
}];
}
[self layoutIfNeeded]; [self layoutIfNeeded];
} }

View File

@@ -9,6 +9,8 @@
///Third ///Third
#import <Masonry/Masonry.h> #import <Masonry/Masonry.h>
#import <flutter_boost/FlutterBoost.h> #import <flutter_boost/FlutterBoost.h>
#import <IQKeyboardManager.h>
#import <QYSDK/QYSDK.h>
///Tool ///Tool
#import "TTPopup.h" #import "TTPopup.h"
#import "XPMacro.h" #import "XPMacro.h"
@@ -626,7 +628,15 @@
} }
break; break;
case XPMineItemType_Customer_Center: { case XPMineItemType_Customer_Center: {
///TODO: [QYSDK sharedSDK].customUIConfig.customerHeadImageUrl = self.userInfo.avatar;
QYSource *source = [[QYSource alloc] init];
source.title = @"音萌客服";
source.urlString = @"https://gzhfwlkjyxgs.qiyukf.com/";
[[IQKeyboardManager sharedManager].disabledDistanceHandlingClasses addObject:[QYSessionViewController class]];
QYSessionViewController *sessionViewController = [[QYSDK sharedSDK] sessionViewController];
sessionViewController.sessionTitle = @"音萌客服";
sessionViewController.source = source;
[self.navigationController pushViewController:sessionViewController animated:YES];
} }
break; break;

View File

@@ -12,6 +12,7 @@
#import <AudioToolbox/AudioToolbox.h> #import <AudioToolbox/AudioToolbox.h>
#import <AFNetworkReachabilityManager.h> #import <AFNetworkReachabilityManager.h>
#import <POP.h> #import <POP.h>
#import <QYSDK/QYSDK.h>
///Tool ///Tool
#import "XPMacro.h" #import "XPMacro.h"
#import "ThemeColor.h" #import "ThemeColor.h"
@@ -373,6 +374,27 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
[self.presenter logout]; [self.presenter logout];
} }
- (void)onLogin:(NIMLoginStep)step {
if(step == NIMLoginStepLoginOK) {
NSLog(@"登录陈宫");
NSString * uid = [AccountInfoStorage instance].getUid;
if ([QYSDK sharedSDK].currentUserID != uid) {
[[QYSDK sharedSDK] logout:^(BOOL success) {
if (success) {
QYUserInfo * userinfo = [[QYUserInfo alloc] init];
userinfo.userId = uid;
[[QYSDK sharedSDK] setUserInfo:userinfo];
}
}];
} else {
QYUserInfo * userinfo = [[QYUserInfo alloc] init];
userinfo.userId = uid;
[[QYSDK sharedSDK] setUserInfo:userinfo];
}
}
}
- (void)onKickout:(NIMLoginKickoutResult *)result { - (void)onKickout:(NIMLoginKickoutResult *)result {
[XCHUDTool showErrorWithMessage:@"您已被踢下线,若非正常行为,请及时修改密码"]; [XCHUDTool showErrorWithMessage:@"您已被踢下线,若非正常行为,请及时修改密码"];
UIViewController *rootViewController = [UIApplication sharedApplication].keyWindow.rootViewController; UIViewController *rootViewController = [UIApplication sharedApplication].keyWindow.rootViewController;