Merge branch 'master' into X5

# Conflicts:
#	android/src/main/java/com/finogeeks/mop/api/mop/BaseModule.java
#	lib/mop.dart
master
zhongweiguang 2023-03-24 11:18:27 +08:00
commit 484a2878b2
13 changed files with 1349 additions and 126 deletions

View File

@ -8,6 +8,7 @@ import com.finogeeks.mop.api.mop.AppletManageModule;
import com.finogeeks.mop.api.mop.AppletModule;
import com.finogeeks.mop.api.mop.BaseModule;
import com.finogeeks.mop.api.mop.ExtensionApiModule;
import com.finogeeks.mop.api.mop.InitSDKModule;
import com.finogeeks.mop.api.mop.VersionModule;
import com.finogeeks.mop.api.mop.SmSignModule;
import com.finogeeks.mop.api.mop.WXQrCodeModule;
@ -65,6 +66,7 @@ public class ApisManager {
}
private void initSdkApi(Activity activity) {
add(new InitSDKModule(activity));
add(new BaseModule(activity));
add(new AppletModule(activity));
add(new AppletManageModule(activity));

View File

@ -4,17 +4,16 @@ import android.app.Application;
import android.content.Context;
import android.util.Log;
import com.finogeeks.lib.applet.BuildConfig;
import com.finogeeks.lib.applet.client.FinAppClient;
import com.finogeeks.lib.applet.client.FinAppConfig;
import com.finogeeks.lib.applet.client.FinStoreConfig;
import com.finogeeks.lib.applet.interfaces.FinCallback;
import com.finogeeks.mop.api.BaseApi;
import com.finogeeks.mop.api.mop.util.InitUtils;
import com.finogeeks.mop.interfaces.ICallback;
import com.finogeeks.mop.service.MopPluginService;
import com.finogeeks.xlog.XLogLevel;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import java.io.File;
import java.util.ArrayList;
@ -22,7 +21,7 @@ import java.util.List;
import java.util.Map;
public class BaseModule extends BaseApi {
private final static String TAG = BaseModule.class.getSimpleName();
private final static String TAG = "BaseModule";
public BaseModule(Context context) {
super(context);
@ -118,11 +117,9 @@ public class BaseModule extends BaseApi {
}
}
}
FinAppConfig.UIConfig uiConfig = null;
if (param.get("uiConfig") != null) {
uiConfig = gson.fromJson(gson.toJson(param.get("uiConfig")), FinAppConfig.UIConfig.class);
}
// uiConfig
FinAppConfig.UIConfig uiConfig = InitUtils.createUIConfigFromMap((Map<Object, Object>) param.get("uiConfig"));
FinAppConfig.Builder builder = new FinAppConfig.Builder()
.setSdkKey(appkey)
@ -137,11 +134,10 @@ public class BaseModule extends BaseApi {
.setBindAppletWithMainProcess(bindAppletWithMainProcess)
.setLogLevel(XLogLevel.LEVEL_VERBOSE)
.setXLogDir(new File(getContext().getExternalCacheDir(),"xlog"))
.setPageCountLimit(pageCountLimit)
.setUseLocalTbsCore(useLocalTbsCore)
.setTbsCoreUrl(tbsCoreUrl);
// .setPageCountLimit(pageCountLimit);
if (customWebViewUserAgent != null)
builder.setCustomWebViewUserAgent(customWebViewUserAgent);
if (appletIntervalUpdateLimit != null)

View File

@ -0,0 +1,215 @@
package com.finogeeks.mop.api.mop;
import android.app.Application;
import android.content.Context;
import android.util.Log;
import com.finogeeks.lib.applet.client.FinAppClient;
import com.finogeeks.lib.applet.client.FinAppConfig;
import com.finogeeks.lib.applet.client.FinAppConfigPriority;
import com.finogeeks.lib.applet.client.FinStoreConfig;
import com.finogeeks.lib.applet.interfaces.FinCallback;
import com.finogeeks.mop.api.BaseApi;
import com.finogeeks.mop.api.mop.util.InitUtils;
import com.finogeeks.mop.interfaces.ICallback;
import com.finogeeks.mop.service.MopPluginService;
import com.finogeeks.xlog.XLogLevel;
import com.google.gson.Gson;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class InitSDKModule extends BaseApi {
private final static String TAG = "InitSDKModule";
public InitSDKModule(Context context) {
super(context);
}
@Override
public String[] apis() {
return new String[]{"initSDK"};
}
@Override
@SuppressWarnings("unchecked")
public void invoke(String event, Map param, ICallback callback) {
if (FinAppClient.INSTANCE.isFinAppProcess(super.getContext())) {
//
return;
}
Log.d(TAG, "param:" + param);
FinAppConfig.Builder configBuilder = new FinAppConfig.Builder();
// config
Map<Object, Object> configMap = (Map<Object, Object>) param.get("config");
List<Map<Object, Object>> finStoreConfigs = (List<Map<Object, Object>>) configMap.get("finStoreConfigs");
List<FinStoreConfig> storeConfigs = new ArrayList<>();
for (Map<Object, Object> store : finStoreConfigs) {
String sdkKey = (String) store.get("sdkKey");
String sdkSecret = (String) store.get("sdkSecret");
String apiServer = (String) store.get("apiServer");
String apmServer = (String) store.get("apmServer");
if (apmServer == null) {
apmServer = "";
}
String fingerprint = (String) store.get("fingerprint");
if (fingerprint == null) {
fingerprint = "";
}
String cryptType = (String) store.get("cryptType");
Boolean encryptServerData = (Boolean) store.get("encryptServerData");
storeConfigs.add(new FinStoreConfig(sdkKey, sdkSecret, apiServer, apmServer, "",
fingerprint, cryptType, encryptServerData));
}
configBuilder.setFinStoreConfigs(storeConfigs);
String userId = (String) configMap.get("userId");
if (userId != null) {
configBuilder.setUserId(userId);
}
String productIdentification = (String) configMap.get("productIdentification");
if (productIdentification != null) {
configBuilder.setProductIdentification(productIdentification);
}
configBuilder.setDisableRequestPermissions((Boolean) configMap.get("disableRequestPermissions"));
configBuilder.setAppletAutoAuthorize((Boolean) configMap.get("appletAutoAuthorize"));
configBuilder.setDisableGetSuperviseInfo((Boolean) configMap.get("disableGetSuperviseInfo"));
configBuilder.setIgnoreWebviewCertAuth((Boolean) configMap.get("ignoreWebviewCertAuth"));
configBuilder.setAppletIntervalUpdateLimit((Integer) configMap.get("appletIntervalUpdateLimit"));
Map<String, Object> apmExtendInfo = (Map<String, Object>) configMap.get("apmExtendInfo");
if (apmExtendInfo != null) {
configBuilder.setApmExtendInfo(apmExtendInfo);
}
configBuilder.setEnableApmDataCompression((Boolean) configMap.get("enableApmDataCompression"));
configBuilder.setEncryptServerData((Boolean) configMap.get("encryptServerData"));
configBuilder.setEncryptServerData((Boolean) configMap.get("encryptServerData"));
int appletDebugModeIndex = (Integer) configMap.get("appletDebugMode");
if (appletDebugModeIndex == 0) {
configBuilder.setAppletDebugMode(FinAppConfig.AppletDebugMode.appletDebugModeUndefined);
} else if (appletDebugModeIndex == 1) {
configBuilder.setAppletDebugMode(FinAppConfig.AppletDebugMode.appletDebugModeEnable);
} else if (appletDebugModeIndex == 2) {
configBuilder.setAppletDebugMode(FinAppConfig.AppletDebugMode.appletDebugModeDisable);
} else if (appletDebugModeIndex == 3) {
configBuilder.setAppletDebugMode(FinAppConfig.AppletDebugMode.appletDebugModeForbidden);
}
configBuilder.setEnableWatermark((Boolean) configMap.get("enableWatermark"));
int watermarkPriorityIndex = (Integer) configMap.get("watermarkPriority");
if (watermarkPriorityIndex == 0) {
configBuilder.setWatermarkPriority(FinAppConfigPriority.GLOBAL);
} else if (watermarkPriorityIndex == 1) {
configBuilder.setWatermarkPriority(FinAppConfigPriority.SPECIFIED);
} else if (watermarkPriorityIndex == 2) {
configBuilder.setWatermarkPriority(FinAppConfigPriority.APPLET_FILE);
}
Map<String, String> header = (Map<String, String>) configMap.get("header");
if (header != null) {
configBuilder.setHeader(header);
}
int headerPriorityIndex = (Integer) configMap.get("headerPriority");
if (headerPriorityIndex == 0) {
configBuilder.setHeaderPriority(FinAppConfigPriority.GLOBAL);
} else if (headerPriorityIndex == 1) {
configBuilder.setHeaderPriority(FinAppConfigPriority.SPECIFIED);
} else if (headerPriorityIndex == 2) {
configBuilder.setHeaderPriority(FinAppConfigPriority.APPLET_FILE);
}
configBuilder.setPageCountLimit((Integer) configMap.get("pageCountLimit"));
String[] schemes = (String[]) configMap.get("schemes");
if (schemes != null) {
configBuilder.setSchemes(schemes);
}
configBuilder.setDebugMode((Boolean) configMap.get("debug"));
Integer maxRunningApplet = (Integer) configMap.get("maxRunningApplet");
if (maxRunningApplet != null) {
configBuilder.setMaxRunningApplet(maxRunningApplet);
}
Integer webViewMixedContentMode = (Integer) configMap.get("webViewMixedContentMode");
if (webViewMixedContentMode != null) {
configBuilder.setWebViewMixedContentMode(webViewMixedContentMode);
}
configBuilder.setBindAppletWithMainProcess((Boolean) configMap.get("bindAppletWithMainProcess"));
String killAppletProcessNotice = (String) configMap.get("killAppletProcessNotice");
if (killAppletProcessNotice != null) {
configBuilder.setKillAppletProcessNotice(killAppletProcessNotice);
}
configBuilder.setMinAndroidSdkVersion((Integer) configMap.get("minAndroidSdkVersion"));
configBuilder.setEnableScreenShot((Boolean) configMap.get("enableScreenShot"));
int screenShotPriorityIndex = (Integer) configMap.get("screenShotPriority");
if (screenShotPriorityIndex == 0) {
configBuilder.setScreenShotPriority(FinAppConfigPriority.GLOBAL);
} else if (screenShotPriorityIndex == 1) {
configBuilder.setScreenShotPriority(FinAppConfigPriority.SPECIFIED);
} else if (screenShotPriorityIndex == 2) {
configBuilder.setScreenShotPriority(FinAppConfigPriority.APPLET_FILE);
}
int logLevelIndex = (Integer) configMap.get("logLevel");
if (logLevelIndex == 0) {
configBuilder.setLogLevel(XLogLevel.LEVEL_ERROR);
} else if (logLevelIndex == 1) {
configBuilder.setLogLevel(XLogLevel.LEVEL_WARNING);
} else if (logLevelIndex == 2) {
configBuilder.setLogLevel(XLogLevel.LEVEL_INFO);
} else if (logLevelIndex == 3) {
configBuilder.setLogLevel(XLogLevel.LEVEL_DEBUG);
} else if (logLevelIndex == 4) {
configBuilder.setLogLevel(XLogLevel.LEVEL_VERBOSE);
} else if (logLevelIndex == 5) {
configBuilder.setLogLevel(XLogLevel.LEVEL_NONE);
}
Integer logMaxAliveSec = (Integer) configMap.get("logMaxAliveSec");
if (logMaxAliveSec != null) {
configBuilder.setLogMaxAliveSec(logMaxAliveSec);
}
String logDir = (String) configMap.get("logDir");
if (logDir != null) {
configBuilder.setXLogDir(logDir);
}
configBuilder.setEnablePreNewProcess((Boolean) configMap.get("enablePreNewProcess"));
Map<Object, Object> uiConfigMap = (Map<Object, Object>) param.get("uiConfig");
String appendingCustomUserAgent = (String) uiConfigMap.get("appendingCustomUserAgent");
if (appendingCustomUserAgent != null) {
configBuilder.setCustomWebViewUserAgent(appendingCustomUserAgent);
}
String appletText = (String) uiConfigMap.get("appletText");
if (appletText != null) {
configBuilder.setAppletText(appletText);
}
// uiConfig
FinAppConfig.UIConfig uiConfig = InitUtils.createUIConfigFromMap(uiConfigMap);
if (uiConfig != null) {
configBuilder.setUiConfig(uiConfig);
}
FinAppConfig finAppConfig = configBuilder.build();
Log.d(TAG, "finAppConfig:" + new Gson().toJson(finAppConfig));
final Application application = MopPluginService.getInstance().getActivity().getApplication();
// SDKSDK
FinCallback<Object> cb = new FinCallback<Object>() {
@Override
public void onSuccess(Object result) {
// SDK
callback.onSuccess(null);
}
@Override
public void onError(int code, String error) {
// SDK
callback.onFail(null);
}
@Override
public void onProgress(int status, String error) {
}
};
FinAppClient.INSTANCE.init(application, finAppConfig, cb);
}
}

View File

@ -0,0 +1,161 @@
package com.finogeeks.mop.api.mop.util;
import com.finogeeks.lib.applet.client.FinAppConfig;
import com.finogeeks.lib.applet.client.FinAppConfigPriority;
import java.util.Map;
public class InitUtils {
public static FinAppConfig.UIConfig createUIConfigFromMap(Map<Object, Object> map) {
if (map != null) {
FinAppConfig.UIConfig uiConfig = new FinAppConfig.UIConfig();
uiConfig.setNavigationBarTitleLightColor((Integer) map.get("navigationBarTitleLightColor"));
uiConfig.setNavigationBarTitleDarkColor((Integer) map.get("navigationBarTitleDarkColor"));
uiConfig.setNavigationBarBackBtnLightColor((Integer) map.get("navigationBarBackBtnLightColor"));
uiConfig.setAlwaysShowBackInDefaultNavigationBar((Boolean) map.get("isAlwaysShowBackInDefaultNavigationBar"));
uiConfig.setClearNavigationBarNavButtonBackground((Boolean) map.get("isClearNavigationBarNavButtonBackground"));
uiConfig.setHideFeedbackAndComplaints((Boolean) map.get("isHideFeedbackAndComplaints"));
uiConfig.setHideBackHome((Boolean) map.get("isHideBackHome"));
uiConfig.setHideForwardMenu((Boolean) map.get("isHideForwardMenu"));
uiConfig.setHideRefreshMenu((Boolean) map.get("isHideRefreshMenu"));
uiConfig.setHideShareAppletMenu((Boolean) map.get("isHideShareAppletMenu"));
uiConfig.setHideAddToDesktopMenu((Boolean) map.get("isHideAddToDesktopMenu"));
uiConfig.setHideFavoriteMenu((Boolean) map.get("isHideFavoriteMenu"));
uiConfig.setHideSettingMenu((Boolean) map.get("isHideSettingMenu"));
uiConfig.setHideTransitionCloseButton((Boolean) map.get("hideTransitionCloseButton"));
Map<Object, Object> capsuleConfigMap = (Map<Object, Object>) map.get("capsuleConfig");
if (capsuleConfigMap != null) {
FinAppConfig.UIConfig.CapsuleConfig capsuleConfig = new FinAppConfig.UIConfig.CapsuleConfig();
capsuleConfig.capsuleWidth = (float) capsuleConfigMap.get("capsuleWidth");
capsuleConfig.capsuleHeight = (float) capsuleConfigMap.get("capsuleHeight");
capsuleConfig.capsuleRightMargin = (float) capsuleConfigMap.get("capsuleRightMargin");
capsuleConfig.capsuleCornerRadius = (float) capsuleConfigMap.get("capsuleCornerRadius");
capsuleConfig.capsuleBorderWidth = (float) capsuleConfigMap.get("capsuleBorderWidth");
capsuleConfig.capsuleBgLightColor = (int) capsuleConfigMap.get("capsuleBgLightColor");
capsuleConfig.capsuleBgDarkColor = (int) capsuleConfigMap.get("capsuleBgDarkColor");
capsuleConfig.capsuleBorderLightColor = (int) capsuleConfigMap.get("capsuleBorderLightColor");
capsuleConfig.capsuleBorderDarkColor = (int) capsuleConfigMap.get("capsuleBorderDarkColor");
capsuleConfig.capsuleDividerLightColor = (int) capsuleConfigMap.get("capsuleDividerLightColor");
capsuleConfig.capsuleDividerDarkColor = (int) capsuleConfigMap.get("capsuleDividerDarkColor");
Integer moreLightImage = (Integer) capsuleConfigMap.get("moreLightImage");
if (moreLightImage != null) {
capsuleConfig.moreLightImage = moreLightImage;
}
Integer moreDarkImage = (Integer) capsuleConfigMap.get("moreDarkImage");
if (moreDarkImage != null) {
capsuleConfig.moreDarkImage = moreDarkImage;
}
capsuleConfig.moreBtnWidth = (float) capsuleConfigMap.get("moreBtnWidth");
capsuleConfig.moreBtnLeftMargin = (float) capsuleConfigMap.get("moreBtnLeftMargin");
Integer closeLightImage = (Integer) capsuleConfigMap.get("closeLightImage");
if (closeLightImage != null) {
capsuleConfig.closeLightImage = closeLightImage;
}
Integer closeDarkImage = (Integer) capsuleConfigMap.get("closeDarkImage");
if (closeDarkImage != null) {
capsuleConfig.closeDarkImage = closeDarkImage;
}
capsuleConfig.closeBtnWidth = (float) capsuleConfigMap.get("closeBtnWidth");
capsuleConfig.closeBtnLeftMargin = (float) capsuleConfigMap.get("closeBtnLeftMargin");
uiConfig.setCapsuleConfig(capsuleConfig);
}
Map<Object, Object> navHomeConfigMap = (Map<Object, Object>) map.get("navHomeConfig");
if (navHomeConfigMap != null) {
FinAppConfig.UIConfig.NavHomeConfig navHomeConfig = new FinAppConfig.UIConfig.NavHomeConfig();
navHomeConfig.width = (float) navHomeConfigMap.get("width");
navHomeConfig.height = (float) navHomeConfigMap.get("height");
navHomeConfig.leftMargin = (float) navHomeConfigMap.get("leftMargin");
navHomeConfig.cornerRadius = (float) navHomeConfigMap.get("cornerRadius");
navHomeConfig.borderWidth = (float) navHomeConfigMap.get("borderWidth");
navHomeConfig.borderLightColor = (int) navHomeConfigMap.get("borderLightColor");
navHomeConfig.borderDarkColor = (int) navHomeConfigMap.get("borderDarkColor");
navHomeConfig.bgLightColor = (int) navHomeConfigMap.get("bgLightColor");
navHomeConfig.bgDarkColor = (int) navHomeConfigMap.get("bgDarkColor");
uiConfig.setNavHomeConfig(navHomeConfig);
}
Map<Object, Object> authViewConfigMap = (Map<Object, Object>) map.get("authViewConfig");
if (authViewConfigMap != null) {
FinAppConfig.UIConfig.AuthViewConfig authViewConfig = new FinAppConfig.UIConfig.AuthViewConfig();
authViewConfig.appletNameTextSize = (float) authViewConfigMap.get("appletNameTextSize");
authViewConfig.appletNameLightColor = (int) authViewConfigMap.get("appletNameLightColor");
authViewConfig.appletNameDarkColor = (int) authViewConfigMap.get("appletNameDarkColor");
authViewConfig.authorizeTitleTextSize = (float) authViewConfigMap.get("authorizeTitleTextSize");
authViewConfig.authorizeTitleLightColor = (int) authViewConfigMap.get("authorizeTitleLightColor");
authViewConfig.authorizeTitleDarkColor = (int) authViewConfigMap.get("authorizeTitleDarkColor");
authViewConfig.authorizeDescriptionTextSize = (float) authViewConfigMap.get("authorizeDescriptionTextSize");
authViewConfig.authorizeDescriptionLightColor = (int) authViewConfigMap.get("authorizeDescriptionLightColor");
authViewConfig.authorizeDescriptionDarkColor = (int) authViewConfigMap.get("authorizeDescriptionDarkColor");
authViewConfig.agreementTitleTextSize = (float) authViewConfigMap.get("agreementTitleTextSize");
authViewConfig.agreementTitleLightColor = (int) authViewConfigMap.get("agreementTitleLightColor");
authViewConfig.agreementTitleDarkColor = (int) authViewConfigMap.get("agreementTitleDarkColor");
authViewConfig.agreementDescriptionTextSize = (float) authViewConfigMap.get("agreementDescriptionTextSize");
authViewConfig.agreementDescriptionLightColor = (int) authViewConfigMap.get("agreementDescriptionLightColor");
authViewConfig.agreementDescriptionDarkColor = (int) authViewConfigMap.get("agreementDescriptionDarkColor");
authViewConfig.linkLightColor = (int) authViewConfigMap.get("linkLightColor");
authViewConfig.linkDarkColor = (int) authViewConfigMap.get("linkDarkColor");
Map<Object, Object> allowButtonLightConfig = (Map<Object, Object>) authViewConfigMap.get("allowButtonLightConfig");
if (allowButtonLightConfig != null) {
authViewConfig.allowButtonLightConfig = getAuthButtonConfig(allowButtonLightConfig);
}
Map<Object, Object> allowButtonDarkConfig = (Map<Object, Object>) authViewConfigMap.get("allowButtonDarkConfig");
if (allowButtonDarkConfig != null) {
authViewConfig.allowButtonDarkConfig = getAuthButtonConfig(allowButtonDarkConfig);
}
Map<Object, Object> rejectButtonLightConfig = (Map<Object, Object>) authViewConfigMap.get("rejectButtonLightConfig");
if (rejectButtonLightConfig != null) {
authViewConfig.rejectButtonLightConfig = getAuthButtonConfig(rejectButtonLightConfig);
}
Map<Object, Object> rejectButtonDarkConfig = (Map<Object, Object>) authViewConfigMap.get("rejectButtonDarkConfig");
if (rejectButtonDarkConfig != null) {
authViewConfig.rejectButtonDarkConfig = getAuthButtonConfig(rejectButtonDarkConfig);
}
uiConfig.setAuthViewConfig(authViewConfig);
}
Map<Object, Object> floatWindowConfigMap = (Map<Object, Object>) map.get("floatWindowConfig");
if (floatWindowConfigMap != null) {
FinAppConfig.UIConfig.FloatWindowConfig floatWindowConfig = new FinAppConfig.UIConfig.FloatWindowConfig();
floatWindowConfig.floatMode = (boolean) floatWindowConfigMap.get("floatMode");
floatWindowConfig.x = (int) floatWindowConfigMap.get("x");
floatWindowConfig.y = (int) floatWindowConfigMap.get("y");
floatWindowConfig.width = (int) floatWindowConfigMap.get("width");
floatWindowConfig.height = (int) floatWindowConfigMap.get("height");
uiConfig.setFloatWindowConfig(floatWindowConfig);
}
Integer webViewProgressBarColor = (Integer) map.get("webViewProgressBarColor");
if (webViewProgressBarColor != null) {
uiConfig.setWebViewProgressBarColor(webViewProgressBarColor);
}
uiConfig.setHideWebViewProgressBar((Boolean) map.get("hideWebViewProgressBar"));
uiConfig.setMoreMenuStyle((Integer) map.get("moreMenuStyle"));
int isHideBackHomePriorityIndex = (Integer) map.get("isHideBackHomePriority");
if (isHideBackHomePriorityIndex == 0) {
uiConfig.setIsHideBackHomePriority(FinAppConfigPriority.GLOBAL);
} else if (isHideBackHomePriorityIndex == 1) {
uiConfig.setIsHideBackHomePriority(FinAppConfigPriority.SPECIFIED);
} else if (isHideBackHomePriorityIndex == 2) {
uiConfig.setIsHideBackHomePriority(FinAppConfigPriority.APPLET_FILE);
}
uiConfig.setAutoAdaptDarkMode((Boolean) map.get("autoAdaptDarkMode"));
uiConfig.setDisableSlideCloseAppletGesture((Boolean) map.get("disableSlideCloseAppletGesture"));
String loadingLayoutCls = (String) map.get("loadingLayoutCls");
if (loadingLayoutCls != null) {
uiConfig.setLoadingLayoutCls(loadingLayoutCls);
}
return uiConfig;
}
return null;
}
private static FinAppConfig.UIConfig.AuthViewConfig.AuthButtonConfig getAuthButtonConfig(Map<Object, Object> map) {
return new FinAppConfig.UIConfig.AuthViewConfig.AuthButtonConfig(
(float) map.get("cornerRadius"),
(int) map.get("normalBackgroundColor"),
(int) map.get("pressedBackgroundColor"),
(int) map.get("normalBorderColor"),
(int) map.get("pressedBorderColor"),
(int) map.get("normalTextColor"),
(int) map.get("pressedTextColor")
);
}
}

View File

@ -9,7 +9,7 @@
NS_ASSUME_NONNULL_BEGIN
@interface MOB_addWebExtentionApi : MOPBaseApi
@interface MOP_addWebExtentionApi : MOPBaseApi
@property(nonatomic, copy) NSString* name;
@end

View File

@ -5,11 +5,11 @@
// Created by on 2021/12/21.
//
#import "MOB_addWebExtentionApi.h"
#import "MOP_addWebExtentionApi.h"
#import "MopPlugin.h"
#import <FinApplet/FinApplet.h>
@implementation MOB_addWebExtentionApi
@implementation MOP_addWebExtentionApi
- (void)setupApiWithSuccess:(void (^)(NSDictionary<NSString *,id> * _Nonnull))success failure:(void (^)(id _Nullable))failure cancel:(void (^)(void))cancel
{

View File

@ -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

View File

@ -0,0 +1,17 @@
//
// MOP_changeUserId.m
// mop
//
// Created by on 2023/3/23.
//
#import "MOP_changeUserId.h"
#import <FinApplet/FinApplet.h>
@implementation MOP_changeUserId
- (void)setupApiWithSuccess:(void (^)(NSDictionary<NSString *,id> * _Nonnull))success failure:(void (^)(id _Nullable))failure cancel:(void (^)(void))cancel
{
[FATClient sharedClient].config.currentUserId = self.userId;
success(@{});
}
@end

View File

@ -0,0 +1,18 @@
//
// Mop_initSDK.h
// mop
//
// Created by on 2023/3/17.
//
#import <UIKit/UIKit.h>
#import "MOPBaseApi.h"
NS_ASSUME_NONNULL_BEGIN
@interface MOP_initSDK : MOPBaseApi
@property (nonatomic, strong) NSDictionary *config;
@property (nonatomic, strong) NSDictionary *uiConfig;
@end
NS_ASSUME_NONNULL_END

View File

@ -0,0 +1,302 @@
//
// Mop_newInitialize.m
// mop
//
// Created by on 2023/3/17.
//
#import "Mop_initSDK.h"
#import "MOPTools.h"
@implementation MOP_initSDK
- (void)setupApiWithSuccess:(void (^)(NSDictionary<NSString *,id> * _Nonnull))success failure:(void (^)(id _Nullable))failure cancel:(void (^)(void))cancel
{
if (!self.config) {
failure(@"config不能为空");
return;
}
FATConfig *config;
NSArray *storeConfigList = self.config[@"finStoreConfigs"];
if (storeConfigList && storeConfigList.count > 0) {
NSMutableArray *storeArrayM = [NSMutableArray array];
for (NSDictionary *dict in storeConfigList) {
FATStoreConfig *storeConfig = [[FATStoreConfig alloc] init];
storeConfig.sdkKey = dict[@"sdkKey"];
storeConfig.sdkSecret = dict[@"sdkSecret"];
storeConfig.apiServer = dict[@"apiServer"];
storeConfig.apmServer = dict[@"apmServer"];
storeConfig.fingerprint = dict[@"fingerprint"];
if ([@"SM" isEqualToString:dict[@"cryptType"]]) {
storeConfig.cryptType = FATApiCryptTypeSM;
} else {
storeConfig.cryptType = FATApiCryptTypeMD5;
}
storeConfig.encryptServerData = [dict[@"encryptServerData"] boolValue];
[storeArrayM addObject:storeConfig];
}
config = [FATConfig configWithStoreConfigs:storeArrayM];
} else {
failure(@"storeConfigs不能为空");
return;
}
config.currentUserId = self.config[@"userId"];
config.productIdentification = self.config[@"productIdentification"];
config.disableAuthorize = [self.config[@"disableRequestPermissions"] boolValue];
config.appletAutoAuthorize = [self.config[@"appletAutoAuthorize"] boolValue];
config.disableGetSuperviseInfo = [self.config[@"disableGetSuperviseInfo"] boolValue];
config.ignoreWebviewCertAuth = [self.config[@"ignoreWebviewCertAuth"] boolValue];
config.appletIntervalUpdateLimit = [self.config[@"appletIntervalUpdateLimit"] integerValue];
config.startCrashProtection = [self.config[@"startCrashProtection"] boolValue];
config.enableApmDataCompression = [self.config[@"enableApmDataCompression"] boolValue];
config.encryptServerData = [self.config[@"encryptServerData"] boolValue];
config.enableAppletDebug = [self.config[@"appletDebugMode"] integerValue];
config.enableWatermark = [self.config[@"enableWatermark"] boolValue];
config.watermarkPriority = [self.config[@"watermarkPriority"] integerValue];
config.baseLoadingViewClass = self.config[@"baseLoadingViewClass"];
config.baseLoadFailedViewClass = self.config[@"baseLoadFailedViewClass"];
config.header = self.config[@"header"];
config.headerPriority = [self.config[@"headerPriority"] integerValue];
config.enableH5AjaxHook = [self.config[@"enableH5AjaxHook"] boolValue];
config.h5AjaxHookRequestKey = self.config[@"h5AjaxHookRequestKey"];
config.pageCountLimit = [self.config[@"pageCountLimit"] integerValue];
config.schemes = self.config[@"schemes"];
NSError* error = nil;
FATUIConfig *uiconfig = [[FATUIConfig alloc]init];
uiconfig.autoAdaptDarkMode = YES;
if (_uiConfig) {
if (_uiConfig[@"navigationTitleTextAttributes"]) {
uiconfig.navigationTitleTextAttributes = _uiConfig[@"navigationTitleTextAttributes"];
}
uiconfig.navigationBarHeight = [_uiConfig[@"navigationBarHeight"] floatValue];
if (_uiConfig[@"navigationBarTitleLightColor"]) {
uiconfig.navigationBarTitleLightColor = [MOPTools colorWithRGBHex:[_uiConfig[@"navigationBarTitleLightColor"] intValue]];
}
if (_uiConfig[@"navigationBarTitleDarkColor"]) {
uiconfig.navigationBarTitleDarkColor = [MOPTools colorWithRGBHex:[_uiConfig[@"navigationBarTitleDarkColor"] intValue]];
}
if (_uiConfig[@"navigationBarBackBtnLightColor"]) {
uiconfig.navigationBarBackBtnLightColor = [MOPTools colorWithRGBHex:[_uiConfig[@"navigationBarBackBtnLightColor"] intValue]];
}
if (_uiConfig[@"navigationBarBackBtnDarkColor"]) {
uiconfig.navigationBarBackBtnDarkColor = [MOPTools colorWithRGBHex:[_uiConfig[@"navigationBarBackBtnDarkColor"] intValue]];
}
uiconfig.moreMenuStyle = [_uiConfig[@"moreMenuStyle"] integerValue];
uiconfig.hideBackToHomePriority = [_uiConfig[@"isHideBackHomePriority"] integerValue];
uiconfig.hideFeedbackMenu = [_uiConfig[@"isHideFeedbackAndComplaints"] boolValue];
uiconfig.hideBackToHome = [_uiConfig[@"isHideBackHome"] boolValue];
uiconfig.hideForwardMenu = [_uiConfig[@"isHideForwardMenu"] boolValue];
uiconfig.hideShareAppletMenu = [_uiConfig[@"isHideShareAppletMenu"] boolValue];
uiconfig.hideRefreshMenu = [_uiConfig[@"isHideRefreshMenu"] boolValue];
uiconfig.hideTransitionCloseButton = [_uiConfig[@"hideTransitionCloseButton"] boolValue];
uiconfig.disableSlideCloseAppletGesture = [_uiConfig[@"disableSlideCloseAppletGesture"] boolValue];
if (_uiConfig[@"webViewProgressBarColor"]) {
uiconfig.progressBarColor = [MOPTools colorWithRGBHex:[_uiConfig[@"webViewProgressBarColor"] intValue]];
}
uiconfig.hideFeedbackMenu = [_uiConfig[@"isHideFeedbackAndComplaints"] boolValue];
uiconfig.hideForwardMenu = [_uiConfig[@"isHideForwardMenu"] boolValue];
uiconfig.autoAdaptDarkMode = [_uiConfig[@"autoAdaptDarkMode"] boolValue];
uiconfig.hideSettingMenu = [_uiConfig[@"isHideSettingMenu"] boolValue];
uiconfig.hideFavoriteMenu = [_uiConfig[@"isHideFavoriteMenu"] boolValue];
uiconfig.hideAddToDesktopMenu = [_uiConfig[@"isHideAddToDesktopMenu"] boolValue];
uiconfig.appletText = _uiConfig[@"appletText"];
uiconfig.disableSlideCloseAppletGesture = [_uiConfig[@"disableSlideCloseAppletGesture"] boolValue];
if (_uiConfig[@"capsuleConfig"]) {
NSDictionary *capsuleConfigDic = _uiConfig[@"capsuleConfig"];
FATCapsuleConfig *capsuleConfig = [[FATCapsuleConfig alloc]init];
capsuleConfig.capsuleWidth = [capsuleConfigDic[@"capsuleWidth"] floatValue];
capsuleConfig.capsuleHeight = [capsuleConfigDic[@"capsuleHeight"] floatValue];
capsuleConfig.capsuleRightMargin = [capsuleConfigDic[@"capsuleRightMargin"] floatValue];
capsuleConfig.capsuleCornerRadius = [capsuleConfigDic[@"capsuleCornerRadius"] floatValue];
capsuleConfig.capsuleBorderWidth = [capsuleConfigDic[@"capsuleBorderWidth"] floatValue];
capsuleConfig.moreBtnWidth = [capsuleConfigDic[@"moreBtnWidth"] floatValue];
capsuleConfig.moreBtnLeftMargin = [capsuleConfigDic[@"moreBtnLeftMargin"] floatValue];
capsuleConfig.closeBtnWidth = [capsuleConfigDic[@"closeBtnWidth"] floatValue];
capsuleConfig.closeBtnLeftMargin = [capsuleConfigDic[@"closeBtnLeftMargin"] floatValue];
capsuleConfig.capsuleBorderLightColor = [MOPTools colorWithRGBHex:[capsuleConfigDic[@"capsuleBorderLightColor"] intValue]];
capsuleConfig.capsuleBorderDarkColor = [MOPTools colorWithRGBHex:[capsuleConfigDic[@"capsuleBorderDarkColor"] intValue]];
capsuleConfig.capsuleBgLightColor = [MOPTools colorWithRGBHex:[capsuleConfigDic[@"capsuleBgLightColor"] intValue]];
capsuleConfig.capsuleBgDarkColor = [MOPTools colorWithRGBHex:[capsuleConfigDic[@"capsuleBgDarkColor"] intValue]];
capsuleConfig.capsuleDividerLightColor = [MOPTools colorWithRGBHex:[capsuleConfigDic[@"capsuleDividerLightColor"] intValue]];
capsuleConfig.capsuleDividerDarkColor = [MOPTools colorWithRGBHex:[capsuleConfigDic[@"capsuleDividerDarkColor"] intValue]];
uiconfig.capsuleConfig = capsuleConfig;
}
if (_uiConfig[@"navHomeConfig"]) {
NSDictionary *navHomeConfigDic = _uiConfig[@"navHomeConfig"];
FATNavHomeConfig *navHomeConfig = [[FATNavHomeConfig alloc]init];
navHomeConfig.width = [navHomeConfigDic[@"width"] floatValue];
navHomeConfig.height = [navHomeConfigDic[@"height"] floatValue];
navHomeConfig.leftMargin = [navHomeConfigDic[@"leftMargin"] floatValue];
navHomeConfig.cornerRadius = [navHomeConfigDic[@"cornerRadius"] floatValue];
navHomeConfig.borderWidth = [navHomeConfigDic[@"width"] floatValue];
if (navHomeConfigDic[@"borderLightColor"]) {
navHomeConfig.borderLightColor = [MOPTools colorWithRGBHex:[navHomeConfigDic[@"borderLightColor"] intValue]];
}
if (navHomeConfigDic[@"borderDarkColor"]) {
navHomeConfig.borderDarkColor = [MOPTools colorWithRGBHex:[navHomeConfigDic[@"borderDarkColor"] intValue]];
}
if (navHomeConfigDic[@"bgLightColor"]) {
navHomeConfig.bgLightColor = [MOPTools colorWithRGBHex:[navHomeConfigDic[@"bgLightColor"] intValue]];
}
if (navHomeConfigDic[@"bgDarkColor"]) {
navHomeConfig.bgDarkColor = [MOPTools colorWithRGBHex:[navHomeConfigDic[@"bgDarkColor"] intValue]];
}
uiconfig.navHomeConfig = navHomeConfig;
}
if (_uiConfig[@"authViewConfig"]) {
NSDictionary *authViewConfigDic = _uiConfig[@"authViewConfig"];
FATAuthViewConfig *authViewConfig = [[FATAuthViewConfig alloc]init];
authViewConfig.appletNameFont = [UIFont systemFontOfSize:[authViewConfigDic[@"appletNameTextSize"] floatValue]];
if (authViewConfigDic[@"appletNameLightColor"]) {
authViewConfig.appletNameLightColor = [MOPTools colorWithRGBHex:[authViewConfigDic[@"appletNameLightColor"] intValue]];
}
if (authViewConfigDic[@"appletNameDarkColor"]) {
authViewConfig.appletNameDarkColor = [MOPTools colorWithRGBHex:[authViewConfigDic[@"appletNameDarkColor"] intValue]];
}
authViewConfig.authorizeTitleFont = [UIFont systemFontOfSize:[authViewConfigDic[@"authorizeTitleTextSize"] floatValue] weight:UIFontWeightMedium];
if (authViewConfigDic[@"authorizeTitleLightColor"]) {
authViewConfig.authorizeTitleLightColor = [MOPTools colorWithRGBHex:[authViewConfigDic[@"authorizeTitleLightColor"] intValue]];
}
if (authViewConfigDic[@"authorizeTitleDarkColor"]) {
authViewConfig.authorizeTitleDarkColor = [MOPTools colorWithRGBHex:[authViewConfigDic[@"authorizeTitleDarkColor"] intValue]];
}
authViewConfig.authorizeDescriptionFont = [UIFont systemFontOfSize:[authViewConfigDic[@"authorizeDescriptionTextSize"] floatValue]];
if (authViewConfigDic[@"authorizeDescriptionLightColor"]) {
authViewConfig.authorizeDescriptionLightColor = [MOPTools colorWithRGBHex:[authViewConfigDic[@"authorizeDescriptionLightColor"] intValue]];
}
if (authViewConfigDic[@"authorizeDescriptionDarkColor"]) {
authViewConfig.authorizeDescriptionDarkColor = [MOPTools colorWithRGBHex:[authViewConfigDic[@"authorizeDescriptionDarkColor"] intValue]];
}
authViewConfig.agreementTitleFont = [UIFont systemFontOfSize:[authViewConfigDic[@"agreementTitleTextSize"] floatValue]];
if (authViewConfigDic[@"agreementTitleLightColor"]) {
authViewConfig.agreementTitleLightColor = [MOPTools colorWithRGBHex:[authViewConfigDic[@"agreementTitleLightColor"] intValue]];
}
if (authViewConfigDic[@"agreementTitleDarkColor"]) {
authViewConfig.agreementTitleDarkColor = [MOPTools colorWithRGBHex:[authViewConfigDic[@"agreementTitleDarkColor"] intValue]];
}
authViewConfig.agreementDescriptionFont = [UIFont systemFontOfSize:[authViewConfigDic[@"agreementDescriptionTextSize"] floatValue]];
if (authViewConfigDic[@"agreementDescriptionLightColor"]) {
authViewConfig.agreementDescriptionLightColor = [MOPTools colorWithRGBHex:[authViewConfigDic[@"agreementDescriptionLightColor"] intValue]];
}
if (authViewConfigDic[@"agreementDescriptionDarkColor"]) {
authViewConfig.agreementDescriptionDarkColor = [MOPTools colorWithRGBHex:[authViewConfigDic[@"agreementDescriptionDarkColor"] intValue]];
}
if (authViewConfigDic[@"linkLightColor"]) {
authViewConfig.linkLightColor = [MOPTools colorWithRGBHex:[authViewConfigDic[@"linkLightColor"] intValue]];
}
if (authViewConfigDic[@"linkDarkColor"]) {
authViewConfig.linkDarkColor = [MOPTools colorWithRGBHex:[authViewConfigDic[@"linkDarkColor"] intValue]];
}
if (authViewConfigDic[@"allowButtonLightConfig"]) {
FATAuthButtonConfig *allowButtonLightConfig = [self createAuthButtonConfigWithDic:authViewConfigDic[@"allowButtonLightConfig"]];
authViewConfig.allowButtonLightConfig = allowButtonLightConfig;
}
if (authViewConfigDic[@"allowButtonDarkConfig"]) {
FATAuthButtonConfig *allowButtonDarkConfig = [self createAuthButtonConfigWithDic:authViewConfigDic[@"allowButtonDarkConfig"]];
authViewConfig.allowButtonDarkConfig = allowButtonDarkConfig;
}
if (authViewConfigDic[@"rejectButtonLightConfig"]) {
FATAuthButtonConfig *rejectButtonLightConfig = [self createAuthButtonConfigWithDic:authViewConfigDic[@"rejectButtonLightConfig"]];
authViewConfig.rejectButtonLightConfig = rejectButtonLightConfig;
}
if (authViewConfigDic[@"rejectButtonDarkConfig"]) {
FATAuthButtonConfig *rejectButtonDarkConfig = [self createAuthButtonConfigWithDic:authViewConfigDic[@"rejectButtonDarkConfig"]];
authViewConfig.rejectButtonDarkConfig = rejectButtonDarkConfig;
}
uiconfig.authViewConfig = authViewConfig;
}
uiconfig.appendingCustomUserAgent = _uiConfig[@"customWebViewUserAgent"];
uiconfig.hideWebViewProgressBar = [_uiConfig[@"hideWebViewProgressBar"] boolValue];
uiconfig.autoAdaptDarkMode = [_uiConfig[@"autoAdaptDarkMode"] boolValue];
uiconfig.transtionStyle = [_uiConfig[@"transtionStyle"] integerValue];
}
// uiconfig.moreMenuStyle = FATMoreViewStyleNormal;
[[FATClient sharedClient] initWithConfig:config uiConfig:uiconfig error:&error];
if (error) {
failure(@"初始化失败");
return;
}
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];
success(@{});
}
- (FATAuthButtonConfig *)createAuthButtonConfigWithDic:(NSDictionary *)dic {
if (!dic) {
return nil;
}
FATAuthButtonConfig * authButtonConfig = [[FATAuthButtonConfig alloc]init];
if (dic[@"cornerRadius"]) {
authButtonConfig.cornerRadius = [dic[@"cornerRadius"] floatValue];
}
if (dic[@"normalBackgroundColor"]) {
authButtonConfig.normalBackgroundColor = [MOPTools colorWithRGBHex:[dic[@"normalBackgroundColor"] intValue]];
}
if (dic[@"pressedBackgroundColor"]) {
authButtonConfig.pressedBackgroundColor = [MOPTools colorWithRGBHex:[dic[@"pressedBackgroundColor"] intValue]];
}
if (dic[@"normalTextColor"]) {
authButtonConfig.normalTextColor = [MOPTools colorWithRGBHex:[dic[@"normalTextColor"] intValue]];
}
if (dic[@"pressedTextColor"]) {
authButtonConfig.pressedTextColor = [MOPTools colorWithRGBHex:[dic[@"pressedTextColor"] intValue]];
}
if (dic[@"normalBorderColor"]) {
authButtonConfig.normalBorderColor = [MOPTools colorWithRGBHex:[dic[@"normalBorderColor"] intValue]];
}
if (dic[@"pressedBorderColor"]) {
authButtonConfig.pressedBorderColor = [MOPTools colorWithRGBHex:[dic[@"pressedBorderColor"] intValue]];
}
return authButtonConfig;
}
@end

View File

@ -30,7 +30,6 @@
for (NSDictionary *dict in _finStoreConfigs) {
FATStoreConfig *storeConfig = [[FATStoreConfig alloc] init];
storeConfig.sdkKey = dict[@"sdkKey"];
// storeConfig.sdkKey = @"22LyZEib0gLTQdU3MUauAb4V4W8Uxd/gMgmH8Hg1bGQ=";
storeConfig.sdkSecret = dict[@"sdkSecret"];
storeConfig.apiServer = dict[@"apiServer"];
storeConfig.apmServer = dict[@"apmServer"];
@ -82,8 +81,8 @@
if (_uiConfig[@"navigationTitleTextAttributes"]) {
uiconfig.navigationTitleTextAttributes = _uiConfig[@"navigationTitleTextAttributes"];
}
if (_uiConfig[@"progressBarColor"]) {
uiconfig.progressBarColor = [MOPTools colorWithRGBHex:[_uiConfig[@"progressBarColor"] intValue]];
if (_uiConfig[@"webViewProgressBarColor"]) {
uiconfig.progressBarColor = [MOPTools colorWithRGBHex:[_uiConfig[@"webViewProgressBarColor"] intValue]];
}
uiconfig.hideFeedbackMenu = [_uiConfig[@"isHideFeedbackAndComplaints"] boolValue];
uiconfig.hideForwardMenu = [_uiConfig[@"isHideForwardMenu"] boolValue];

View File

@ -20,7 +20,7 @@
Class ApiClass = NSClassFromString(apiMethod);
if (!ApiClass) {
NSLog(@"MOPybridExtensionConverter Error");
NSLog(@"MOPybridExtensionConverter Error %@",apiMethod);
return nil;
}

File diff suppressed because it is too large Load Diff