fix: 首次初始化失败率比较高的问题
This commit is contained in:
parent
76ba875d55
commit
23eb97be4a
@ -199,14 +199,16 @@ class StarLockLoginLogic extends BaseGetXController {
|
|||||||
if (entity.data!.abbreviation?.toLowerCase() == 'cn' &&
|
if (entity.data!.abbreviation?.toLowerCase() == 'cn' &&
|
||||||
currentLanguage == 'zh_CN') {
|
currentLanguage == 'zh_CN') {
|
||||||
// 初始化一键登录服务
|
// 初始化一键登录服务
|
||||||
JverifyOneClickLoginManage.instance.initSDK().then((value) async {
|
JverifyOneClickLoginManage.instance.initSDK(onSuccess: () async {
|
||||||
final bool isCheckVerifyEnable =
|
final bool isCheckVerifyEnable =
|
||||||
await JverifyOneClickLoginManage.instance.checkVerifyEnable();
|
await JverifyOneClickLoginManage.instance.checkVerifyEnable();
|
||||||
state.isCheckVerifyEnable.value = isCheckVerifyEnable;
|
state.isCheckVerifyEnable.trigger(isCheckVerifyEnable);
|
||||||
AppLog.log('一键登录初始化认证结果:${state.isCheckVerifyEnable.value}');
|
AppLog.log('一键登录初始化认证结果:${state.isCheckVerifyEnable.value}');
|
||||||
if (isCheckVerifyEnable) {
|
if (isCheckVerifyEnable) {
|
||||||
oneClickLoginAction(Get.context!);
|
oneClickLoginAction(Get.context!);
|
||||||
}
|
}
|
||||||
|
}, onFailure: () {
|
||||||
|
print('jpush sdk init failed');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -38,9 +38,36 @@ class JverifyOneClickLoginManage {
|
|||||||
/// 运营商信息
|
/// 运营商信息
|
||||||
String f_opr_key = 'operator';
|
String f_opr_key = 'operator';
|
||||||
|
|
||||||
Future<void> initSDK() async {
|
Future<void> initSDK({Function? onSuccess, Function? onFailure}) async {
|
||||||
try {
|
try {
|
||||||
await initPlatformState();
|
// 初始化 SDK 之前添加监听
|
||||||
|
jverify.addSDKSetupCallBackListener((JVSDKSetupEvent event) {
|
||||||
|
print('receive sdk setup call back event :${event.toMap()}');
|
||||||
|
if (event.code == 8000) {
|
||||||
|
onSuccess?.call();
|
||||||
|
} else {
|
||||||
|
onFailure?.call();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
jverify.setDebugMode(true); // 打开调试模式
|
||||||
|
jverify.setCollectionAuth(true);
|
||||||
|
String appKey;
|
||||||
|
if (F.isSKY) {
|
||||||
|
appKey = '7ff37d174c1a568a89e98dad';
|
||||||
|
AppLog.log('appKey:7ff37d174c1a568a89e98dad');
|
||||||
|
} else {
|
||||||
|
appKey = '251fc8074820d122b6de58d2';
|
||||||
|
AppLog.log('appKey:251fc8074820d122b6de58d2');
|
||||||
|
}
|
||||||
|
jverify.setup(
|
||||||
|
appKey: appKey, //"你自己应用的 AppKey",
|
||||||
|
channel: 'devloper');
|
||||||
|
|
||||||
|
/// 授权页面点击时间监听
|
||||||
|
jverify.addAuthPageEventListener((JVAuthPageEvent event) {
|
||||||
|
print('receive auth page event :${event.toMap()}');
|
||||||
|
});
|
||||||
|
|
||||||
// isInitSuccess();
|
// isInitSuccess();
|
||||||
|
|
||||||
@ -52,32 +79,6 @@ class JverifyOneClickLoginManage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> initPlatformState() async {
|
|
||||||
// 初始化 SDK 之前添加监听
|
|
||||||
jverify.addSDKSetupCallBackListener((JVSDKSetupEvent event) {
|
|
||||||
print('receive sdk setup call back event :${event.toMap()}');
|
|
||||||
});
|
|
||||||
|
|
||||||
jverify.setDebugMode(true); // 打开调试模式
|
|
||||||
jverify.setCollectionAuth(true);
|
|
||||||
String appKey;
|
|
||||||
if (F.isSKY) {
|
|
||||||
appKey = '7ff37d174c1a568a89e98dad';
|
|
||||||
AppLog.log('appKey:7ff37d174c1a568a89e98dad');
|
|
||||||
} else {
|
|
||||||
appKey = '251fc8074820d122b6de58d2';
|
|
||||||
AppLog.log('appKey:251fc8074820d122b6de58d2');
|
|
||||||
}
|
|
||||||
jverify.setup(
|
|
||||||
appKey: appKey, //"你自己应用的 AppKey",
|
|
||||||
channel: 'devloper');
|
|
||||||
|
|
||||||
/// 授权页面点击时间监听
|
|
||||||
jverify.addAuthPageEventListener((JVAuthPageEvent event) {
|
|
||||||
print('receive auth page event :${event.toMap()}');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/// sdk 初始化是否完成
|
/// sdk 初始化是否完成
|
||||||
Future<bool> isInitSuccess() async {
|
Future<bool> isInitSuccess() async {
|
||||||
final Map<dynamic, dynamic> map = await jverify.isInitSuccess();
|
final Map<dynamic, dynamic> map = await jverify.isInitSuccess();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user