fix:对齐金值,主要注销,一键登录等方面修改
This commit is contained in:
1 parent
e29ed0a2c8
commit
6997a65c96
37 files changed
+3442
-514
No files matched your search
@@ -24,6 +24,9 @@ abstract interface class OneKeyLoginGateway {
|
||||
|
||||
void setWidgetCallback(OneKeyLoginCallback? callback);
|
||||
|
||||
/// 仅在用户点按一键登录后调用,预热运营商授权页。
|
||||
Future<Object?> accelerate();
|
||||
|
||||
Future<void> requestLogin(UMCustomModel uiConfig);
|
||||
|
||||
void closeAuthPage();
|
||||
@@ -65,6 +68,11 @@ class UmengOneKeyLoginGateway implements OneKeyLoginGateway {
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Object?> accelerate() {
|
||||
return UmengVerifySdk.accelerateLoginPageWithTimeout(3);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> requestLogin(UMCustomModel uiConfig) async {
|
||||
await UmengVerifySdk.getLoginTokenWithTimeout(3, uiConfig);
|
||||
@@ -137,15 +145,25 @@ class OneKeyLoginSdkSession {
|
||||
return _result.future;
|
||||
}
|
||||
|
||||
// Availability checking already pre-accelerates the carrier page. Start
|
||||
// the token request directly here; the SDK performs its own preflight when
|
||||
// needed and reports its timeout/error through the registered callback.
|
||||
// 预热必须由用户显式点击触发;不在启动或隐私同意阶段调用它。
|
||||
unawaited(_startNativeLogin(uiConfig));
|
||||
return _result.future;
|
||||
}
|
||||
|
||||
Future<void> _startNativeLogin(UMCustomModel uiConfig) async {
|
||||
try {
|
||||
// 与 jinzhi-flutter-app 保持一致。未预热时 SDK 会在此处隐式预热,
|
||||
// 在部分 Android 机型上更容易超时或直接回调失败。
|
||||
final preheat = await _gateway.accelerate();
|
||||
if (kDebugMode && preheat is Map && preheat['ret'] != null) {
|
||||
// `ret` 是运营商预热失败码;插件原生层未将它输出到 logcat。
|
||||
// 预热失败不阻断接下来的 getLoginToken,SDK 会自行再试一次。
|
||||
debugPrint(
|
||||
'OneKeyLogin preheat failed: vendor=${preheat['vendor']}, '
|
||||
'ret=${preheat['ret']}',
|
||||
);
|
||||
}
|
||||
if (_terminal) return;
|
||||
_gateway.setTokenCallback(_handleTokenResult);
|
||||
_gateway.setWidgetCallback((Object? _) {});
|
||||
_gateway.setUiCallback(_handleUiResult);
|
||||
@@ -186,6 +204,15 @@ class OneKeyLoginSdkSession {
|
||||
|
||||
void _handleTokenResult(Object? result) {
|
||||
final code = extractUmengLoginCode(result);
|
||||
if (kDebugMode && !isUmengTokenSuccess(result)) {
|
||||
final map = result is Map ? result : const <Object?, Object?>{};
|
||||
// 本地插件原先丢弃了 onTokenFailed 的 ret;只记录诊断字段,绝不记录 token。
|
||||
debugPrint(
|
||||
'OneKeyLogin Android/iOS SDK result: code=$code, '
|
||||
'msg=${map['msg']}, vendor=${map['vendorName']}, '
|
||||
'carrierError=${map['carrierFailedResultData']}',
|
||||
);
|
||||
}
|
||||
// On iOS, 700002 only means the user tapped the authorization page's
|
||||
// login button. It is followed by a separate 600000 (or 600xxx) token
|
||||
// callback, so completing the session here discards that callback.
|
||||
|
||||
Reference in new issue
Block a user