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];