Merge branch 'feat/singleprocess' into 2.39.0

# Conflicts:
#	android/build.gradle
#	android/src/main/java/com/finogeeks/mop/api/mop/AppletManageModule.java
master
kangxuyao 2022-10-13 13:56:59 +08:00
commit 1cda8dcd14
6 changed files with 87 additions and 46 deletions

View File

@ -11,6 +11,8 @@ import com.finogeeks.lib.applet.anim.SlideFromRightToLeftAnim;
import com.finogeeks.lib.applet.anim.SlideFromTopToBottomAnim;
import com.finogeeks.lib.applet.client.FinAppClient;
import com.finogeeks.lib.applet.client.FinAppInfo;
import com.finogeeks.lib.applet.client.FinAppProcessClient;
import com.finogeeks.lib.applet.db.entity.FinApplet;
import com.finogeeks.lib.applet.interfaces.FinCallback;
import com.finogeeks.lib.applet.rest.model.WechatLoginInfo;
import com.finogeeks.mop.api.BaseApi;
@ -54,6 +56,7 @@ public class AppletManageModule extends BaseApi {
res.put("version", appletInfo.getAppVersion());
res.put("thumbnail", appletInfo.getAppThumbnail());
res.put("appletType", appletInfo.getAppType());
res.put("isSingleProcess", FinAppProcessClient.INSTANCE.getAppletProcessActivity(applet.getId()) != null);
Map<String, String> wechatLoginInfo = new HashMap<>(4);
WechatLoginInfo wechatLogin = appletInfo.getWechatLoginInfo();
if (wechatLogin != null) {

View File

@ -63,23 +63,31 @@ public class AppletModule extends BaseApi {
Integer sequence = (Integer) param.get("sequence");
Map<String, String> params = (Map) param.get("params");
String apiServer = (String) param.get("apiServer");
Boolean isSingleProcess = (Boolean) param.get("isSingleProcess");
// mContextFlutterActivity
// Android 6.07.0contextmContext
// 使Application Context
Context context = mContext.getApplicationContext();
FinAppInfo.StartParams startParams = params == null ? null : new FinAppInfo.StartParams(params.get("path"), params.get("query"), params.get("scene"));
Log.d(TAG, "openApplet:" + appId + "," + param + "," + sequence + "," + apiServer);
Log.d(TAG, "openApplet:" + appId + "," + param + "," + sequence + "," + apiServer + ", isSingleProcess:" + isSingleProcess);
if (apiServer != null) {
FinAppClient.INSTANCE.getAppletApiManager().startApplet(context,
IFinAppletRequest.Companion.fromAppId(apiServer, appId)
.setStartParams(startParams)
.setSequence(sequence),
.setSequence(sequence)
.setSingleProcess(Boolean.TRUE.equals(isSingleProcess)),
null
);
// FinAppClient.INSTANCE.getAppletApiManager().startApplet(context, apiServer, appId, sequence, startParams,null);
} else {
FinAppClient.INSTANCE.getAppletApiManager().startApplet(context, appId, sequence, startParams,null);
FinAppClient.INSTANCE.getAppletApiManager().startApplet(context,
IFinAppletRequest.Companion.fromAppId(appId)
.setStartParams(startParams)
.setSequence(sequence)
.setSingleProcess(Boolean.TRUE.equals(isSingleProcess)),
null
);
}
// String apiServer = (String) param.get("apiServer");
@ -136,6 +144,8 @@ public class AppletModule extends BaseApi {
String apiServer = (String) param.get("apiServer");
String offlineMiniprogramZipPath = (String) param.get("offlineMiniprogramZipPath");
String offlineFrameworkZipPath = (String) param.get("offlineFrameworkZipPath");
Boolean isSingleProcess = (Boolean) param.get("isSingleProcess");
Log.d("MopPlugin", "startApplet (appId=" + appId + ", sequence=" + sequence + " apiServer=" + apiServer + ")");
// mContextFlutterActivity
// Android 6.07.0contextmContext
@ -149,7 +159,8 @@ public class AppletModule extends BaseApi {
IFinAppletRequest.Companion.fromAppId(apiServer, appId)
.setSequence(sequence)
.setStartParams(params)
.setOfflineParams(offlineFrameworkZipPath, offlineMiniprogramZipPath),
.setOfflineParams(offlineFrameworkZipPath, offlineMiniprogramZipPath)
.setSingleProcess(Boolean.TRUE.equals(isSingleProcess)),
null);
// request
// FinAppClient.INSTANCE.getAppletApiManager().startApplet(context, IFinAppletRequest.Companion.fromAppId("apiServer", "appId")
@ -159,14 +170,18 @@ public class AppletModule extends BaseApi {
private void scanOpenApplet(Map param, ICallback callback) {
String info = String.valueOf(param.get("info"));
FinAppClient.INSTANCE.getAppletApiManager().startApplet(mContext, IFinAppletRequest.Companion.fromDecrypt(info), null);
Boolean isSingleProcess = (Boolean) param.get("isSingleProcess");
FinAppClient.INSTANCE.getAppletApiManager().startApplet(mContext, IFinAppletRequest.Companion.fromDecrypt(info)
.setSingleProcess(Boolean.TRUE.equals(isSingleProcess)), null);
// FinAppClient.INSTANCE.getAppletApiManager().startApplet(mContext, new StartAppletDecryptRequest(info),null);
callback.onSuccess(new HashMap());
}
private void qrcodeOpenApplet(Map param, ICallback callback){
String qrcode = String.valueOf(param.get("qrcode"));
FinAppClient.INSTANCE.getAppletApiManager().startApplet(mContext, IFinAppletRequest.Companion.fromQrCode(qrcode), new FinCallback<String>() {
Boolean isSingleProcess = (Boolean) param.get("isSingleProcess");
FinAppClient.INSTANCE.getAppletApiManager().startApplet(mContext, IFinAppletRequest.Companion.fromQrCode(qrcode)
.setSingleProcess(Boolean.TRUE.equals(isSingleProcess)), new FinCallback<String>() {
@Override
public void onSuccess(String s) {
callback.onSuccess(new HashMap());

View File

@ -12,9 +12,11 @@ import com.finogeeks.lib.applet.interfaces.FinCallback;
import com.finogeeks.mop.api.BaseApi;
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;
import java.util.List;
import java.util.Map;
@ -121,7 +123,9 @@ public class BaseModule extends BaseApi {
.setUserId(userId)
.setDebugMode(debug)
.setDisableRequestPermissions(disablePermission)
.setBindAppletWithMainProcess(bindAppletWithMainProcess);
.setBindAppletWithMainProcess(bindAppletWithMainProcess)
.setLogLevel(XLogLevel.LEVEL_VERBOSE)
.setXLogDir(new File(getContext().getExternalCacheDir(),"xlog"));
// .setPageCountLimit(pageCountLimit);
if (customWebViewUserAgent != null)

View File

@ -42,7 +42,7 @@ packages:
name: collection
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.16.0"
version: "1.15.0"
cupertino_icons:
dependency: "direct main"
description:
@ -56,7 +56,7 @@ packages:
name: fake_async
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.3.0"
version: "1.2.0"
flutter:
dependency: "direct main"
description: flutter
@ -95,13 +95,6 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.12.11"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.1.4"
meta:
dependency: transitive
description:
@ -115,14 +108,14 @@ packages:
path: ".."
relative: true
source: path
version: "2.37.3"
version: "2.37.13"
path:
dependency: transitive
description:
name: path
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.8.1"
version: "1.8.0"
sky_engine:
dependency: transitive
description: flutter
@ -134,7 +127,7 @@ packages:
name: source_span
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.8.2"
version: "1.8.1"
stack_trace:
dependency: transitive
description:
@ -169,14 +162,21 @@ packages:
name: test_api
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.4.9"
version: "0.4.3"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.3.0"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.2"
version: "2.1.1"
sdks:
dart: ">=2.17.0-0 <3.0.0"
dart: ">=2.14.0 <3.0.0"
flutter: ">=2.2.3"

View File

@ -225,12 +225,15 @@ class BaseAppletRequest {
Map<String, String>? startParams;
// iOStrue
bool? animated;
// androidfalse
bool isSingleProcess;
BaseAppletRequest({
required this.apiServer,
required this.apiServer,
required this.appletId,
this.startParams,
this.animated = true,
this.isSingleProcess = false,
});
Map<String, dynamic> toMap() {
@ -238,7 +241,8 @@ class BaseAppletRequest {
"apiServer": apiServer,
"appletId": appletId,
"startParams": startParams,
"animated": animated
"animated": animated,
"isSingleProcess": isSingleProcess,
};
}
}
@ -258,15 +262,18 @@ class RemoteAppletRequest {
String? offlineFrameworkZipPath;
// iOStrue
bool animated;
// androidfalse
bool isSingleProcess;
RemoteAppletRequest({
required this.apiServer,
required this.apiServer,
required this.appletId,
this.startParams,
this.sequence,
this.offlineMiniprogramZipPath,
this.offlineFrameworkZipPath,
this.animated = true,
this.isSingleProcess = false,
});
@override
@ -274,7 +281,8 @@ class RemoteAppletRequest {
Map<String, dynamic> result = {
"apiServer": apiServer,
"appletId": appletId,
"animated": animated
"animated": animated,
"isSingleProcess": isSingleProcess,
};
if (startParams != null) result["startParams"] = startParams;
if (offlineMiniprogramZipPath != null) result["offlineMiniprogramZipPath"] = offlineMiniprogramZipPath;
@ -290,13 +298,16 @@ class QRCodeAppletRequest {
String qrCode;
//
bool animated = true;
// androidfalse
bool isSingleProcess;
QRCodeAppletRequest(this.qrCode);
QRCodeAppletRequest(this.qrCode, {this.isSingleProcess = false});
Map<String, dynamic> toMap() {
return {
"apiServer": qrCode,
"animated": animated
"animated": animated,
"isSingleProcess": isSingleProcess,
};
}
}
@ -447,6 +458,7 @@ class Mop {
final int? sequence,
final String? apiServer,
final String? scene,
final bool isSingleProcess = false,
}) async {
Map<String, Object> params = {'appId': appId};
Map param = {};
@ -456,6 +468,7 @@ class Mop {
if (sequence != null) params["sequence"] = sequence;
if (apiServer != null) params["apiServer"] = apiServer;
if (scene != null) param["scene"] = scene;
params["isSingleProcess"] = isSingleProcess;
final Map ret = await _channel.invokeMethod('openApplet', params);
return ret;
}
@ -524,8 +537,11 @@ class Mop {
///
/// --
///
Future scanOpenApplet(String info) async {
Map<String, Object> params = {'info': info};
Future scanOpenApplet(String info, {bool isSingleProcess = false}) async {
Map<String, Object> params = {
'info': info,
'isSingleProcess': isSingleProcess,
};
return await _channel.invokeMapMethod("scanOpenApplet", params);
}
@ -533,8 +549,11 @@ class Mop {
///
/// [qrcode]
///
Future qrcodeOpenApplet(String qrcode) async {
Map<String, Object> params = {'qrcode': qrcode};
Future qrcodeOpenApplet(String qrcode, {bool isSingleProcess = false}) async {
Map<String, Object> params = {
'qrcode': qrcode,
'isSingleProcess': isSingleProcess,
};
return await _channel.invokeMapMethod("qrcodeOpenApplet", params);
}

View File

@ -42,14 +42,14 @@ packages:
name: collection
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.16.0"
version: "1.15.0"
fake_async:
dependency: transitive
description:
name: fake_async
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.3.0"
version: "1.2.0"
flutter:
dependency: "direct main"
description: flutter
@ -88,13 +88,6 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.12.11"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.1.4"
meta:
dependency: transitive
description:
@ -108,7 +101,7 @@ packages:
name: path
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.8.1"
version: "1.8.0"
sky_engine:
dependency: transitive
description: flutter
@ -120,7 +113,7 @@ packages:
name: source_span
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.8.2"
version: "1.8.1"
stack_trace:
dependency: transitive
description:
@ -155,14 +148,21 @@ packages:
name: test_api
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.4.9"
version: "0.4.3"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.3.0"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.2"
version: "2.1.1"
sdks:
dart: ">=2.17.0-0 <3.0.0"
dart: ">=2.14.0 <3.0.0"
flutter: ">=2.2.3"