Android启动小程序支持多服务器场景
parent
0e99f88dd6
commit
d5eae2c9b8
|
@ -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'
|
||||
}
|
|
@ -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<String, String> 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());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue