彻底解决在安卓15部分机型出现界面不兼容等问题
(cherry picked from commit fc31fc6e5ee3a7aefa8928bb40d164282e4edf90)
This commit is contained in:
@@ -44,7 +44,7 @@ class KRSubscribeNavigationUtil {
|
||||
'来源: $tag\n'
|
||||
'账号: $account\n'
|
||||
'是否设备登录: $isDeviceLogin\n'
|
||||
'版本标识: Android15_Fix_v5\n'
|
||||
'版本标识: Android15_Fix_v7_DialogFixed\n'
|
||||
'=' * 60 + '\n',
|
||||
mode: FileMode.append,
|
||||
);
|
||||
@@ -53,45 +53,51 @@ class KRSubscribeNavigationUtil {
|
||||
}
|
||||
});
|
||||
|
||||
if (isDeviceLogin) {
|
||||
// 设备登录用户需要绑定账号
|
||||
print('🔔 [NavigationUtil] ⚠️ 检测到设备登录,将显示绑定提示对话框');
|
||||
KRLogUtil.kr_i('检测到设备登录,显示绑定提示', tag: tag);
|
||||
// 🔧 v7 关键修复:恢复业务逻辑 - 设备登录用户必须先看到绑定提示对话框
|
||||
// v6 版本试图跳过对话框直接购买,但用户明确要求必须提示登录
|
||||
// 已修复 KRDialog 的 ScreenUtil 问题,对话框现在应该可以正常显示
|
||||
|
||||
if (isDeviceLogin) {
|
||||
// 设备登录用户 - 显示绑定账号提示对话框
|
||||
print('🔔 [NavigationUtil] ⚠️ 检测到设备登录,显示绑定账号提示对话框');
|
||||
KRLogUtil.kr_i('设备登录用户,显示绑定提示', tag: tag);
|
||||
|
||||
// 🔧 记录显示对话框
|
||||
Future(() async {
|
||||
try {
|
||||
final dir = await getApplicationDocumentsDirectory();
|
||||
final debugFile = File('${dir.path}/NAVIGATION_DEBUG.txt');
|
||||
await debugFile.writeAsString(
|
||||
'⚠️ 用户是设备登录,显示绑定提示对话框\n'
|
||||
'⚠️ 检测到设备登录,准备显示对话框\n'
|
||||
'账号: $account\n'
|
||||
'时间: ${DateTime.now()}\n'
|
||||
'版本标识: Android15_Fix_v7_DialogFixed\n'
|
||||
'-' * 60 + '\n',
|
||||
mode: FileMode.append,
|
||||
);
|
||||
} catch (e) { /* 忽略 */ }
|
||||
});
|
||||
|
||||
KRDialog.show(
|
||||
title: AppTranslations.kr_dialog.deviceLoginBindingTitle,
|
||||
message: AppTranslations.kr_dialog.deviceLoginBindingMessage,
|
||||
confirmText: AppTranslations.kr_dialog.kr_ok,
|
||||
cancelText: AppTranslations.kr_dialog.kr_cancel,
|
||||
onConfirm: () {
|
||||
Get.back(); // 关闭对话框
|
||||
// 等待对话框完全关闭后再跳转到登录页面
|
||||
Future.delayed(const Duration(milliseconds: 300), () {
|
||||
try {
|
||||
print('🔔 [NavigationUtil] 📍 正在调用 KRDialog.show() 显示绑定提示...');
|
||||
KRDialog.show(
|
||||
title: AppTranslations.kr_dialog.deviceLoginBindingTitle,
|
||||
message: AppTranslations.kr_dialog.deviceLoginBindingMessage,
|
||||
confirmText: AppTranslations.kr_dialog.kr_ok,
|
||||
onConfirm: () {
|
||||
print('🔔 [NavigationUtil] 用户点击确认,跳转到登录页面');
|
||||
Get.toNamed(Routes.MR_LOGIN);
|
||||
});
|
||||
},
|
||||
onCancel: () => Get.back(),
|
||||
);
|
||||
},
|
||||
);
|
||||
print('🔔 [NavigationUtil] 📍 KRDialog.show() 调用完成');
|
||||
} catch (e) {
|
||||
KRLogUtil.kr_e('显示绑定提示对话框失败: $e', tag: tag);
|
||||
print('🔔 [NavigationUtil] ❌ 显示对话框异常: $e');
|
||||
}
|
||||
} else {
|
||||
// 正常流程 - 跳转到购买页面
|
||||
// 普通登录用户 - 直接跳转到购买页面
|
||||
print('🔔 [NavigationUtil] ✅ 普通用户,准备跳转到购买页面');
|
||||
KRLogUtil.kr_i('普通用户,跳转到购买页面', tag: tag);
|
||||
|
||||
// 🔧 立即记录准备跳转
|
||||
Future(() async {
|
||||
try {
|
||||
final dir = await getApplicationDocumentsDirectory();
|
||||
@@ -100,6 +106,7 @@ class KRSubscribeNavigationUtil {
|
||||
'✅ 普通用户,准备调用 Get.toNamed\n'
|
||||
'路由: ${Routes.KR_PURCHASE_MEMBERSHIP}\n'
|
||||
'时间: ${DateTime.now()}\n'
|
||||
'版本标识: Android15_Fix_v7_DialogFixed\n'
|
||||
'-' * 60 + '\n',
|
||||
mode: FileMode.append,
|
||||
);
|
||||
@@ -107,12 +114,10 @@ class KRSubscribeNavigationUtil {
|
||||
});
|
||||
|
||||
try {
|
||||
// 🔧 添加加载保护,避免页面跳转时卡死
|
||||
print('🔔 [NavigationUtil] 📍 步骤1: 正在调用 Get.toNamed(${Routes.KR_PURCHASE_MEMBERSHIP})...');
|
||||
final result = Get.toNamed(Routes.KR_PURCHASE_MEMBERSHIP);
|
||||
print('🔔 [NavigationUtil] 📍 步骤2: Get.toNamed 调用完成,返回值: $result');
|
||||
|
||||
// 🔧 文件写入改为非阻塞
|
||||
Future(() async {
|
||||
try {
|
||||
final dir = await getApplicationDocumentsDirectory();
|
||||
@@ -133,7 +138,6 @@ class KRSubscribeNavigationUtil {
|
||||
KRLogUtil.kr_e('跳转购买页面失败: $e', tag: tag);
|
||||
print('🔔 [NavigationUtil] ❌❌❌ 跳转异常: $e');
|
||||
|
||||
// 🔧 文件写入改为非阻塞
|
||||
Future(() async {
|
||||
try {
|
||||
final dir = await getApplicationDocumentsDirectory();
|
||||
|
||||
Reference in New Issue
Block a user