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()); }