From 280592e88866e43f3e4f67897972a4e6915a5f46 Mon Sep 17 00:00:00 2001 From: wangtao Date: Thu, 23 Mar 2023 11:45:52 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E4=BF=AE=E6=94=B9addWebExtentionAp?= =?UTF-8?q?i=E7=B1=BB=E5=90=8D=E9=94=99=E8=AF=AF=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E4=B8=8D=E8=83=BD=E7=94=9F=E6=95=88=E7=9A=84=E9=97=AE=E9=A2=98?= =?UTF-8?q?=20=09iOS=E6=B7=BB=E5=8A=A0changeUserId=E7=9A=84API=E5=AE=9E?= =?UTF-8?q?=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...bExtentionApi.h => MOP_addWebExtentionApi.h} | 2 +- ...bExtentionApi.m => MOP_addWebExtentionApi.m} | 4 ++-- ios/Classes/Api/MOP_changeUserId.h | 16 ++++++++++++++++ ios/Classes/Api/MOP_changeUserId.m | 17 +++++++++++++++++ ios/Classes/Api/MOP_initSDK.m | 14 ++++++++++---- 5 files changed, 46 insertions(+), 7 deletions(-) rename ios/Classes/Api/{MOB_addWebExtentionApi.h => MOP_addWebExtentionApi.h} (81%) rename ios/Classes/Api/{MOB_addWebExtentionApi.m => MOP_addWebExtentionApi.m} (96%) create mode 100644 ios/Classes/Api/MOP_changeUserId.h create mode 100644 ios/Classes/Api/MOP_changeUserId.m diff --git a/ios/Classes/Api/MOB_addWebExtentionApi.h b/ios/Classes/Api/MOP_addWebExtentionApi.h similarity index 81% rename from ios/Classes/Api/MOB_addWebExtentionApi.h rename to ios/Classes/Api/MOP_addWebExtentionApi.h index d33d50d..53d26e7 100644 --- a/ios/Classes/Api/MOB_addWebExtentionApi.h +++ b/ios/Classes/Api/MOP_addWebExtentionApi.h @@ -9,7 +9,7 @@ NS_ASSUME_NONNULL_BEGIN -@interface MOB_addWebExtentionApi : MOPBaseApi +@interface MOP_addWebExtentionApi : MOPBaseApi @property(nonatomic, copy) NSString* name; @end diff --git a/ios/Classes/Api/MOB_addWebExtentionApi.m b/ios/Classes/Api/MOP_addWebExtentionApi.m similarity index 96% rename from ios/Classes/Api/MOB_addWebExtentionApi.m rename to ios/Classes/Api/MOP_addWebExtentionApi.m index ba81192..0059d5b 100644 --- a/ios/Classes/Api/MOB_addWebExtentionApi.m +++ b/ios/Classes/Api/MOP_addWebExtentionApi.m @@ -5,11 +5,11 @@ // Created by 王滔 on 2021/12/21. // -#import "MOB_addWebExtentionApi.h" +#import "MOP_addWebExtentionApi.h" #import "MopPlugin.h" #import -@implementation MOB_addWebExtentionApi +@implementation MOP_addWebExtentionApi - (void)setupApiWithSuccess:(void (^)(NSDictionary * _Nonnull))success failure:(void (^)(id _Nullable))failure cancel:(void (^)(void))cancel { diff --git a/ios/Classes/Api/MOP_changeUserId.h b/ios/Classes/Api/MOP_changeUserId.h new file mode 100644 index 0000000..d31b845 --- /dev/null +++ b/ios/Classes/Api/MOP_changeUserId.h @@ -0,0 +1,16 @@ +// +// MOP_changeUserId.h +// mop +// +// Created by 滔 on 2023/3/23. +// + +#import "MOPBaseApi.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface MOP_changeUserId : MOPBaseApi +@property (nonatomic, copy) NSString *userId; +@end + +NS_ASSUME_NONNULL_END diff --git a/ios/Classes/Api/MOP_changeUserId.m b/ios/Classes/Api/MOP_changeUserId.m new file mode 100644 index 0000000..c9ab9ef --- /dev/null +++ b/ios/Classes/Api/MOP_changeUserId.m @@ -0,0 +1,17 @@ +// +// MOP_changeUserId.m +// mop +// +// Created by 滔 on 2023/3/23. +// + +#import "MOP_changeUserId.h" +#import + +@implementation MOP_changeUserId +- (void)setupApiWithSuccess:(void (^)(NSDictionary * _Nonnull))success failure:(void (^)(id _Nullable))failure cancel:(void (^)(void))cancel +{ + [FATClient sharedClient].config.currentUserId = self.userId; + success(@{}); +} +@end diff --git a/ios/Classes/Api/MOP_initSDK.m b/ios/Classes/Api/MOP_initSDK.m index 57c0157..9b9a5bc 100644 --- a/ios/Classes/Api/MOP_initSDK.m +++ b/ios/Classes/Api/MOP_initSDK.m @@ -250,10 +250,16 @@ failure(@"初始化失败"); return; } - FATLogLevel logLevel = [self.config[@"logLevel"] integerValue]; - NSString *logDir = self.config[@"logDir"]; -// [[FATExtClient sharedClient] fat_prepareExtensionApis]; - [[FATClient sharedClient].logManager initLogWithLogDir:logDir logLevel:logLevel consoleLog:YES]; + + NSInteger logLevelIntValue = [self.config[@"logLevel"] integerValue]; + if (logLevelIntValue >= 5) { + [[FATClient sharedClient].logManager closeLog]; + } else { + FATLogLevel logLevel = logLevelIntValue; + NSString *logDir = self.config[@"logDir"]; + [[FATClient sharedClient].logManager initLogWithLogDir:logDir logLevel:logLevel consoleLog:YES]; + } + [[FATClient sharedClient] setEnableLog:YES];