Android启动小程序支持多服务器场景
parent
0e99f88dd6
commit
d5eae2c9b8
|
@ -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.13.1'
|
implementation 'com.finogeeks.lib:finapplet:2.13.3'
|
||||||
implementation 'com.finogeeks.mop:plugins:0.0.23'
|
implementation 'com.finogeeks.mop:plugins:0.0.23'
|
||||||
}
|
}
|
|
@ -4,6 +4,9 @@ import android.content.Context;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.finogeeks.lib.applet.client.FinAppClient;
|
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.api.BaseApi;
|
||||||
import com.finogeeks.mop.interfaces.ICallback;
|
import com.finogeeks.mop.interfaces.ICallback;
|
||||||
|
|
||||||
|
@ -22,7 +25,6 @@ public class AppletModule extends BaseApi {
|
||||||
@Override
|
@Override
|
||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -40,9 +42,13 @@ public class AppletModule extends BaseApi {
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Log.d("MopPlugin", "openApplet:params:" + param);
|
||||||
String appId = String.valueOf(param.get("appId"));
|
String appId = String.valueOf(param.get("appId"));
|
||||||
Integer sequence = (Integer) param.get("sequence");
|
Integer sequence = (Integer) param.get("sequence");
|
||||||
Map<String, String> params = (Map) param.get("params");
|
Map<String, String> params = (Map) param.get("params");
|
||||||
|
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 (params == null) {
|
||||||
if (sequence == null) {
|
if (sequence == null) {
|
||||||
FinAppClient.INSTANCE.getAppletApiManager().startApplet(mContext, appId);
|
FinAppClient.INSTANCE.getAppletApiManager().startApplet(mContext, appId);
|
||||||
|
@ -50,9 +56,27 @@ public class AppletModule extends BaseApi {
|
||||||
FinAppClient.INSTANCE.getAppletApiManager().startApplet(mContext, appId, sequence, null);
|
FinAppClient.INSTANCE.getAppletApiManager().startApplet(mContext, appId, sequence, null);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.d("MopPlugin", "openApplet:params:" + param);
|
|
||||||
FinAppClient.INSTANCE.getAppletApiManager().startApplet(mContext, appId, params);
|
FinAppClient.INSTANCE.getAppletApiManager().startApplet(mContext, appId, params);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
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());
|
callback.onSuccess(new HashMap());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue