安卓15部分机型出现界面不兼容并且UI库有BUG,MD
Build Android APK / 编译 libcore.aar (push) Has been cancelled
Build Android APK / 编译 Android APK (release) (push) Has been cancelled
Build Android APK / 创建 GitHub Release (push) Has been cancelled
Build Multi-Platform / 编译 libcore (Android) (push) Has been cancelled
Build Multi-Platform / 编译 libcore (Windows) (push) Has been cancelled
Build Multi-Platform / 编译 libcore (macOS) (push) Has been cancelled
Build Multi-Platform / 编译 libcore (Linux) (push) Has been cancelled
Build Multi-Platform / 构建 Android APK (push) Has been cancelled
Build Multi-Platform / 构建 Windows (push) Has been cancelled
Build Multi-Platform / 构建 macOS (push) Has been cancelled
Build Multi-Platform / 构建 Linux (push) Has been cancelled
Build Multi-Platform / 构建 iOS (push) Has been cancelled
Build Multi-Platform / 创建 Release (push) Has been cancelled
Build Windows / 编译 libcore (Windows) (push) Has been cancelled
Build Windows / build (push) Has been cancelled
Build Multi-Platform / 编译 libcore (iOS/tvOS) (push) Has been cancelled

(cherry picked from commit 010405edda74bdb0251dcff2e32482edae2c9976)
This commit is contained in:
2025-11-02 02:38:07 -08:00
committed by speakeloudest
parent 0ec2f72a93
commit 7a223d614b
7 changed files with 96 additions and 314 deletions
+1 -108
View File
@@ -4,8 +4,6 @@ import 'package:kaer_with_panels/app/widgets/dialogs/kr_dialog.dart';
import 'package:kaer_with_panels/app/routes/app_pages.dart';
import 'package:kaer_with_panels/app/utils/kr_log_util.dart';
import 'package:kaer_with_panels/app/localization/app_translations.dart';
import 'dart:io';
import 'package:path_provider/path_provider.dart';
/// 订阅导航工具类
/// 用于统一处理订阅相关的导航逻辑
@@ -16,143 +14,38 @@ class KRSubscribeNavigationUtil {
///
/// [tag] 调用来源标签,用于日志记录
static void navigateToPurchase({String tag = 'Subscribe'}) {
print('🔔 [NavigationUtil] ========== navigateToPurchase 被调用 ==========');
print('🔔 [NavigationUtil] Tag: $tag');
print('🔔 [NavigationUtil] 当前时间: ${DateTime.now()}');
// 🔧 先获取关键信息并打印
final appRunData = KRAppRunData.getInstance();
final isDeviceLogin = appRunData.isDeviceLogin();
final account = appRunData.kr_account.value;
print('🔔 [NavigationUtil] 账号: $account');
print('🔔 [NavigationUtil] 是否设备登录: $isDeviceLogin');
KRLogUtil.kr_i('=== 订阅按钮点击 ===', tag: tag);
KRLogUtil.kr_i('账号: $account', tag: tag);
KRLogUtil.kr_i('是否设备登录: $isDeviceLogin', tag: tag);
// 🔧 文件写入改为非阻塞,放在后面
Future(() async {
try {
final dir = await getApplicationDocumentsDirectory();
final debugFile = File('${dir.path}/NAVIGATION_DEBUG.txt');
await debugFile.writeAsString(
'=' * 60 + '\n'
'🔔 navigateToPurchase 被调用!\n'
'时间: ${DateTime.now()}\n'
'来源: $tag\n'
'账号: $account\n'
'是否设备登录: $isDeviceLogin\n'
'版本标识: Android15_Fix_v7_DialogFixed\n'
'=' * 60 + '\n',
mode: FileMode.append,
);
} catch (e) {
print('🔔 [NavigationUtil] ❌ 写入导航日志失败: $e');
}
});
// 🔧 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'
'账号: $account\n'
'时间: ${DateTime.now()}\n'
'版本标识: Android15_Fix_v7_DialogFixed\n'
'-' * 60 + '\n',
mode: FileMode.append,
);
} catch (e) { /* 忽略 */ }
});
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);
},
);
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();
final debugFile = File('${dir.path}/NAVIGATION_DEBUG.txt');
await debugFile.writeAsString(
'✅ 普通用户,准备调用 Get.toNamed\n'
'路由: ${Routes.KR_PURCHASE_MEMBERSHIP}\n'
'时间: ${DateTime.now()}\n'
'版本标识: Android15_Fix_v7_DialogFixed\n'
'-' * 60 + '\n',
mode: FileMode.append,
);
} catch (e) { /* 忽略 */ }
});
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();
final debugFile = File('${dir.path}/NAVIGATION_DEBUG.txt');
await debugFile.writeAsString(
'✅ Get.toNamed 执行完成\n'
'路由: ${Routes.KR_PURCHASE_MEMBERSHIP}\n'
'返回值: $result\n'
'时间: ${DateTime.now()}\n'
'-' * 60 + '\n',
mode: FileMode.append,
);
} catch (e) {
print('🔔 [NavigationUtil] ❌ 写入跳转完成日志失败: $e');
}
});
Get.toNamed(Routes.KR_PURCHASE_MEMBERSHIP);
} catch (e) {
KRLogUtil.kr_e('跳转购买页面失败: $e', tag: tag);
print('🔔 [NavigationUtil] ❌❌❌ 跳转异常: $e');
Future(() async {
try {
final dir = await getApplicationDocumentsDirectory();
final debugFile = File('${dir.path}/NAVIGATION_DEBUG.txt');
await debugFile.writeAsString(
'❌ Get.toNamed 执行失败\n'
'异常: $e\n'
'时间: ${DateTime.now()}\n'
'-' * 60 + '\n',
mode: FileMode.append,
);
} catch (e) {
print('🔔 [NavigationUtil] ❌ 写入跳转失败日志失败: $e');
}
});
// 如果跳转失败,显示错误提示
KRDialog.show(