增加切换用户接口
parent
3fa610fdc4
commit
6e75fe48e7
|
@ -30,7 +30,7 @@ public class AppletModule extends BaseApi {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String[] apis() {
|
public String[] apis() {
|
||||||
return new String[]{"openApplet", "scanOpenApplet","qrcodeOpenApplet"};
|
return new String[]{"openApplet", "scanOpenApplet","qrcodeOpenApplet", "changeUserId"};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -41,6 +41,8 @@ public class AppletModule extends BaseApi {
|
||||||
scanOpenApplet(param, callback);
|
scanOpenApplet(param, callback);
|
||||||
} else if ("qrcodeOpenApplet".equals(event)){
|
} else if ("qrcodeOpenApplet".equals(event)){
|
||||||
qrcodeOpenApplet(param,callback);
|
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)
|
.setUserId(userId)
|
||||||
.setDebugMode(debug)
|
.setDebugMode(debug)
|
||||||
.setDisableRequestPermissions(disablePermission)
|
.setDisableRequestPermissions(disablePermission)
|
||||||
.setBindAppletWithMainProcess(bindAppletWithMainProcess)
|
.setBindAppletWithMainProcess(bindAppletWithMainProcess);
|
||||||
.setPageCountLimit(pageCountLimit);
|
// .setPageCountLimit(pageCountLimit);
|
||||||
|
|
||||||
if (customWebViewUserAgent != null)
|
if (customWebViewUserAgent != null)
|
||||||
builder.setCustomWebViewUserAgent(customWebViewUserAgent);
|
builder.setCustomWebViewUserAgent(customWebViewUserAgent);
|
||||||
|
|
|
@ -387,6 +387,12 @@ class Mop {
|
||||||
return Map<String, dynamic>.from(ret!);
|
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
|
/// close all running applets
|
||||||
/// 关闭当前打开的所有小程序
|
/// 关闭当前打开的所有小程序
|
||||||
|
|
Loading…
Reference in New Issue