initSDK补充部分属性
parent
02902cc965
commit
dce531bdec
|
@ -91,6 +91,6 @@ kapt {
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
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'
|
implementation 'com.finogeeks.mop:plugins:2.39.11'
|
||||||
}
|
}
|
|
@ -13,6 +13,7 @@ import com.finogeeks.mop.api.BaseApi;
|
||||||
import com.finogeeks.mop.api.mop.util.InitUtils;
|
import com.finogeeks.mop.api.mop.util.InitUtils;
|
||||||
import com.finogeeks.mop.interfaces.ICallback;
|
import com.finogeeks.mop.interfaces.ICallback;
|
||||||
import com.finogeeks.mop.service.MopPluginService;
|
import com.finogeeks.mop.service.MopPluginService;
|
||||||
|
import com.finogeeks.xlog.XLogLevel;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -121,6 +122,54 @@ public class InitSDKModule extends BaseApi {
|
||||||
if (schemes != null) {
|
if (schemes != null) {
|
||||||
configBuilder.setSchemes(schemes);
|
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");
|
Map<Object, Object> uiConfigMap = (Map<Object, Object>) param.get("uiConfig");
|
||||||
String appendingCustomUserAgent = (String) uiConfigMap.get("appendingCustomUserAgent");
|
String appendingCustomUserAgent = (String) uiConfigMap.get("appendingCustomUserAgent");
|
||||||
if (appendingCustomUserAgent != null) {
|
if (appendingCustomUserAgent != null) {
|
||||||
|
|
69
lib/mop.dart
69
lib/mop.dart
|
@ -133,7 +133,7 @@ class Config {
|
||||||
/// 对ft.request、ft.downloadFile、ft.uploadFile均会生效
|
/// 对ft.request、ft.downloadFile、ft.uploadFile均会生效
|
||||||
Map<String, String>? header;
|
Map<String, String>? header;
|
||||||
|
|
||||||
/// header优先级设置,默认全局配置优先
|
/// header优先级设置,默认全局配置优先
|
||||||
ConfigPriority headerPriority = ConfigPriority.ConfigGlobalPriority;
|
ConfigPriority headerPriority = ConfigPriority.ConfigGlobalPriority;
|
||||||
|
|
||||||
/// iOS属性
|
/// iOS属性
|
||||||
|
@ -155,6 +155,52 @@ class Config {
|
||||||
/// 自定义的scheme数组
|
/// 自定义的scheme数组
|
||||||
List<String>? schemes;
|
List<String>? schemes;
|
||||||
|
|
||||||
|
/// Android属性
|
||||||
|
/// 设置debug模式,影响调试和日志。
|
||||||
|
bool debug = false;
|
||||||
|
|
||||||
|
/// Android属性
|
||||||
|
/// 设置最大同时运行小程序个数
|
||||||
|
int? maxRunningApplet;
|
||||||
|
|
||||||
|
/// Android属性
|
||||||
|
/// WebView mixed content mode
|
||||||
|
int? webViewMixedContentMode;
|
||||||
|
|
||||||
|
/// Android属性
|
||||||
|
/// 小程序与app进程绑定,App被杀死,小程序同步关闭
|
||||||
|
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);
|
Config(this.finStoreConfigs);
|
||||||
|
|
||||||
Map<String, dynamic> toMap() {
|
Map<String, dynamic> toMap() {
|
||||||
|
@ -184,6 +230,18 @@ class Config {
|
||||||
"h5AjaxHookRequestKey": h5AjaxHookRequestKey,
|
"h5AjaxHookRequestKey": h5AjaxHookRequestKey,
|
||||||
"pageCountLimit": pageCountLimit,
|
"pageCountLimit": pageCountLimit,
|
||||||
"schemes": schemes,
|
"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, // 所有版本强制关闭vconsole,且不可调api开启,多面板不展示打开、关闭调试菜单
|
BOOLStateForbidden, // 所有版本强制关闭vconsole,且不可调api开启,多面板不展示打开、关闭调试菜单
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum LogLevel {
|
||||||
|
LEVEL_VERBOSE,
|
||||||
|
LEVEL_DEBUG,
|
||||||
|
LEVEL_INFO,
|
||||||
|
LEVEL_WARNING,
|
||||||
|
LEVEL_ERROR,
|
||||||
|
LEVEL_NONE
|
||||||
|
}
|
||||||
|
|
||||||
class Mop {
|
class Mop {
|
||||||
static final Mop _instance = new Mop._internal();
|
static final Mop _instance = new Mop._internal();
|
||||||
late MethodChannel _channel;
|
late MethodChannel _channel;
|
||||||
|
|
Loading…
Reference in New Issue