initSDK补充部分属性

master
zhongweiguang 2023-03-22 17:27:17 +08:00
parent 02902cc965
commit dce531bdec
3 changed files with 118 additions and 2 deletions

View File

@ -91,6 +91,6 @@ kapt {
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.finogeeks.lib:finapplet:2.39.12-alpha20230322v01'
implementation 'com.finogeeks.lib:finapplet:2.39.12-alpha20230322v02'
implementation 'com.finogeeks.mop:plugins:2.39.11'
}

View File

@ -13,6 +13,7 @@ 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;
@ -121,6 +122,54 @@ public class InitSDKModule extends BaseApi {
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_VERBOSE);
} else if (logLevelIndex == 1) {
configBuilder.setLogLevel(XLogLevel.LEVEL_DEBUG);
} else if (logLevelIndex == 2) {
configBuilder.setLogLevel(XLogLevel.LEVEL_INFO);
} else if (logLevelIndex == 3) {
configBuilder.setLogLevel(XLogLevel.LEVEL_WARNING);
} else if (logLevelIndex == 4) {
configBuilder.setLogLevel(XLogLevel.LEVEL_ERROR);
} 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) {

View File

@ -155,6 +155,52 @@ class Config {
/// scheme
List<String>? schemes;
/// Android
/// debug
bool debug = false;
/// Android
///
int? maxRunningApplet;
/// Android
/// WebView mixed content mode
int? webViewMixedContentMode;
/// Android
/// appApp
bool bindAppletWithMainProcess = false;
/// Android
/// App
String? killAppletProcessNotice;
/// Android
/// Android SDK
int minAndroidSdkVersion = 21; // Build.VERSION_CODES.LOLLIPOP
/// Android
///
bool enableScreenShot = false;
/// Android
/// GLOBAL
ConfigPriority screenShotPriority = ConfigPriority.ConfigGlobalPriority;
///
LogLevel logLevel = LogLevel.LEVEL_NONE;
///
/// 1 1 * 24 * 60 * 60
int? logMaxAliveSec;
/// XLog
String? logDir;
/// Android
///
bool enablePreNewProcess = false;
Config(this.finStoreConfigs);
Map<String, dynamic> toMap() {
@ -184,6 +230,18 @@ class Config {
"h5AjaxHookRequestKey": h5AjaxHookRequestKey,
"pageCountLimit": pageCountLimit,
"schemes": schemes,
"debug": debug,
"maxRunningApplet": maxRunningApplet,
"webViewMixedContentMode": webViewMixedContentMode,
"bindAppletWithMainProcess": bindAppletWithMainProcess,
"killAppletProcessNotice": killAppletProcessNotice,
"minAndroidSdkVersion": minAndroidSdkVersion,
"enableScreenShot": enableScreenShot,
"screenShotPriority": screenShotPriority.index,
"logLevel": logLevel.index,
"logMaxAliveSec": logMaxAliveSec,
"logDir": logDir,
"enablePreNewProcess": enablePreNewProcess,
};
}
}
@ -786,6 +844,15 @@ enum BOOLState {
BOOLStateForbidden, // vconsoleapi
}
enum LogLevel {
LEVEL_VERBOSE,
LEVEL_DEBUG,
LEVEL_INFO,
LEVEL_WARNING,
LEVEL_ERROR,
LEVEL_NONE
}
class Mop {
static final Mop _instance = new Mop._internal();
late MethodChannel _channel;