接入云信初始化
This commit is contained in:
@@ -767,6 +767,9 @@
|
|||||||
8C2C3F542B2A41F5002C3C34 /* DDV2PhoneCodeVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C2C3F532B2A41F5002C3C34 /* DDV2PhoneCodeVC.m */; };
|
8C2C3F542B2A41F5002C3C34 /* DDV2PhoneCodeVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C2C3F532B2A41F5002C3C34 /* DDV2PhoneCodeVC.m */; };
|
||||||
8C2C3F572B2A4350002C3C34 /* DDLoginSVGAView.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C2C3F562B2A4350002C3C34 /* DDLoginSVGAView.m */; };
|
8C2C3F572B2A4350002C3C34 /* DDLoginSVGAView.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C2C3F562B2A4350002C3C34 /* DDLoginSVGAView.m */; };
|
||||||
8C2C3F5A2B2A70F9002C3C34 /* DDLoginRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C2C3F592B2A70F9002C3C34 /* DDLoginRequest.m */; };
|
8C2C3F5A2B2A70F9002C3C34 /* DDLoginRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C2C3F592B2A70F9002C3C34 /* DDLoginRequest.m */; };
|
||||||
|
8C2C3F612B2A9A3B002C3C34 /* DDGloabalConstant.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C2C3F602B2A9A3B002C3C34 /* DDGloabalConstant.m */; };
|
||||||
|
8C2C3F662B2A9C26002C3C34 /* DDRegisterCustomDecoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C2C3F652B2A9C26002C3C34 /* DDRegisterCustomDecoder.m */; };
|
||||||
|
8C2C3F6A2B2A9CFB002C3C34 /* DDCustomAttachmentModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C2C3F692B2A9CFB002C3C34 /* DDCustomAttachmentModel.m */; };
|
||||||
8CE493992B23F44800CA14D5 /* NSMutableDictionary+DDSafe.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CE493982B23F44800CA14D5 /* NSMutableDictionary+DDSafe.m */; };
|
8CE493992B23F44800CA14D5 /* NSMutableDictionary+DDSafe.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CE493982B23F44800CA14D5 /* NSMutableDictionary+DDSafe.m */; };
|
||||||
8CE4939C2B23F45C00CA14D5 /* NSArray+DDSafe.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CE4939B2B23F45C00CA14D5 /* NSArray+DDSafe.m */; };
|
8CE4939C2B23F45C00CA14D5 /* NSArray+DDSafe.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CE4939B2B23F45C00CA14D5 /* NSArray+DDSafe.m */; };
|
||||||
8CE493A02B23F5FA00CA14D5 /* DDUploadFile.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CE4939F2B23F5FA00CA14D5 /* DDUploadFile.m */; };
|
8CE493A02B23F5FA00CA14D5 /* DDUploadFile.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CE4939F2B23F5FA00CA14D5 /* DDUploadFile.m */; };
|
||||||
@@ -2196,6 +2199,12 @@
|
|||||||
8C2C3F582B2A70F9002C3C34 /* DDLoginRequest.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DDLoginRequest.h; sourceTree = "<group>"; };
|
8C2C3F582B2A70F9002C3C34 /* DDLoginRequest.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DDLoginRequest.h; sourceTree = "<group>"; };
|
||||||
8C2C3F592B2A70F9002C3C34 /* DDLoginRequest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DDLoginRequest.m; sourceTree = "<group>"; };
|
8C2C3F592B2A70F9002C3C34 /* DDLoginRequest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DDLoginRequest.m; sourceTree = "<group>"; };
|
||||||
8C2C3F5E2B2A886A002C3C34 /* DDV2RequestUrl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DDV2RequestUrl.h; sourceTree = "<group>"; };
|
8C2C3F5E2B2A886A002C3C34 /* DDV2RequestUrl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DDV2RequestUrl.h; sourceTree = "<group>"; };
|
||||||
|
8C2C3F5F2B2A9A3B002C3C34 /* DDGloabalConstant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DDGloabalConstant.h; sourceTree = "<group>"; };
|
||||||
|
8C2C3F602B2A9A3B002C3C34 /* DDGloabalConstant.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DDGloabalConstant.m; sourceTree = "<group>"; };
|
||||||
|
8C2C3F642B2A9C26002C3C34 /* DDRegisterCustomDecoder.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DDRegisterCustomDecoder.h; sourceTree = "<group>"; };
|
||||||
|
8C2C3F652B2A9C26002C3C34 /* DDRegisterCustomDecoder.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DDRegisterCustomDecoder.m; sourceTree = "<group>"; };
|
||||||
|
8C2C3F682B2A9CFB002C3C34 /* DDCustomAttachmentModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DDCustomAttachmentModel.h; sourceTree = "<group>"; };
|
||||||
|
8C2C3F692B2A9CFB002C3C34 /* DDCustomAttachmentModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DDCustomAttachmentModel.m; sourceTree = "<group>"; };
|
||||||
8CAB97312B2259EA00ED8639 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; };
|
8CAB97312B2259EA00ED8639 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; };
|
||||||
8CE493972B23F44800CA14D5 /* NSMutableDictionary+DDSafe.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSMutableDictionary+DDSafe.h"; sourceTree = "<group>"; };
|
8CE493972B23F44800CA14D5 /* NSMutableDictionary+DDSafe.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSMutableDictionary+DDSafe.h"; sourceTree = "<group>"; };
|
||||||
8CE493982B23F44800CA14D5 /* NSMutableDictionary+DDSafe.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSMutableDictionary+DDSafe.m"; sourceTree = "<group>"; };
|
8CE493982B23F44800CA14D5 /* NSMutableDictionary+DDSafe.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSMutableDictionary+DDSafe.m"; sourceTree = "<group>"; };
|
||||||
@@ -5497,6 +5506,8 @@
|
|||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
23B2A8062B2843B6001C0913 /* DDMacroHeader.h */,
|
23B2A8062B2843B6001C0913 /* DDMacroHeader.h */,
|
||||||
|
8C2C3F5F2B2A9A3B002C3C34 /* DDGloabalConstant.h */,
|
||||||
|
8C2C3F602B2A9A3B002C3C34 /* DDGloabalConstant.m */,
|
||||||
);
|
);
|
||||||
path = DDGlobalManager;
|
path = DDGlobalManager;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@@ -5505,6 +5516,7 @@
|
|||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
23B62C2E2B299E26005FD3DE /* DDDynamic */,
|
23B62C2E2B299E26005FD3DE /* DDDynamic */,
|
||||||
|
8C2C3F622B2A9BEC002C3C34 /* DDNIM */,
|
||||||
23A7F7902B29551D00288CAE /* DDApplePay */,
|
23A7F7902B29551D00288CAE /* DDApplePay */,
|
||||||
23A7F7862B28795500288CAE /* DDHome */,
|
23A7F7862B28795500288CAE /* DDHome */,
|
||||||
23A7F78A2B28795500288CAE /* DDMine */,
|
23A7F78A2B28795500288CAE /* DDMine */,
|
||||||
@@ -5756,6 +5768,33 @@
|
|||||||
path = Model;
|
path = Model;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
|
8C2C3F622B2A9BEC002C3C34 /* DDNIM */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
8C2C3F672B2A9CEC002C3C34 /* Model */,
|
||||||
|
8C2C3F632B2A9C04002C3C34 /* Tool */,
|
||||||
|
);
|
||||||
|
path = DDNIM;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
8C2C3F632B2A9C04002C3C34 /* Tool */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
8C2C3F642B2A9C26002C3C34 /* DDRegisterCustomDecoder.h */,
|
||||||
|
8C2C3F652B2A9C26002C3C34 /* DDRegisterCustomDecoder.m */,
|
||||||
|
);
|
||||||
|
path = Tool;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
8C2C3F672B2A9CEC002C3C34 /* Model */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
8C2C3F682B2A9CFB002C3C34 /* DDCustomAttachmentModel.h */,
|
||||||
|
8C2C3F692B2A9CFB002C3C34 /* DDCustomAttachmentModel.m */,
|
||||||
|
);
|
||||||
|
path = Model;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
8CE493952B23F2B400CA14D5 /* DDBaseTool */ = {
|
8CE493952B23F2B400CA14D5 /* DDBaseTool */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
@@ -6388,6 +6427,7 @@
|
|||||||
188EC0EC2A47CF3200060F03 /* DDMEmoticonCell.m in Sources */,
|
188EC0EC2A47CF3200060F03 /* DDMEmoticonCell.m in Sources */,
|
||||||
18660D4E2A2193C50032D0C9 /* NSDictionary+Custom.m in Sources */,
|
18660D4E2A2193C50032D0C9 /* NSDictionary+Custom.m in Sources */,
|
||||||
186EBFB72A402F33005623CC /* DynamicCommentViewController.m in Sources */,
|
186EBFB72A402F33005623CC /* DynamicCommentViewController.m in Sources */,
|
||||||
|
8C2C3F662B2A9C26002C3C34 /* DDRegisterCustomDecoder.m in Sources */,
|
||||||
188EC0E12A47CF3200060F03 /* SVGView.m in Sources */,
|
188EC0E12A47CF3200060F03 /* SVGView.m in Sources */,
|
||||||
18660DCE2A21E54B0032D0C9 /* RoomMicroView.m in Sources */,
|
18660DCE2A21E54B0032D0C9 /* RoomMicroView.m in Sources */,
|
||||||
18B1EA252A26F31A00DDE889 /* DDDynamicDataTableViewCell.m in Sources */,
|
18B1EA252A26F31A00DDE889 /* DDDynamicDataTableViewCell.m in Sources */,
|
||||||
@@ -6554,6 +6594,7 @@
|
|||||||
1867778B2A42D3D80096D802 /* RoomTypeCollectionViewCell.m in Sources */,
|
1867778B2A42D3D80096D802 /* RoomTypeCollectionViewCell.m in Sources */,
|
||||||
189956A22A21F804002ABEEB /* RoomMicroHeaderView.m in Sources */,
|
189956A22A21F804002ABEEB /* RoomMicroHeaderView.m in Sources */,
|
||||||
188CA97F2A501A6200DAFC86 /* DDV2HomeListVC.m in Sources */,
|
188CA97F2A501A6200DAFC86 /* DDV2HomeListVC.m in Sources */,
|
||||||
|
8C2C3F6A2B2A9CFB002C3C34 /* DDCustomAttachmentModel.m in Sources */,
|
||||||
183864392A28A17B005BF235 /* ZLAlbumListController.m in Sources */,
|
183864392A28A17B005BF235 /* ZLAlbumListController.m in Sources */,
|
||||||
186C9D062A29EE3500209BB5 /* ZLMediaProgressView.m in Sources */,
|
186C9D062A29EE3500209BB5 /* ZLMediaProgressView.m in Sources */,
|
||||||
187AE10A2A493DFB00B427CB /* RoomBlackListView.m in Sources */,
|
187AE10A2A493DFB00B427CB /* RoomBlackListView.m in Sources */,
|
||||||
@@ -6625,6 +6666,7 @@
|
|||||||
18660D802A21947B0032D0C9 /* WLBaseTableViewCell.m in Sources */,
|
18660D802A21947B0032D0C9 /* WLBaseTableViewCell.m in Sources */,
|
||||||
18660CBE2A21913E0032D0C9 /* WRNavigationBar.m in Sources */,
|
18660CBE2A21913E0032D0C9 /* WRNavigationBar.m in Sources */,
|
||||||
18C905082A233D5200F7CAFD /* XHPageControl.m in Sources */,
|
18C905082A233D5200F7CAFD /* XHPageControl.m in Sources */,
|
||||||
|
8C2C3F612B2A9A3B002C3C34 /* DDGloabalConstant.m in Sources */,
|
||||||
188EC1402A47CF3300060F03 /* HXPhotoEditStickerTrashView.m in Sources */,
|
188EC1402A47CF3300060F03 /* HXPhotoEditStickerTrashView.m in Sources */,
|
||||||
188EBF6A2A47CEA500060F03 /* DDMessageCell.m in Sources */,
|
188EBF6A2A47CEA500060F03 /* DDMessageCell.m in Sources */,
|
||||||
188EBF6D2A47CEA500060F03 /* DDInteractiveMessageVC.m in Sources */,
|
188EBF6D2A47CEA500060F03 /* DDInteractiveMessageVC.m in Sources */,
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<Scheme
|
<Scheme
|
||||||
LastUpgradeVersion = "1430"
|
LastUpgradeVersion = "1430"
|
||||||
version = "1.7">
|
version = "1.8">
|
||||||
<BuildAction
|
<BuildAction
|
||||||
parallelizeBuildables = "YES"
|
parallelizeBuildables = "YES"
|
||||||
buildImplicitDependencies = "YES">
|
buildImplicitDependencies = "YES">
|
||||||
|
@@ -21,6 +21,8 @@
|
|||||||
#import "AccountInfoStorage.h"
|
#import "AccountInfoStorage.h"
|
||||||
#import "HttpRequestHelper.h"
|
#import "HttpRequestHelper.h"
|
||||||
#import "DDLoginRequest.h"
|
#import "DDLoginRequest.h"
|
||||||
|
/// Tool
|
||||||
|
#import <NIMSDK/NIMSDK.h>
|
||||||
|
|
||||||
@interface AppDelegate (CYLTabBar)
|
@interface AppDelegate (CYLTabBar)
|
||||||
|
|
||||||
@@ -56,6 +58,7 @@
|
|||||||
NSArray *tickets = [data.data valueForKey:@"tickets"];
|
NSArray *tickets = [data.data valueForKey:@"tickets"];
|
||||||
NSString *ticket = [tickets[0] valueForKey:@"ticket"];
|
NSString *ticket = [tickets[0] valueForKey:@"ticket"];
|
||||||
[[AccountInfoStorage instance] saveTicket:ticket];
|
[[AccountInfoStorage instance] saveTicket:ticket];
|
||||||
|
[self loginNIM];
|
||||||
[self getUserInfo];
|
[self getUserInfo];
|
||||||
} failure:^(NSInteger resCode, NSString * _Nonnull message) {
|
} failure:^(NSInteger resCode, NSString * _Nonnull message) {
|
||||||
[ToolsObject addPopVieToText:[NSString stringWithFormat:@"加载页面%@失败,请重新登录",message]];
|
[ToolsObject addPopVieToText:[NSString stringWithFormat:@"加载页面%@失败,请重新登录",message]];
|
||||||
@@ -65,6 +68,31 @@
|
|||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)loginNIM {
|
||||||
|
AccountModel *accountModel = [[AccountInfoStorage instance] getCurrentAccountInfo];
|
||||||
|
if (accountModel == nil) {
|
||||||
|
[self gotoWithLoginController];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ([NIMSDK sharedSDK].loginManager.isLogined) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
NIMAutoLoginData *data = [[NIMAutoLoginData alloc]init];
|
||||||
|
data.account = accountModel.uid;
|
||||||
|
data.token = accountModel.netEaseToken;
|
||||||
|
data.forcedMode = NO;
|
||||||
|
// [[NIMSDK sharedSDK].loginManager autoLogin:data];
|
||||||
|
[[NIMSDK sharedSDK].loginManager login:accountModel.uid token:accountModel.netEaseToken completion:^(NSError * _Nullable error) {
|
||||||
|
if (error) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
- (void)getUserInfo {
|
- (void)getUserInfo {
|
||||||
[DDLoginRequest DD_LoadRequestUserInfo:[[AccountInfoStorage instance] getUid] completed:^(UserInfoModel * _Nonnull userInfo) {
|
[DDLoginRequest DD_LoadRequestUserInfo:[[AccountInfoStorage instance] getUid] completed:^(UserInfoModel * _Nonnull userInfo) {
|
||||||
if (userInfo == nil) {
|
if (userInfo == nil) {
|
||||||
|
@@ -13,6 +13,9 @@
|
|||||||
#import <UMCommon/UMCommon.h>
|
#import <UMCommon/UMCommon.h>
|
||||||
#import <UMLink/UMLink.h>
|
#import <UMLink/UMLink.h>
|
||||||
#import "DDV2LoginVC.h"
|
#import "DDV2LoginVC.h"
|
||||||
|
#import <NIMSDK/NIMSDK.h>
|
||||||
|
#import "DDGloabalConstant.h"
|
||||||
|
#import "DDRegisterCustomDecoder.h"
|
||||||
@interface AppDelegate (Other)
|
@interface AppDelegate (Other)
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@@ -41,8 +44,34 @@
|
|||||||
didEndEditingNotificationName:YYTextViewTextDidEndEditingNotification];
|
didEndEditingNotificationName:YYTextViewTextDidEndEditingNotification];
|
||||||
[self initUMeng];
|
[self initUMeng];
|
||||||
[self initShanyanSDK];
|
[self initShanyanSDK];
|
||||||
|
[self initNIM];
|
||||||
[HCKeepBGRunManager shareManager];
|
[HCKeepBGRunManager shareManager];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 推荐在程序启动的时候初始化 NIMSDK
|
||||||
|
- (void)initNIM {
|
||||||
|
NSString *appKey = DD_Constant_KeyWithType(DD_Constant_KeyType_NetEase);
|
||||||
|
NIMSDKOption *option = [NIMSDKOption optionWithAppKey:appKey];
|
||||||
|
option.apnsCername = DD_Constant_KeyWithType(DD_Constant_KeyType_APNSCer);
|
||||||
|
[[NIMSDK sharedSDK] registerWithOption:option];
|
||||||
|
|
||||||
|
// NIM SDK初始化
|
||||||
|
[NIMCustomObject registerCustomDecoder:[[DDRegisterCustomDecoder alloc] init]];
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
[NIMSDKConfig sharedConfig].enabledHttpsForInfo = NO;
|
||||||
|
[NIMSDKConfig sharedConfig].enabledHttpsForMessage = NO;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (@available(iOS 11.0, *)){
|
||||||
|
UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
|
||||||
|
[center requestAuthorizationWithOptions:(UNAuthorizationOptionBadge | UNAuthorizationOptionSound | UNAuthorizationOptionAlert) completionHandler:^(BOOL granted, NSError * _Nullable error) {
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
[[UIApplication sharedApplication] registerForRemoteNotifications];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
- (void)initUMeng {
|
- (void)initUMeng {
|
||||||
NSString * channel = @"App Store";
|
NSString * channel = @"App Store";
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@@ -84,8 +113,7 @@
|
|||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
- (void)getLinkPath:(NSDictionary *)params
|
- (void)getLinkPath:(NSDictionary *)params {
|
||||||
{
|
|
||||||
UINavigationController *platformVc = (UINavigationController *)self.window.rootViewController;
|
UINavigationController *platformVc = (UINavigationController *)self.window.rootViewController;
|
||||||
if (params.count > 0) {
|
if (params.count > 0) {
|
||||||
DDV2LoginVC *vc = platformVc.viewControllers[0];
|
DDV2LoginVC *vc = platformVc.viewControllers[0];
|
||||||
|
@@ -11,6 +11,7 @@
|
|||||||
#import "AppDelegate+NetworkStatus.h"
|
#import "AppDelegate+NetworkStatus.h"
|
||||||
#import "AppDelegate+CYLTabBar.h"
|
#import "AppDelegate+CYLTabBar.h"
|
||||||
#import "AppDelegate+Other.h"
|
#import "AppDelegate+Other.h"
|
||||||
|
#import <NIMSDK/NIMSDK.h>
|
||||||
|
|
||||||
@interface AppDelegate ()
|
@interface AppDelegate ()
|
||||||
|
|
||||||
@@ -35,6 +36,15 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (void)applicationDidEnterBackground:(UIApplication *)application {
|
||||||
|
NSInteger count = [NIMSDK sharedSDK].conversationManager.allUnreadCount;
|
||||||
|
[[UIApplication sharedApplication] setApplicationIconBadgeNumber:count];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)application:(UIApplication *)app didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
|
||||||
|
// 上传devicetoken至云信服务器。
|
||||||
|
[[NIMSDK sharedSDK] updateApnsToken:deviceToken];
|
||||||
|
}
|
||||||
|
|
||||||
+ (AppDelegate* )getAppdelegate {
|
+ (AppDelegate* )getAppdelegate {
|
||||||
return (AppDelegate*)[UIApplication sharedApplication].delegate;
|
return (AppDelegate*)[UIApplication sharedApplication].delegate;
|
||||||
|
@@ -15,8 +15,12 @@
|
|||||||
#import "DDV2HomePVC.h"
|
#import "DDV2HomePVC.h"
|
||||||
#import "UITabBar+badge.h"
|
#import "UITabBar+badge.h"
|
||||||
#import "DDFMDBManager.h"
|
#import "DDFMDBManager.h"
|
||||||
|
#import <NIMSDK/NIMSDK.h>
|
||||||
|
#import "AccountInfoStorage.h"
|
||||||
|
#import "AccountModel.h"
|
||||||
|
|
||||||
@interface WLCoustomTabBarController ()<UITabBarControllerDelegate,UIGestureRecognizerDelegate>
|
@interface WLCoustomTabBarController ()<UITabBarControllerDelegate,UIGestureRecognizerDelegate,
|
||||||
|
NIMLoginManagerDelegate, NIMSystemNotificationManagerDelegate,NIMChatManagerDelegate>
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@@ -25,6 +29,12 @@
|
|||||||
- (void)viewDidLoad {
|
- (void)viewDidLoad {
|
||||||
[super viewDidLoad];
|
[super viewDidLoad];
|
||||||
// Do any additional setup after loading the view.
|
// Do any additional setup after loading the view.
|
||||||
|
NSLog(@"云信登录是否成功:%ld",[NIMSDK sharedSDK].loginManager.isLogined)
|
||||||
|
|
||||||
|
[[NIMSDK sharedSDK].loginManager addDelegate:self];
|
||||||
|
[[NIMSDK sharedSDK].chatManager addDelegate:self];
|
||||||
|
[[NIMSDK sharedSDK].systemNotificationManager addDelegate:self];
|
||||||
|
[[NIMSDK sharedSDK].broadcastManager addDelegate:self];
|
||||||
|
|
||||||
//添加未读消息数量监听
|
//添加未读消息数量监听
|
||||||
[[DDMTool sharedTool] observationInform:self sel:@selector(messageUnreadNumber:) notificationName:[[DDMTool sharedTool]getinformType:(YVMessageNotice_MessageUnreadNumber)]];
|
[[DDMTool sharedTool] observationInform:self sel:@selector(messageUnreadNumber:) notificationName:[[DDMTool sharedTool]getinformType:(YVMessageNotice_MessageUnreadNumber)]];
|
||||||
@@ -264,14 +274,28 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
#pragma mark - NIMLoginManagerDelegate
|
||||||
#pragma mark - Navigation
|
- (void)onAutoLoginFailed:(NSError *)error {
|
||||||
|
// 如果非上次登录设备 autoLogin 会返回 417
|
||||||
|
if (error.code == 417) {
|
||||||
|
// @weakify(self);
|
||||||
|
AccountModel* accountModel = [AccountInfoStorage instance].getCurrentAccountInfo;
|
||||||
|
[[NIMSDK sharedSDK].loginManager login:accountModel.uid token:accountModel.netEaseToken completion:^(NSError * _Nullable error) {
|
||||||
|
if (error) {
|
||||||
|
// @strongify(self);
|
||||||
|
[ToolsObject loginOutJump];
|
||||||
|
// [self.presenter logout];
|
||||||
|
}
|
||||||
|
}];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
[ToolsObject loginOutJump];
|
||||||
|
// [self.presenter logout];
|
||||||
|
}
|
||||||
|
|
||||||
// In a storyboard-based application, you will often want to do a little preparation before navigation
|
- (void)onLogin:(NIMLoginStep)step {
|
||||||
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
|
if (step != NIMLoginStepLoginOK) return;
|
||||||
// Get the new view controller using [segue destinationViewController].
|
// [self addMessageBadge];
|
||||||
// Pass the selected object to the new view controller.
|
}
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@@ -19,6 +19,7 @@
|
|||||||
#import "SDImageCache.h"
|
#import "SDImageCache.h"
|
||||||
#import "RoomEditPassWordView.h"
|
#import "RoomEditPassWordView.h"
|
||||||
#import "AccountInfoStorage.h"
|
#import "AccountInfoStorage.h"
|
||||||
|
#import <NIMSDK/NIMSDK.h>
|
||||||
static NSString *SAVELOGIN = @"LOGINMODEL";
|
static NSString *SAVELOGIN = @"LOGINMODEL";
|
||||||
static NSString *SAVECITYINFO = @"CITYINFO";
|
static NSString *SAVECITYINFO = @"CITYINFO";
|
||||||
static NSString *SAVELOGINVIDEO = @"LOGINVIDEO";
|
static NSString *SAVELOGINVIDEO = @"LOGINVIDEO";
|
||||||
@@ -701,7 +702,7 @@ static NSString *SAVEROOMCONFIG = @"ROOMCONFIG";
|
|||||||
- (void)jumpToRoomVC:(NSString *)room_id followUser:(RoomUserInfoModel *)followUser{
|
- (void)jumpToRoomVC:(NSString *)room_id followUser:(RoomUserInfoModel *)followUser{
|
||||||
[ToolsObject ShowSVProgressHUD:@""];
|
[ToolsObject ShowSVProgressHUD:@""];
|
||||||
AppDelegate *delegate = (AppDelegate*)kAppDelegate;
|
AppDelegate *delegate = (AppDelegate*)kAppDelegate;
|
||||||
if([ToolsObject isBlankString:room_id].length ==0){
|
if([ToolsObject isBlankString:room_id].length == 0 || room_id == nil){
|
||||||
[ToolsObject addPopVieToText:@"未找到房间ID"];
|
[ToolsObject addPopVieToText:@"未找到房间ID"];
|
||||||
}
|
}
|
||||||
//判断是否已进入房间
|
//判断是否已进入房间
|
||||||
@@ -846,6 +847,9 @@ static NSString *SAVEROOMCONFIG = @"ROOMCONFIG";
|
|||||||
[ToolsObject removeUserInfo];
|
[ToolsObject removeUserInfo];
|
||||||
[[AccountInfoStorage instance] saveTicket:nil];
|
[[AccountInfoStorage instance] saveTicket:nil];
|
||||||
[[AccountInfoStorage instance] saveAccountInfo:nil];
|
[[AccountInfoStorage instance] saveAccountInfo:nil];
|
||||||
|
if ([NIMSDK sharedSDK].loginManager.isLogined) {
|
||||||
|
[[NIMSDK sharedSDK].loginManager logout:nil];
|
||||||
|
}
|
||||||
[kUserDefaults removeObjectForKey:KYoungPasswordKey];
|
[kUserDefaults removeObjectForKey:KYoungPasswordKey];
|
||||||
|
|
||||||
DDV2LoginVC *loginViewController = [[DDV2LoginVC alloc] init];
|
DDV2LoginVC *loginViewController = [[DDV2LoginVC alloc] init];
|
||||||
|
@@ -205,11 +205,11 @@
|
|||||||
self.isClick = YES;
|
self.isClick = YES;
|
||||||
if (self.isNoCollection) {
|
if (self.isNoCollection) {
|
||||||
DDRoomPartyModel *model = self.noDataArr[indexPath.item];
|
DDRoomPartyModel *model = self.noDataArr[indexPath.item];
|
||||||
[[ToolsObject shareTools] jumpToRoomVC:model.room_id followUser:[RoomUserInfoModel new]];
|
[[ToolsObject shareTools] jumpToRoomVC:model.roomId followUser:[RoomUserInfoModel new]];
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
DDRoomPartyModel *model = self.dataArr[indexPath.item];
|
DDRoomPartyModel *model = self.dataArr[indexPath.item];
|
||||||
[[ToolsObject shareTools] jumpToRoomVC:model.room_id followUser:[RoomUserInfoModel new]];
|
[[ToolsObject shareTools] jumpToRoomVC:model.roomId followUser:[RoomUserInfoModel new]];
|
||||||
}
|
}
|
||||||
WeakSelf(ws)
|
WeakSelf(ws)
|
||||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 1*NSEC_PER_SEC), dispatch_get_main_queue(), ^{
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 1*NSEC_PER_SEC), dispatch_get_main_queue(), ^{
|
||||||
|
@@ -0,0 +1,26 @@
|
|||||||
|
//
|
||||||
|
// DDGloabalConstant.h
|
||||||
|
// DingDangApp
|
||||||
|
//
|
||||||
|
// Created by 触海 on 2023/12/13.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
|
typedef NS_ENUM(NSUInteger, DDConstantKeyType) {
|
||||||
|
DD_Constant_KeyType_NetEase, ///云信的key
|
||||||
|
DD_Constant_KeyType_TRTC,///TRTC key
|
||||||
|
DD_Constant_KeyType_APNSCer,///推送证书的名字
|
||||||
|
};
|
||||||
|
|
||||||
|
@interface DDGloabalConstant : NSObject
|
||||||
|
|
||||||
|
|
||||||
|
/// 获取当前项目中所用到的 type 所对应的 value 的值 type 类型
|
||||||
|
NSString * const DD_Constant_KeyWithType(DDConstantKeyType type);
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,37 @@
|
|||||||
|
//
|
||||||
|
// DDGloabalConstant.m
|
||||||
|
// DingDangApp
|
||||||
|
//
|
||||||
|
// Created by 触海 on 2023/12/13.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "DDGloabalConstant.h"
|
||||||
|
|
||||||
|
@implementation DDGloabalConstant
|
||||||
|
|
||||||
|
NSString * const DD_Constant_KeyWithType(DDConstantKeyType type) {
|
||||||
|
BOOL isRelase = NO;
|
||||||
|
#ifdef DEBUG
|
||||||
|
isRelase = NO;
|
||||||
|
#else
|
||||||
|
isRelase = YES;
|
||||||
|
#endif
|
||||||
|
NSDictionary * dic = @{
|
||||||
|
///正式环境
|
||||||
|
@(YES):@{
|
||||||
|
@(DD_Constant_KeyType_TRTC) : @"1400798783",
|
||||||
|
@(DD_Constant_KeyType_NetEase) : @"5e76ec47632d86c30ce18eabfa332b6a",
|
||||||
|
@(DD_Constant_KeyType_APNSCer) : @"yinyouApnsRelease",
|
||||||
|
},
|
||||||
|
///测试环境
|
||||||
|
@(NO):@{
|
||||||
|
@(DD_Constant_KeyType_TRTC) : @"1400798783",
|
||||||
|
@(DD_Constant_KeyType_NetEase) : @"5e76ec47632d86c30ce18eabfa332b6a",
|
||||||
|
@(DD_Constant_KeyType_APNSCer) : @"yinyouApnsDebug",
|
||||||
|
}
|
||||||
|
};
|
||||||
|
NSDictionary * enviroDic = [dic objectForKey:@(isRelase)];
|
||||||
|
return [enviroDic objectForKey:@(type)];
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
@@ -0,0 +1,19 @@
|
|||||||
|
//
|
||||||
|
// DDCustomAttachmentModel.h
|
||||||
|
// DingDangApp
|
||||||
|
//
|
||||||
|
// Created by 触海 on 2023/12/13.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
#import <NIMSDK/NIMSDK.h>
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
|
@interface DDCustomAttachmentModel : NSObject<NIMCustomAttachment>
|
||||||
|
@property (nonatomic,assign) int first;
|
||||||
|
@property (nonatomic,assign) int second;
|
||||||
|
@property (nonatomic, strong) id data;
|
||||||
|
@end
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,16 @@
|
|||||||
|
//
|
||||||
|
// DDCustomAttachmentModel.m
|
||||||
|
// DingDangApp
|
||||||
|
//
|
||||||
|
// Created by 触海 on 2023/12/13.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "DDCustomAttachmentModel.h"
|
||||||
|
#import "NSObject+DDExtension.h"
|
||||||
|
|
||||||
|
@implementation DDCustomAttachmentModel
|
||||||
|
- (NSString *)encodeAttachment {
|
||||||
|
return [self dd_toJSONString];
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
@@ -0,0 +1,17 @@
|
|||||||
|
//
|
||||||
|
// DDRegisterCustomDecoder.h
|
||||||
|
// DingDangApp
|
||||||
|
//
|
||||||
|
// Created by 触海 on 2023/12/13.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
#import <NIMSDK/NIMSDK.h>
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
|
@interface DDRegisterCustomDecoder : NSObject<NIMCustomAttachmentCoding>
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,54 @@
|
|||||||
|
//
|
||||||
|
// DDRegisterCustomDecoder.m
|
||||||
|
// DingDangApp
|
||||||
|
//
|
||||||
|
// Created by 触海 on 2023/12/13.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "DDRegisterCustomDecoder.h"
|
||||||
|
#import "DDCustomAttachmentModel.h"
|
||||||
|
|
||||||
|
@implementation DDRegisterCustomDecoder
|
||||||
|
|
||||||
|
- (id<NIMCustomAttachment>)decodeAttachment:(NSString *)content {
|
||||||
|
id<NIMCustomAttachment> custom_attachment;
|
||||||
|
NSData *data = [content dataUsingEncoding:NSUTF8StringEncoding];
|
||||||
|
if (!data) {
|
||||||
|
return custom_attachment;
|
||||||
|
}
|
||||||
|
|
||||||
|
NSDictionary *dict_json = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
|
||||||
|
if ([dict_json isKindOfClass:[NSDictionary class]]) {
|
||||||
|
int first = [dict_json[@"first"] intValue];
|
||||||
|
int second = [dict_json[@"second"] intValue];
|
||||||
|
NSDictionary *data = dict_json[@"data"];
|
||||||
|
if ([data isKindOfClass:[NSString class]]) {
|
||||||
|
data = [self dd_dictionaryWithJsonString:(NSString *)data];
|
||||||
|
}
|
||||||
|
if ([data isKindOfClass:[NSDictionary class]]) {
|
||||||
|
DDCustomAttachmentModel *attachment = [[DDCustomAttachmentModel alloc] init];
|
||||||
|
attachment.first = (short)first;
|
||||||
|
attachment.second = (short)second;
|
||||||
|
attachment.data = data;
|
||||||
|
return attachment;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return custom_attachment;
|
||||||
|
}
|
||||||
|
|
||||||
|
//json格式字符串转字典:
|
||||||
|
- (NSDictionary *)dd_dictionaryWithJsonString:(NSString *)jsonString {
|
||||||
|
if (jsonString == nil) return nil;
|
||||||
|
|
||||||
|
NSData *jsonData = [jsonString dataUsingEncoding:NSUTF8StringEncoding];
|
||||||
|
NSError *err;
|
||||||
|
NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:jsonData
|
||||||
|
options:NSJSONReadingMutableContainers
|
||||||
|
error:&err];
|
||||||
|
|
||||||
|
if(err) return nil;
|
||||||
|
return dic;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
Reference in New Issue
Block a user