优化 NIMSDK 和 SudSDK 的初始化逻辑,新增从配置中获取 appKey 和 appId 的功能,提升代码灵活性和可维护性。同时,修正 sudKey 的属性名称以保持一致性。

This commit is contained in:
edwinQQQ
2025-08-14 18:48:47 +08:00
parent cd4710ecf6
commit 5192d58b07
3 changed files with 16 additions and 4 deletions

View File

@@ -99,7 +99,11 @@ UIKIT_EXTERN NSString * adImageName;
}
- (void)configNIMSDK {
// NIMSDK
NSString *appKey = KeyWithType(KeyType_NetEase);
NSString *appKey = [[ClientConfig shareConfig].configInfo nimKey];
if ([NSString isEmpty:appKey]) {
appKey = KeyWithType(KeyType_NetEase);
}
NIMSDKOption *option = [NIMSDKOption optionWithAppKey:appKey];
#ifdef DEBUG
option.apnsCername = @"pikoDevelopPush";

View File

@@ -109,7 +109,7 @@ typedef NS_ENUM(NSInteger, FaceLivenessStrategy) {
@property(nonatomic, assign) BOOL captchaSwitch;
@property (nonatomic, copy) NSString *sudId;
@property (nonatomic, copy) NSString *sudKey;
@property (nonatomic, copy) NSString *sudkey;
@property (nonatomic, copy) NSString *nimKey;
@end

View File

@@ -14,7 +14,7 @@
#import "Api+LittleGame.h"
#import "AccountInfoStorage.h"
#import "ClientConfig.h"
#import "SudCommon.h"
#import "SudGameConfig.h"
@@ -110,7 +110,15 @@
#else
isTestEnv = NO;
#endif
[SudMGP initSDK:KeyWithType(KeyType_SudGameAppID) appKey:KeyWithType(KeyType_SudGameAppKey) isTestEnv:isTestEnv listener:^(int retCode, const NSString *retMsg) {
NSString *SUDAPPID = [[ClientConfig shareConfig].configInfo sudId];
NSString *SUDAPPKEY = [[ClientConfig shareConfig].configInfo sudkey];
if ([NSString isEmpty:SUDAPPID]) {
SUDAPPID = KeyWithType(KeyType_SudGameAppID);
}
if ([NSString isEmpty:SUDAPPKEY]) {
SUDAPPKEY = KeyWithType(KeyType_SudGameAppKey);
}
[SudMGP initSDK:SUDAPPID appKey:SUDAPPKEY isTestEnv:isTestEnv listener:^(int retCode, const NSString *retMsg) {
if (retCode == 0) {
if (!self.currentmgId) {
return;