diff --git a/android/build.gradle b/android/build.gradle index 270a1b7..f18015d 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -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' } \ No newline at end of file diff --git a/android/src/main/java/com/finogeeks/mop/api/ApisManager.java b/android/src/main/java/com/finogeeks/mop/api/ApisManager.java index 39bdfee..168793e 100644 --- a/android/src/main/java/com/finogeeks/mop/api/ApisManager.java +++ b/android/src/main/java/com/finogeeks/mop/api/ApisManager.java @@ -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) { diff --git a/android/src/main/java/com/finogeeks/mop/api/mop/WXQrCodeModule.java b/android/src/main/java/com/finogeeks/mop/api/mop/WXQrCodeModule.java new file mode 100644 index 0000000..2fc0174 --- /dev/null +++ b/android/src/main/java/com/finogeeks/mop/api/mop/WXQrCodeModule.java @@ -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() { + @Override + public void onSuccess(ParsedAppletInfo appletInfo) { + HashMap 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); + } + }); + } +} diff --git a/lib/mop.dart b/lib/mop.dart index 524639e..aa0f70f 100644 --- a/lib/mop.dart +++ b/lib/mop.dart @@ -165,6 +165,9 @@ class Mop { return await _channel.invokeMapMethod("scanOpenApplet", params); } + /// + /// 根据微信QrCode信息解析小程序信息 + /// Future> parseAppletInfoFromWXQrCode( String qrCode, String apiServer) async { final ret = await _channel.invokeMapMethod("parseAppletInfoFromWXQrCode",