Some checks failed
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 (iOS/tvOS) (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
(cherry picked from commit 010405edda74bdb0251dcff2e32482edae2c9976)
61 lines
2.3 KiB
Dart
61 lines
2.3 KiB
Dart
import 'package:get/get.dart';
|
|
import 'package:kaer_with_panels/app/common/app_run_data.dart';
|
|
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';
|
|
|
|
/// 订阅导航工具类
|
|
/// 用于统一处理订阅相关的导航逻辑
|
|
class KRSubscribeNavigationUtil {
|
|
/// 导航到购买会员页面
|
|
/// 如果是设备登录用户,会先提示需要绑定账号,然后跳转到登录页面
|
|
/// 如果是普通用户,直接跳转到购买会员页面
|
|
///
|
|
/// [tag] 调用来源标签,用于日志记录
|
|
static void navigateToPurchase({String tag = 'Subscribe'}) {
|
|
final appRunData = KRAppRunData.getInstance();
|
|
final isDeviceLogin = appRunData.isDeviceLogin();
|
|
final account = appRunData.kr_account.value;
|
|
|
|
KRLogUtil.kr_i('=== 订阅按钮点击 ===', tag: tag);
|
|
KRLogUtil.kr_i('账号: $account', tag: tag);
|
|
KRLogUtil.kr_i('是否设备登录: $isDeviceLogin', tag: tag);
|
|
|
|
if (isDeviceLogin) {
|
|
// 设备登录用户 - 显示绑定账号提示对话框
|
|
KRLogUtil.kr_i('设备登录用户,显示绑定提示', tag: tag);
|
|
|
|
try {
|
|
KRDialog.show(
|
|
title: AppTranslations.kr_dialog.deviceLoginBindingTitle,
|
|
message: AppTranslations.kr_dialog.deviceLoginBindingMessage,
|
|
confirmText: AppTranslations.kr_dialog.kr_ok,
|
|
onConfirm: () {
|
|
Get.toNamed(Routes.MR_LOGIN);
|
|
},
|
|
);
|
|
} catch (e) {
|
|
KRLogUtil.kr_e('显示绑定提示对话框失败: $e', tag: tag);
|
|
}
|
|
} else {
|
|
// 普通登录用户 - 直接跳转到购买页面
|
|
KRLogUtil.kr_i('普通用户,跳转到购买页面', tag: tag);
|
|
|
|
try {
|
|
Get.toNamed(Routes.KR_PURCHASE_MEMBERSHIP);
|
|
} catch (e) {
|
|
KRLogUtil.kr_e('跳转购买页面失败: $e', tag: tag);
|
|
|
|
// 如果跳转失败,显示错误提示
|
|
KRDialog.show(
|
|
title: AppTranslations.kr_dialog.error,
|
|
message: AppTranslations.kr_home.checkNetwork,
|
|
confirmText: AppTranslations.kr_dialog.kr_ok,
|
|
onConfirm: () => Get.back(),
|
|
);
|
|
}
|
|
}
|
|
}
|
|
}
|