feat: 修复ios上未检测到账号,弹窗没显示问题

This commit is contained in:
2025-12-03 20:27:48 -08:00
parent 24cf03d6ce
commit 56c7fd6921
5 changed files with 27 additions and 8 deletions
@@ -11,6 +11,7 @@ import 'package:kaer_with_panels/app/widgets/kr_app_text_style.dart';
import 'package:kaer_with_panels/app/services/global_overlay_service.dart';
import 'package:kaer_with_panels/app/services/singbox_imp/kr_sing_box_imp.dart';
import 'package:kaer_with_panels/singbox/model/singbox_status.dart';
import 'package:kaer_with_panels/app/utils/account_guard.dart';
DateTime? _hiConnectBtnNextAllowedAt;
const Duration _hiConnectBtnDebounce = Duration(milliseconds: 800);
@@ -90,8 +91,10 @@ class HIAnimatedConnectButton extends GetView<KRHomeController> {
: Theme.of(context).primaryColor,
clipBehavior: Clip.antiAlias,
child: InkWell(
onTap: () {
onTap: () async {
HapticFeedback.lightImpact();
final ok = await ensureAccountExists();
if (!ok) return;
final _now = DateTime.now();
if (_hiConnectBtnNextAllowedAt != null &&
_now.isBefore(_hiConnectBtnNextAllowedAt!)) {
@@ -8,6 +8,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import '../controllers/kr_home_controller.dart';
import '../../../routes/app_pages.dart';
import 'package:kaer_with_panels/app/services/global_overlay_service.dart';
import 'package:kaer_with_panels/app/utils/account_guard.dart';
// ======================= 1. Circular Clipper (保持不变) =======================
class CircularClipper extends CustomClipper<Path> {
@@ -173,7 +174,11 @@ class _HISubscriptionCornerButtonState extends State<HISubscriptionCornerButton>
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: () => _startCircularTransition(context),
onTap: () async {
final ok = await ensureAccountExists();
if (!ok) return;
_startCircularTransition(context);
},
child: Container(
key: _buttonKey, // 绑定 GlobalKey
width: widget.size,
@@ -185,4 +190,4 @@ class _HISubscriptionCornerButtonState extends State<HISubscriptionCornerButton>
),
);
}
}
}
@@ -21,6 +21,7 @@ import 'package:kaer_with_panels/app/services/global_overlay_service.dart';
import 'package:kaer_with_panels/app/widgets/swipe/has_swipe_config.dart';
import 'package:kaer_with_panels/app/widgets/swipe/swipe_config.dart';
import 'package:kaer_with_panels/app/routes/app_pages.dart';
import 'package:kaer_with_panels/app/utils/account_guard.dart';
class KRHomeView extends StatefulWidget implements HasSwipeConfig {
const KRHomeView({super.key});
@@ -29,10 +30,17 @@ class KRHomeView extends StatefulWidget implements HasSwipeConfig {
enableLeft: true,
enableRight: true,
onLeft: () {
Get.toNamed(Routes.HI_MENU);
ensureAccountExists().then((ok) {
if (!ok) return;
Get.toNamed(Routes.HI_MENU);
});
},
onRight: () {
ensureAccountExists().then((ok) {
if (!ok) return;
GlobalOverlayService.instance.triggerSubscriptionAnimation();
});
},
onRight: () =>
GlobalOverlayService.instance.triggerSubscriptionAnimation(),
);
@override
+4 -1
View File
@@ -4,6 +4,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:kaer_with_panels/app/widgets/kr_local_image.dart';
import 'package:kaer_with_panels/app/routes/app_pages.dart';
import 'package:kaer_with_panels/app/utils/account_guard.dart';
/// 🔹 HIBaseScaffold
/// 用于统一页面结构:
@@ -112,7 +113,9 @@ class HIBaseScaffold extends StatelessWidget {
// 优先显示菜单按钮
if (showMenuButton) {
return GestureDetector(
onTap: () {
onTap: () async {
final ok = await ensureAccountExists();
if (!ok) return;
Get.toNamed(Routes.HI_MENU);
},
child: Container(
+1 -1
View File
@@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 0.0.4+101
version: 0.0.4+103
environment:
sdk: '>=3.5.0 <4.0.0'