安卓打开小程序修改为封装参数的API

master
gaoyunfei 2022-07-27 18:35:50 +08:00
parent 8c0ef9a5df
commit fc3dd3e550
2 changed files with 33 additions and 5 deletions

View File

@ -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.37.3' implementation 'com.finogeeks.lib:finapplet:2.37.4-alpha20220727v13'
implementation 'com.finogeeks.mop:plugins:2.37.3' implementation 'com.finogeeks.mop:plugins:2.37.1'
} }

View File

@ -7,6 +7,7 @@ import android.util.Log;
import com.finogeeks.lib.applet.client.FinAppClient; import com.finogeeks.lib.applet.client.FinAppClient;
import com.finogeeks.lib.applet.interfaces.FinCallback; import com.finogeeks.lib.applet.interfaces.FinCallback;
import com.finogeeks.lib.applet.client.FinAppInfo; import com.finogeeks.lib.applet.client.FinAppInfo;
import com.finogeeks.lib.applet.sdk.api.request.IFinAppletRequest;
import com.finogeeks.lib.applet.sdk.model.StartAppletDecryptRequest; import com.finogeeks.lib.applet.sdk.model.StartAppletDecryptRequest;
import com.finogeeks.mop.api.BaseApi; import com.finogeeks.mop.api.BaseApi;
import com.finogeeks.mop.interfaces.ICallback; import com.finogeeks.mop.interfaces.ICallback;
@ -68,7 +69,13 @@ public class AppletModule extends BaseApi {
Log.d(TAG, "openApplet:" + appId + "," + param + "," + sequence + "," + apiServer); Log.d(TAG, "openApplet:" + appId + "," + param + "," + sequence + "," + apiServer);
if (apiServer != null) { if (apiServer != null) {
FinAppClient.INSTANCE.getAppletApiManager().startApplet(context, apiServer, appId, sequence, startParams,null); FinAppClient.INSTANCE.getAppletApiManager().startApplet(context,
IFinAppletRequest.Companion.fromAppId(apiServer, appId)
.setStartParams(startParams)
.setSequence(sequence),
null
);
// FinAppClient.INSTANCE.getAppletApiManager().startApplet(context, apiServer, appId, sequence, startParams,null);
} else { } else {
FinAppClient.INSTANCE.getAppletApiManager().startApplet(context, appId, sequence, startParams,null); FinAppClient.INSTANCE.getAppletApiManager().startApplet(context, appId, sequence, startParams,null);
} }
@ -113,13 +120,14 @@ public class AppletModule extends BaseApi {
private void scanOpenApplet(Map param, ICallback callback) { private void scanOpenApplet(Map param, ICallback callback) {
String info = String.valueOf(param.get("info")); String info = String.valueOf(param.get("info"));
FinAppClient.INSTANCE.getAppletApiManager().startApplet(mContext, new StartAppletDecryptRequest(info),null); FinAppClient.INSTANCE.getAppletApiManager().startApplet(mContext, IFinAppletRequest.Companion.fromDecrypt(info), null);
// FinAppClient.INSTANCE.getAppletApiManager().startApplet(mContext, new StartAppletDecryptRequest(info),null);
callback.onSuccess(new HashMap()); callback.onSuccess(new HashMap());
} }
private void qrcodeOpenApplet(Map param, ICallback callback){ private void qrcodeOpenApplet(Map param, ICallback callback){
String qrcode = String.valueOf(param.get("qrcode")); String qrcode = String.valueOf(param.get("qrcode"));
FinAppClient.INSTANCE.getAppletApiManager().startAppletByQrcode(mContext, qrcode, new FinCallback<String>() { FinAppClient.INSTANCE.getAppletApiManager().startApplet(mContext, IFinAppletRequest.Companion.fromQrCode(qrcode), new FinCallback<String>() {
@Override @Override
public void onSuccess(String s) { public void onSuccess(String s) {
callback.onSuccess(new HashMap()); callback.onSuccess(new HashMap());
@ -139,6 +147,26 @@ public class AppletModule extends BaseApi {
} }
}); });
/*FinAppClient.INSTANCE.getAppletApiManager().startAppletByQrcode(mContext, qrcode, new FinCallback<String>() {
@Override
public void onSuccess(String s) {
callback.onSuccess(new HashMap());
}
@Override
public void onError(int i, String s) {
callback.onFail(new HashMap(){
{
put("info",s);
}
});
}
@Override
public void onProgress(int i, String s) {
}
});*/
} }
private void changeUserId(Map param, ICallback callback) { private void changeUserId(Map param, ICallback callback) {