2020-02-27 17:21:45 +08:00
|
|
|
//
|
|
|
|
// MOP_initialize.m
|
|
|
|
// mop
|
|
|
|
//
|
|
|
|
// Created by 杨涛 on 2020/2/27.
|
|
|
|
//
|
|
|
|
|
|
|
|
#import "MOP_initialize.h"
|
|
|
|
#import <FinApplet/FinApplet.h>
|
2020-12-10 17:17:13 +08:00
|
|
|
#import <FinAppletExt/FinAppletExt.h>
|
2021-12-09 15:18:35 +08:00
|
|
|
// #import <FinAppletWebRTC/FinAppletWebRTC.h>
|
2020-02-27 17:21:45 +08:00
|
|
|
|
|
|
|
@implementation MOP_initialize
|
|
|
|
|
|
|
|
- (void)setupApiWithSuccess:(void (^)(NSDictionary<NSString *,id> * _Nonnull))success failure:(void (^)(id _Nullable))failure cancel:(void (^)(void))cancel
|
|
|
|
{
|
|
|
|
if (!self.appkey || !self.secret) {
|
|
|
|
failure(@"appkey 或 secret不能为空");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (!self.apiServer || [self.apiServer isEqualToString:@""]) {
|
2021-01-12 15:24:37 +08:00
|
|
|
self.apiServer = @"https://api.finclip.com";
|
2020-02-27 17:21:45 +08:00
|
|
|
}
|
|
|
|
if (!self.apiPrefix|| [self.apiPrefix isEqualToString:@""]) {
|
|
|
|
self.apiPrefix = @"/api/v1/mop";
|
|
|
|
}
|
|
|
|
FATConfig *config = [FATConfig configWithAppSecret:self.secret appKey:self.appkey];
|
|
|
|
config.apiServer = [self.apiServer copy];
|
|
|
|
config.apiPrefix = [self.apiPrefix copy];
|
2020-05-19 16:42:10 +08:00
|
|
|
if([self.cryptType isEqualToString: @"SM"])
|
|
|
|
{
|
|
|
|
config.cryptType = FATApiCryptTypeSM;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
config.cryptType = FATApiCryptTypeMD5;
|
|
|
|
}
|
2021-06-02 15:19:57 +08:00
|
|
|
config.currentUserId = [self.userId copy];
|
2021-08-13 10:57:06 +08:00
|
|
|
// encryptServerData
|
|
|
|
NSLog(@"encryptServerData:%d",self.encryptServerData);
|
|
|
|
config.encryptServerData = self.encryptServerData;
|
|
|
|
|
2020-07-27 09:13:55 +08:00
|
|
|
NSLog(@"disablePermission:%d",self.disablePermission);
|
|
|
|
config.disableAuthorize = self.disablePermission;
|
2020-02-27 17:21:45 +08:00
|
|
|
NSError* error = nil;
|
2020-07-31 15:33:48 +08:00
|
|
|
FATUIConfig *uiconfig = [[FATUIConfig alloc]init];
|
|
|
|
uiconfig.autoAdaptDarkMode = YES;
|
2021-03-24 17:26:39 +08:00
|
|
|
// uiconfig.moreMenuStyle = FATMoreViewStyleNormal;
|
2020-07-31 15:33:48 +08:00
|
|
|
[[FATClient sharedClient] initWithConfig:config uiConfig:uiconfig error:&error];
|
2020-02-27 17:21:45 +08:00
|
|
|
if (error) {
|
|
|
|
failure(@"初始化失败");
|
|
|
|
return;
|
|
|
|
}
|
2021-11-18 18:18:14 +08:00
|
|
|
// [[FATExtClient sharedClient] fat_prepareExtensionApis];
|
2021-11-18 09:32:17 +08:00
|
|
|
// [[FATExtClient sharedClient] fat_UsingMapType:@"FATExtMapStyleGD" MapKey:@"6f0f28c4138cbaa51aa5890e26996ea2"];
|
2021-12-17 15:55:25 +08:00
|
|
|
|
2022-01-06 18:14:39 +08:00
|
|
|
// [FATGDMapComponent setGDMapAppKey:@"6f0f28c4138cbaa51aa5890e26996ea2"];
|
2021-06-17 10:06:32 +08:00
|
|
|
[[FATClient sharedClient] setEnableLog:YES];
|
2021-12-09 15:18:35 +08:00
|
|
|
// [FATWebRTCComponent registerComponent];
|
2020-02-27 17:21:45 +08:00
|
|
|
success(@{});
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@end
|