
主要变更: 1. 移除不必要的模块导入,简化 AppDelegate 中的代码结构。 2. 引入新的 EPConfigManager 和 EPNIMManager,统一配置管理和 NIMSDK 初始化逻辑。 3. 更新相关方法以使用 block 回调,提升代码的可读性和维护性。 4. 新增 EPClientAPIBridge 和相关配置文件,增强项目的模块化。 此更新旨在提升代码的可维护性,减少冗余实现,确保配置管理的一致性。
37 lines
1.0 KiB
Objective-C
37 lines
1.0 KiB
Objective-C
//
|
|
// EPClientAPIBridge.m
|
|
// YuMi
|
|
//
|
|
// Objective-C to Swift bridge for client init/config APIs
|
|
//
|
|
|
|
#import "EPClientAPIBridge.h"
|
|
#import "Api+Main.h"
|
|
#import "ClientConfig.h"
|
|
#import "BaseModel.h"
|
|
|
|
@implementation EPClientAPIBridge
|
|
|
|
+ (void)clientInit:(void(^)(NSDictionary * _Nullable data, NSInteger code, NSString * _Nullable msg))completion {
|
|
if (!completion) { return; }
|
|
[Api clientInitConfig:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
|
NSDictionary *payload = nil;
|
|
if (code == 200 && data.data && [data.data isKindOfClass:[NSDictionary class]]) {
|
|
payload = (NSDictionary *)data.data;
|
|
}
|
|
completion(payload, code, msg);
|
|
}];
|
|
}
|
|
|
|
+ (void)clientConfig:(void(^)(NSDictionary * _Nullable data, NSInteger code, NSString * _Nullable msg))completion {
|
|
if (!completion) { return; }
|
|
// ClientConfig.clientConfig only has a finish block with no parameters; treat success as code 200
|
|
[[ClientConfig shareConfig] clientConfig:^{
|
|
completion(nil, 200, nil);
|
|
}];
|
|
}
|
|
|
|
@end
|
|
|
|
|