From bc202ca5bf6c12adae0dfadccce8827838161a8d Mon Sep 17 00:00:00 2001 From: Developer Date: Thu, 11 Jun 2026 18:51:13 +0800 Subject: [PATCH] =?UTF-8?q?=E9=B8=BF=E8=92=99=E7=AB=AF=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/editor/pages/editor/pro_editor_page.dart | 7 ++ .../controls/editor_bottom_toolbar_v2.dart | 7 ++ .../providers/sentence_detail_sheet.dart | 71 ++++++++--- .../experimental_features_page.dart | 13 ++ .../presentation/widget_management_page.dart | 117 +++++++++--------- macos/Flutter/GeneratedPluginRegistrant.swift | 4 +- pubspec.ohos.yaml | 2 +- 7 files changed, 138 insertions(+), 83 deletions(-) diff --git a/lib/editor/pages/editor/pro_editor_page.dart b/lib/editor/pages/editor/pro_editor_page.dart index d0fdbcbf..cf68f2b5 100644 --- a/lib/editor/pages/editor/pro_editor_page.dart +++ b/lib/editor/pages/editor/pro_editor_page.dart @@ -17,6 +17,8 @@ import 'package:pro_image_editor/pro_image_editor.dart' as pro; import 'package:xianyan/core/storage/kv_storage.dart'; import 'package:xianyan/core/router/app_nav_extension.dart'; import 'package:xianyan/core/router/app_routes.dart'; +import 'package:xianyan/core/utils/platform/platform_utils.dart' as pu; +import 'package:xianyan/shared/widgets/feedback/app_toast.dart'; import 'package:xianyan/core/router/editor_router.dart'; import 'package:xianyan/editor/services/core/pro_editor_bridge.dart'; import 'package:xianyan/editor/services/core/editor_theme_notifier.dart'; @@ -207,6 +209,11 @@ class ProEditorPageState extends State child: const Text('查看实验功能'), onPressed: () { Navigator.pop(ctx); + // 鸿蒙端暂不支持,弹出toast提示 + if (pu.isOhos) { + AppToast.showInfo('敬请期待'); + return; + } context.appPush(AppRoutes.experimentalFeatures); }, ), diff --git a/lib/editor/widgets/controls/editor_bottom_toolbar_v2.dart b/lib/editor/widgets/controls/editor_bottom_toolbar_v2.dart index 742c8947..a1bb7424 100644 --- a/lib/editor/widgets/controls/editor_bottom_toolbar_v2.dart +++ b/lib/editor/widgets/controls/editor_bottom_toolbar_v2.dart @@ -16,6 +16,8 @@ import 'package:pro_image_editor/pro_image_editor.dart' as pro; import 'package:xianyan/core/storage/kv_storage.dart'; import 'package:xianyan/core/router/app_nav_extension.dart'; import 'package:xianyan/core/router/app_routes.dart'; +import 'package:xianyan/core/utils/platform/platform_utils.dart' as pu; +import 'package:xianyan/shared/widgets/feedback/app_toast.dart'; import 'package:xianyan/editor/services/core/color_tokens.dart'; import 'package:xianyan/editor/services/core/editor_theme_notifier.dart'; import 'package:xianyan/editor/widgets/controls/editor_icon.dart'; @@ -522,6 +524,11 @@ class _EditorBottomToolbarV2State extends State child: const Text('查看实验功能'), onPressed: () { Navigator.pop(ctx); + // 鸿蒙端暂不支持,弹出toast提示 + if (pu.isOhos) { + AppToast.showInfo('敬请期待'); + return; + } context.appPush(AppRoutes.experimentalFeatures); }, ), diff --git a/lib/features/home/presentation/providers/sentence_detail_sheet.dart b/lib/features/home/presentation/providers/sentence_detail_sheet.dart index 60302172..a92353db 100644 --- a/lib/features/home/presentation/providers/sentence_detail_sheet.dart +++ b/lib/features/home/presentation/providers/sentence_detail_sheet.dart @@ -31,6 +31,7 @@ import 'package:xianyan/shared/widgets/feedback/share_sheet.dart'; import 'package:xianyan/features/home/providers/daily_card_style_provider.dart'; import 'package:xianyan/features/mine/user_center/providers/interaction_provider.dart'; import 'package:xianyan/core/utils/logger.dart'; +import 'package:xianyan/core/utils/platform/platform_utils.dart' as pu; import 'package:xianyan/core/services/audio/tts_service.dart'; import 'package:xianyan/shared/widgets/media/tts_player_bar.dart'; import 'package:xianyan/core/services/search/search_engine_service.dart'; @@ -196,7 +197,14 @@ class _SentenceDetailContentState /// 是否为医疗健康相关频道 bool get _isMedicalFeed { - const medicalTypes = {'drug', 'herbal', 'illness', 'prescription', 'tisana', 'jiufang'}; + const medicalTypes = { + 'drug', + 'herbal', + 'illness', + 'prescription', + 'tisana', + 'jiufang', + }; return medicalTypes.contains(sentence.feedType ?? sentence.type); } @@ -215,18 +223,12 @@ class _SentenceDetailContentState ), child: Row( children: [ - Icon( - CupertinoIcons.info_circle, - size: 14, - color: ext.textSecondary, - ), + Icon(CupertinoIcons.info_circle, size: 14, color: ext.textSecondary), const SizedBox(width: AppSpacing.xs), Expanded( child: Text( '内容仅供参考,不构成医疗建议', - style: AppTypography.caption2.copyWith( - color: ext.textSecondary, - ), + style: AppTypography.caption2.copyWith(color: ext.textSecondary), ), ), ], @@ -298,11 +300,17 @@ class _SentenceDetailContentState return Row( mainAxisSize: MainAxisSize.min, children: [ - Icon(CupertinoIcons.eye_fill, size: 11, color: ext.textHint), + Icon( + CupertinoIcons.eye_fill, + size: 11, + color: ext.textHint, + ), const SizedBox(width: 3), Text( NumberFormatter.formatCount(views), - style: AppTypography.caption2.copyWith(color: ext.textHint), + style: AppTypography.caption2.copyWith( + color: ext.textHint, + ), ), ], ); @@ -346,11 +354,23 @@ class _SentenceDetailContentState spacing: 8, children: [ if (likeCount > 0) - _StatChip(icon: CupertinoIcons.hand_thumbsup_fill, label: NumberFormatter.formatCount(likeCount), ext: ext), + _StatChip( + icon: CupertinoIcons.hand_thumbsup_fill, + label: NumberFormatter.formatCount(likeCount), + ext: ext, + ), if (favCount > 0) - _StatChip(icon: CupertinoIcons.star_fill, label: NumberFormatter.formatCount(favCount), ext: ext), + _StatChip( + icon: CupertinoIcons.star_fill, + label: NumberFormatter.formatCount(favCount), + ext: ext, + ), if (cmtCount > 0) - _StatChip(icon: CupertinoIcons.chat_bubble_fill, label: NumberFormatter.formatCount(cmtCount), ext: ext), + _StatChip( + icon: CupertinoIcons.chat_bubble_fill, + label: NumberFormatter.formatCount(cmtCount), + ext: ext, + ), ], ), ); @@ -533,7 +553,9 @@ class _SentenceDetailContentState children: [ Expanded( child: _QuickActionBtn( - icon: sentence.isLiked ? CupertinoIcons.heart_fill : CupertinoIcons.hand_thumbsup, + icon: sentence.isLiked + ? CupertinoIcons.heart_fill + : CupertinoIcons.hand_thumbsup, label: sentence.isLiked ? t.home.sentenceDetail.liked : t.home.sentenceDetail.like, @@ -651,7 +673,9 @@ class _SentenceDetailContentState final isBookmarked = result?['status'] == 'added'; HapticService.light(); AppToast.showSuccess( - isBookmarked ? t.home.sentenceDetail.bookmarkAdded : t.home.sentenceDetail.bookmarkRemoved, + isBookmarked + ? t.home.sentenceDetail.bookmarkAdded + : t.home.sentenceDetail.bookmarkRemoved, ); } }, @@ -669,7 +693,10 @@ class _SentenceDetailContentState onPressed: () { _showTagDialog(feedId, targetType); }, - child: Text(t.home.sentenceDetail.tag, style: TextStyle(color: ext.textPrimary)), + child: Text( + t.home.sentenceDetail.tag, + style: TextStyle(color: ext.textPrimary), + ), ), ), const SizedBox(width: 8), @@ -800,7 +827,9 @@ class _SentenceDetailContentState ); if (mounted) { AppToast.showSuccess( - ok ? t.home.sentenceDetail.tagAdded : t.home.sentenceDetail.tagAddFailed, + ok + ? t.home.sentenceDetail.tagAdded + : t.home.sentenceDetail.tagAddFailed, ); } }, @@ -856,6 +885,11 @@ class _SentenceDetailContentState color: ext.accent, borderRadius: AppRadius.mdBorder, onPressed: () { + // 鸿蒙端暂不支持编辑器,弹出toast提示 + if (pu.isOhos) { + AppToast.showInfo('敬请期待'); + return; + } Navigator.pop(context); context.appPush('/editor?text=${Uri.encodeComponent(sentence.text)}'); }, @@ -954,7 +988,6 @@ class _SentenceDetailContentState if (sentenceSummary.isNotEmpty) return sentenceSummary; return ''; } - } class _StatChip extends StatelessWidget { diff --git a/lib/features/mine/settings/presentation/experimental_features_page.dart b/lib/features/mine/settings/presentation/experimental_features_page.dart index 5652db27..cf002281 100644 --- a/lib/features/mine/settings/presentation/experimental_features_page.dart +++ b/lib/features/mine/settings/presentation/experimental_features_page.dart @@ -9,6 +9,9 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; +import '../../../../core/utils/platform/platform_utils.dart' as pu; +import '../../../../shared/widgets/feedback/app_toast.dart'; + import '../../../../core/services/feature/feature_flag_provider.dart'; import '../../../../core/services/feature/feature_flag_service.dart'; import '../../../../core/theme/app_theme.dart'; @@ -34,6 +37,16 @@ class _ExperimentalFeaturesPageState @override void initState() { super.initState(); + // 鸿蒙端拦截跳转,弹出toast并返回 + if (pu.isOhos) { + WidgetsBinding.instance.addPostFrameCallback((_) { + if (mounted) { + AppToast.showInfo('敬请期待'); + Navigator.pop(context); + } + }); + return; + } _pageController = PageController(initialPage: _selectedTab); } diff --git a/lib/features/widget/presentation/widget_management_page.dart b/lib/features/widget/presentation/widget_management_page.dart index 8c59af53..e5ccd5af 100644 --- a/lib/features/widget/presentation/widget_management_page.dart +++ b/lib/features/widget/presentation/widget_management_page.dart @@ -49,10 +49,7 @@ class _WidgetManagementPageState extends ConsumerState { } /// 开发中弹窗提示,支持"不再提醒" - /// 鸿蒙端不显示此弹窗 void _showDevDialogIfNeeded() { - // 鸿蒙端不显示Beta弹窗 - if (PlatformHelper.isHarmonyOS) return; final dismissed = KvStorage.getBool('widget_dev_dismissed') ?? false; if (dismissed) return; showCupertinoDialog( @@ -111,6 +108,11 @@ class _WidgetManagementPageState extends ConsumerState { child: const Text('查看实验功能'), onPressed: () { Navigator.pop(ctx); + // 鸿蒙端暂不支持,弹出toast提示 + if (PlatformHelper.isHarmonyOS) { + AppToast.showInfo('敬请期待'); + return; + } context.appPush(AppRoutes.experimentalFeatures); }, ), @@ -268,7 +270,10 @@ class _WidgetManagementPageState extends ConsumerState { try { final notifier = ref.read(wp.widgetProvider.notifier); - final wasInstalled = ref.read(wp.widgetProvider).installedWidgets.contains(type); + final wasInstalled = ref + .read(wp.widgetProvider) + .installedWidgets + .contains(type); final result = await notifier.requestPinWidget(type); @@ -289,7 +294,10 @@ class _WidgetManagementPageState extends ConsumerState { if (!mounted) return; await notifier.loadInstalledWidgets(); - final nowInstalled = ref.read(wp.widgetProvider).installedWidgets.contains(type); + final nowInstalled = ref + .read(wp.widgetProvider) + .installedWidgets + .contains(type); if (nowInstalled && !wasInstalled) { AppToast.showInfo('${type.title} 已添加到桌面'); } else if (!nowInstalled) { @@ -325,7 +333,10 @@ class _WidgetManagementPageState extends ConsumerState { if (!mounted) return; await notifier.loadInstalledWidgets(); - final nowInstalled = ref.read(wp.widgetProvider).installedWidgets.contains(type); + final nowInstalled = ref + .read(wp.widgetProvider) + .installedWidgets + .contains(type); if (!nowInstalled) { _showManualAddGuide(type, isUnsupported: false); } @@ -344,18 +355,18 @@ class _WidgetManagementPageState extends ConsumerState { '4️⃣ 选择「${type.title}」并添加到桌面', ] : PlatformHelper.isAndroid - ? [ - '1️⃣ 长按桌面空白处', - '2️⃣ 选择「小部件」', - '3️⃣ 找到「闲言」', - '4️⃣ 选择「${type.title}」拖动到桌面', - ] - : [ - '1️⃣ 向右滑动到今日视图', - '2️⃣ 滚动到底部点击「编辑」', - '3️⃣ 找到「闲言」', - '4️⃣ 选择「${type.title}」并添加', - ]; + ? [ + '1️⃣ 长按桌面空白处', + '2️⃣ 选择「小部件」', + '3️⃣ 找到「闲言」', + '4️⃣ 选择「${type.title}」拖动到桌面', + ] + : [ + '1️⃣ 向右滑动到今日视图', + '2️⃣ 滚动到底部点击「编辑」', + '3️⃣ 找到「闲言」', + '4️⃣ 选择「${type.title}」并添加', + ]; final guideReason = isUnsupported ? '当前设备不支持快捷添加,请按以下步骤手动添加到桌面:' @@ -369,7 +380,11 @@ class _WidgetManagementPageState extends ConsumerState { child: Row( mainAxisSize: MainAxisSize.min, children: [ - Icon(CupertinoIcons.square_grid_2x2_fill, size: 20, color: ext.accent), + Icon( + CupertinoIcons.square_grid_2x2_fill, + size: 20, + color: ext.accent, + ), const SizedBox(width: AppSpacing.xs), Text('添加「${type.title}」'), ], @@ -380,20 +395,18 @@ class _WidgetManagementPageState extends ConsumerState { children: [ Text( guideReason, - style: AppTypography.footnote.copyWith( - color: ext.textSecondary, - ), + style: AppTypography.footnote.copyWith(color: ext.textSecondary), ), const SizedBox(height: AppSpacing.md), - ...steps.map((s) => Padding( - padding: const EdgeInsets.only(bottom: AppSpacing.xs), - child: Text( - s, - style: AppTypography.subhead.copyWith( - color: ext.textPrimary, + ...steps.map( + (s) => Padding( + padding: const EdgeInsets.only(bottom: AppSpacing.xs), + child: Text( + s, + style: AppTypography.subhead.copyWith(color: ext.textPrimary), ), ), - )), + ), ], ), actions: [ @@ -928,9 +941,9 @@ class _WidgetDataPreviewState extends ConsumerState<_WidgetDataPreview> { setState(() => _loading = true); try { final service = ref.read(homeWidgetServiceProvider); - await service.updateWidget(widget.type).timeout( - const Duration(seconds: 5), - ); + await service + .updateWidget(widget.type) + .timeout(const Duration(seconds: 5)); await _loadPreview(); } on TimeoutException { if (_disposed || !mounted) return; @@ -945,24 +958,16 @@ class _WidgetDataPreviewState extends ConsumerState<_WidgetDataPreview> { String _getPreviewText() { return switch (widget.type) { - WidgetType.dailySentence => - '${_data['daily_sentence'] ?? '暂无数据'}', - WidgetType.readlater => - '未读 ${_data['readlater_count'] ?? 0} 条', - WidgetType.dailyFortune => - '${_data['fortune_text'] ?? '暂无数据'}', - WidgetType.countdown => - '${_data['countdown_title'] ?? '暂无数据'}', - WidgetType.pomodoro => - '剩余 ${_data['pomodoro_remaining'] ?? 0}s', - WidgetType.solarTerm => - '${_data['solar_term_name'] ?? '暂无数据'}', - WidgetType.checkin => - '连续 ${_data['checkin_days'] ?? 0} 天', + WidgetType.dailySentence => '${_data['daily_sentence'] ?? '暂无数据'}', + WidgetType.readlater => '未读 ${_data['readlater_count'] ?? 0} 条', + WidgetType.dailyFortune => '${_data['fortune_text'] ?? '暂无数据'}', + WidgetType.countdown => '${_data['countdown_title'] ?? '暂无数据'}', + WidgetType.pomodoro => '剩余 ${_data['pomodoro_remaining'] ?? 0}s', + WidgetType.solarTerm => '${_data['solar_term_name'] ?? '暂无数据'}', + WidgetType.checkin => '连续 ${_data['checkin_days'] ?? 0} 天', WidgetType.dailyWithCharacter => '${_data['daily_with_character_content'] ?? '暂无数据'}', - WidgetType.dailyCard => - '日签卡片', + WidgetType.dailyCard => '日签卡片', }; } @@ -980,11 +985,7 @@ class _WidgetDataPreviewState extends ConsumerState<_WidgetDataPreview> { children: [ Row( children: [ - Icon( - CupertinoIcons.eye_fill, - size: 12, - color: ext.textSecondary, - ), + Icon(CupertinoIcons.eye_fill, size: 12, color: ext.textSecondary), const SizedBox(width: 4), Text( '数据预览', @@ -999,11 +1000,7 @@ class _WidgetDataPreviewState extends ConsumerState<_WidgetDataPreview> { child: Row( mainAxisSize: MainAxisSize.min, children: [ - Icon( - CupertinoIcons.refresh, - size: 12, - color: ext.accent, - ), + Icon(CupertinoIcons.refresh, size: 12, color: ext.accent), const SizedBox(width: 2), Text( '刷新', @@ -1033,9 +1030,7 @@ class _WidgetDataPreviewState extends ConsumerState<_WidgetDataPreview> { ), child: Text( _getPreviewText(), - style: AppTypography.footnote.copyWith( - color: ext.textPrimary, - ), + style: AppTypography.footnote.copyWith(color: ext.textPrimary), maxLines: 2, overflow: TextOverflow.ellipsis, ), diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index 6a19590a..d29810a7 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -17,7 +17,7 @@ import flutter_app_group_directory import flutter_image_compress_macos import flutter_inappwebview_macos import flutter_local_notifications -import flutter_secure_storage_darwin +import flutter_secure_storage_macos import flutter_tts import flutter_webrtc import gal @@ -55,7 +55,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { FlutterImageCompressMacosPlugin.register(with: registry.registrar(forPlugin: "FlutterImageCompressMacosPlugin")) InAppWebViewFlutterPlugin.register(with: registry.registrar(forPlugin: "InAppWebViewFlutterPlugin")) FlutterLocalNotificationsPlugin.register(with: registry.registrar(forPlugin: "FlutterLocalNotificationsPlugin")) - FlutterSecureStorageDarwinPlugin.register(with: registry.registrar(forPlugin: "FlutterSecureStorageDarwinPlugin")) + FlutterSecureStoragePlugin.register(with: registry.registrar(forPlugin: "FlutterSecureStoragePlugin")) FlutterTtsPlugin.register(with: registry.registrar(forPlugin: "FlutterTtsPlugin")) FlutterWebRTCPlugin.register(with: registry.registrar(forPlugin: "FlutterWebRTCPlugin")) GalPlugin.register(with: registry.registrar(forPlugin: "GalPlugin")) diff --git a/pubspec.ohos.yaml b/pubspec.ohos.yaml index 2e58d606..a7cba027 100644 --- a/pubspec.ohos.yaml +++ b/pubspec.ohos.yaml @@ -20,7 +20,7 @@ name: xianyan description: "闲言 — 灵感语录更纯粹。每日拾句 + 壁纸创作 APP" publish_to: 'none' -version: 6.6.8+2606082 +version: 6.6.12+2606123 # 年月日-次 7位 environment: