From d5eae2c9b8a75bc0cc9aa2ab6faf36c6293154f3 Mon Sep 17 00:00:00 2001 From: xiaoyu Date: Fri, 4 Dec 2020 09:11:07 +0800 Subject: [PATCH] =?UTF-8?q?Android=E5=90=AF=E5=8A=A8=E5=B0=8F=E7=A8=8B?= =?UTF-8?q?=E5=BA=8F=E6=94=AF=E6=8C=81=E5=A4=9A=E6=9C=8D=E5=8A=A1=E5=99=A8?= =?UTF-8?q?=E5=9C=BA=E6=99=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- android/build.gradle | 2 +- .../finogeeks/mop/api/mop/AppletModule.java | 38 +++++++++++++++---- 2 files changed, 32 insertions(+), 8 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 43efc6a..0536238 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -91,6 +91,6 @@ kapt { } dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') - implementation 'com.finogeeks.lib:finapplet:2.13.1' + implementation 'com.finogeeks.lib:finapplet:2.13.3' implementation 'com.finogeeks.mop:plugins:0.0.23' } \ No newline at end of file diff --git a/android/src/main/java/com/finogeeks/mop/api/mop/AppletModule.java b/android/src/main/java/com/finogeeks/mop/api/mop/AppletModule.java index 0d3f247..2a01f6d 100644 --- a/android/src/main/java/com/finogeeks/mop/api/mop/AppletModule.java +++ b/android/src/main/java/com/finogeeks/mop/api/mop/AppletModule.java @@ -4,6 +4,9 @@ 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.FinAppInfo; +import com.finogeeks.lib.applet.client.FinAppletStoreConfig; import com.finogeeks.mop.api.BaseApi; import com.finogeeks.mop.interfaces.ICallback; @@ -22,7 +25,6 @@ public class AppletModule extends BaseApi { @Override public void onCreate() { super.onCreate(); - } @Override @@ -40,18 +42,40 @@ public class AppletModule extends BaseApi { }); return; } + Log.d("MopPlugin", "openApplet:params:" + param); String appId = String.valueOf(param.get("appId")); Integer sequence = (Integer) param.get("sequence"); Map params = (Map) param.get("params"); - if (params == null) { - if (sequence == null) { - FinAppClient.INSTANCE.getAppletApiManager().startApplet(mContext, appId); + String apiServer = (String) param.get("apiServer"); + String apiPrefix = (String) param.get("apiPrefix"); + if (apiServer == null || apiServer.isEmpty() || apiPrefix == null || apiPrefix.isEmpty()) { + if (params == null) { + if (sequence == null) { + FinAppClient.INSTANCE.getAppletApiManager().startApplet(mContext, appId); + } else { + FinAppClient.INSTANCE.getAppletApiManager().startApplet(mContext, appId, sequence, null); + } } else { - FinAppClient.INSTANCE.getAppletApiManager().startApplet(mContext, appId, sequence, null); + FinAppClient.INSTANCE.getAppletApiManager().startApplet(mContext, appId, params); } } else { - Log.d("MopPlugin", "openApplet:params:" + param); - FinAppClient.INSTANCE.getAppletApiManager().startApplet(mContext, appId, params); + String fingerprint = (String) param.get("fingerprint"); + if (fingerprint == null) { + fingerprint = ""; + } + String cryptType = (String) param.get("cryptType"); + if (cryptType == null || cryptType.isEmpty()) { + cryptType = FinAppConfig.ENCRYPTION_TYPE_MD5; + } + FinAppletStoreConfig finAppletStoreConfig = new FinAppletStoreConfig(apiServer, apiPrefix, fingerprint, cryptType); + FinAppInfo.StartParams startParams = null; + if (params != null) { + String pageURL = params.get("path"); + String launchParams = params.get("query"); + String scene = params.get("scene"); + startParams = new FinAppInfo.StartParams(pageURL, launchParams, scene); + } + FinAppClient.INSTANCE.getAppletApiManager().startApplet(mContext, finAppletStoreConfig, appId, sequence, startParams); } callback.onSuccess(new HashMap()); }