wangtao 2021-06-28 10:17:59 +08:00
commit b1740e3b5b
5 changed files with 55 additions and 2 deletions

View File

@ -91,6 +91,6 @@ kapt {
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.finogeeks.lib:finapplet:2.31.0-alpha20210625v01'
implementation 'com.finogeeks.lib:finapplet:2.31.0-alpha20210624v06'
implementation 'com.finogeeks.mop:plugins:2.30.2'
}

View File

@ -10,6 +10,7 @@ import com.finogeeks.mop.api.mop.BaseModule;
import com.finogeeks.mop.api.mop.ExtensionApiModule;
import com.finogeeks.mop.api.mop.VersionModule;
import com.finogeeks.mop.api.mop.SmSignModule;
import com.finogeeks.mop.api.mop.WXQrCodeModule;
import com.finogeeks.mop.interfaces.Event;
import com.finogeeks.mop.interfaces.IApi;
@ -71,6 +72,7 @@ public class ApisManager {
add(new ExtensionApiModule(activity));
add(new VersionModule(activity));
add(new SmSignModule(activity));
add(new WXQrCodeModule(activity));
}
private void add(IApi api) {

View File

@ -59,7 +59,7 @@ public class BaseModule extends BaseApi {
if (disablePermission == null) {
disablePermission = false;
}
String userId = null;
String userId = "";
if (param.get("userId") != null) {
userId = (String) param.get("userId");
}

View File

@ -0,0 +1,48 @@
package com.finogeeks.mop.api.mop;
import android.content.Context;
import com.finogeeks.lib.applet.client.FinAppClient;
import com.finogeeks.lib.applet.modules.callback.FinSimpleCallback;
import com.finogeeks.lib.applet.sdk.model.ParsedAppletInfo;
import com.finogeeks.mop.api.BaseApi;
import com.finogeeks.mop.interfaces.ICallback;
import org.jetbrains.annotations.Nullable;
import java.util.HashMap;
import java.util.Map;
public class WXQrCodeModule extends BaseApi {
public WXQrCodeModule(Context context) {
super(context);
}
@Override
public String[] apis() {
return new String[]{"parseAppletInfoFromWXQrCode"};
}
@Override
public void invoke(String event, Map param, ICallback callback) {
String qrCode = (String) param.get("qrCode");
String apiServer = (String) param.get("apiServer");
FinAppClient.INSTANCE.getAppletApiManager().parseAppletInfoFromWXQrCode(
qrCode,
apiServer,
new FinSimpleCallback<ParsedAppletInfo>() {
@Override
public void onSuccess(ParsedAppletInfo appletInfo) {
HashMap<String, String> map = new HashMap<>();
map.put("appId", appletInfo != null ? appletInfo.getAppId() : null);
callback.onSuccess(map);
}
@Override
public void onError(int code, @Nullable String error) {
callback.onFail(code + ", " + error);
}
});
}
}

View File

@ -165,6 +165,9 @@ class Mop {
return await _channel.invokeMapMethod("scanOpenApplet", params);
}
///
/// QrCode
///
Future<Map<String, dynamic>> parseAppletInfoFromWXQrCode(
String qrCode, String apiServer) async {
final ret = await _channel.invokeMapMethod("parseAppletInfoFromWXQrCode",