android:新增根据微信QrCode信息解析小程序信息的接口
parent
dfd4e5c11d
commit
a7bbacbd47
|
@ -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.31.0-alpha20210625v01'
|
implementation 'com.finogeeks.lib:finapplet:2.31.0-alpha20210624v06'
|
||||||
implementation 'com.finogeeks.mop:plugins:2.30.2'
|
implementation 'com.finogeeks.mop:plugins:2.30.2'
|
||||||
}
|
}
|
|
@ -10,6 +10,7 @@ import com.finogeeks.mop.api.mop.BaseModule;
|
||||||
import com.finogeeks.mop.api.mop.ExtensionApiModule;
|
import com.finogeeks.mop.api.mop.ExtensionApiModule;
|
||||||
import com.finogeeks.mop.api.mop.VersionModule;
|
import com.finogeeks.mop.api.mop.VersionModule;
|
||||||
import com.finogeeks.mop.api.mop.SmSignModule;
|
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.Event;
|
||||||
import com.finogeeks.mop.interfaces.IApi;
|
import com.finogeeks.mop.interfaces.IApi;
|
||||||
|
|
||||||
|
@ -71,6 +72,7 @@ public class ApisManager {
|
||||||
add(new ExtensionApiModule(activity));
|
add(new ExtensionApiModule(activity));
|
||||||
add(new VersionModule(activity));
|
add(new VersionModule(activity));
|
||||||
add(new SmSignModule(activity));
|
add(new SmSignModule(activity));
|
||||||
|
add(new WXQrCodeModule(activity));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void add(IApi api) {
|
private void add(IApi api) {
|
||||||
|
|
|
@ -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);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -165,6 +165,9 @@ class Mop {
|
||||||
return await _channel.invokeMapMethod("scanOpenApplet", params);
|
return await _channel.invokeMapMethod("scanOpenApplet", params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
/// 根据微信QrCode信息解析小程序信息
|
||||||
|
///
|
||||||
Future<Map<String, dynamic>> parseAppletInfoFromWXQrCode(
|
Future<Map<String, dynamic>> parseAppletInfoFromWXQrCode(
|
||||||
String qrCode, String apiServer) async {
|
String qrCode, String apiServer) async {
|
||||||
final ret = await _channel.invokeMapMethod("parseAppletInfoFromWXQrCode",
|
final ret = await _channel.invokeMapMethod("parseAppletInfoFromWXQrCode",
|
||||||
|
|
Loading…
Reference in New Issue