增加切换用户接口
parent
3fa610fdc4
commit
6e75fe48e7
|
@ -30,7 +30,7 @@ public class AppletModule extends BaseApi {
|
|||
|
||||
@Override
|
||||
public String[] apis() {
|
||||
return new String[]{"openApplet", "scanOpenApplet","qrcodeOpenApplet"};
|
||||
return new String[]{"openApplet", "scanOpenApplet","qrcodeOpenApplet", "changeUserId"};
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -41,6 +41,8 @@ public class AppletModule extends BaseApi {
|
|||
scanOpenApplet(param, callback);
|
||||
} else if ("qrcodeOpenApplet".equals(event)){
|
||||
qrcodeOpenApplet(param,callback);
|
||||
} else if ("changeUserId".equals(event)) {
|
||||
changeUserId(param, callback);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -138,4 +140,18 @@ public class AppletModule extends BaseApi {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void changeUserId(Map param, ICallback callback) {
|
||||
String userId = String.valueOf(param.get("userId"));
|
||||
if (FinAppClient.INSTANCE.getFinAppConfig() != null) {
|
||||
FinAppClient.INSTANCE.getFinAppConfig().setUserId(userId);
|
||||
callback.onSuccess(new HashMap());
|
||||
} else {
|
||||
callback.onFail(new HashMap(){
|
||||
{
|
||||
put("info", "sdk not initilized");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -121,8 +121,8 @@ public class BaseModule extends BaseApi {
|
|||
.setUserId(userId)
|
||||
.setDebugMode(debug)
|
||||
.setDisableRequestPermissions(disablePermission)
|
||||
.setBindAppletWithMainProcess(bindAppletWithMainProcess)
|
||||
.setPageCountLimit(pageCountLimit);
|
||||
.setBindAppletWithMainProcess(bindAppletWithMainProcess);
|
||||
// .setPageCountLimit(pageCountLimit);
|
||||
|
||||
if (customWebViewUserAgent != null)
|
||||
builder.setCustomWebViewUserAgent(customWebViewUserAgent);
|
||||
|
|
|
@ -387,6 +387,12 @@ class Mop {
|
|||
return Map<String, dynamic>.from(ret!);
|
||||
}
|
||||
|
||||
Future<Map<String, dynamic>> changeUserId(String userId) async {
|
||||
Map<String, Object> params = {'userId': userId};
|
||||
final ret = await _channel.invokeMapMethod("changeUserId", params);
|
||||
return Map<String, dynamic>.from(ret!);
|
||||
}
|
||||
|
||||
///
|
||||
/// close all running applets
|
||||
/// 关闭当前打开的所有小程序
|
||||
|
|
Loading…
Reference in New Issue