增加扫码打开小程序接口

master
kangxuyao 2021-12-29 11:15:34 +08:00
parent 1f11c925ca
commit 5826f2ec4f
2 changed files with 29 additions and 2 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.34.12' implementation 'com.finogeeks.lib:finapplet:2.35.0-alpha20211229v01'
implementation 'com.finogeeks.mop:plugins:2.34.12' implementation 'com.finogeeks.mop:plugins:2.34.12'
} }

View File

@ -5,6 +5,7 @@ import android.text.TextUtils;
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.interfaces.FinCallback;
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;
@ -28,7 +29,7 @@ public class AppletModule extends BaseApi {
@Override @Override
public String[] apis() { public String[] apis() {
return new String[]{"openApplet", "scanOpenApplet"}; return new String[]{"openApplet", "scanOpenApplet","qrcodeOpenApplet"};
} }
@Override @Override
@ -37,6 +38,8 @@ public class AppletModule extends BaseApi {
openApplet(param, callback); openApplet(param, callback);
} else if ("scanOpenApplet".equals(event)) { } else if ("scanOpenApplet".equals(event)) {
scanOpenApplet(param, callback); scanOpenApplet(param, callback);
} else if ("qrcodeOpenApplet".equals(event)){
qrcodeOpenApplet(param,callback);
} }
} }
@ -109,4 +112,28 @@ public class AppletModule extends BaseApi {
FinAppClient.INSTANCE.getAppletApiManager().startApplet(mContext, new StartAppletDecryptRequest(info)); FinAppClient.INSTANCE.getAppletApiManager().startApplet(mContext, new StartAppletDecryptRequest(info));
callback.onSuccess(new HashMap()); callback.onSuccess(new HashMap());
} }
private void qrcodeOpenApplet(Map param, ICallback callback){
String qrcode = String.valueOf(param.get("qrcode"));
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) {
}
});
}
} }