This commit is contained in:
Developer
2026-06-26 09:07:55 +08:00
parent 2a66f565cc
commit 10a917adf6
9 changed files with 61 additions and 25 deletions

View File

@@ -6,6 +6,43 @@
***
## [v6.139.0] - 2026-06-26
### 🧹 macOS 编译验证 + 静态分析清理
#### 背景
编译运行 macOS 端验证应用状态,确认无构建错误和运行时异常。同时清理 `flutter analyze` 报告的低风险静态问题,并将 `PermissionService.openSettings` 透传权限名到原生日志,提升 macOS 权限跳转日志可读性。
#### 编译运行验证
- `flutter run -d macos` 编译成功,应用正常启动
- 网络请求正常(`/api/user_center/index``/api/webapi/ip``/api/feed/favorites` 返回 200
- 菜单栏语言切换、GoRouter 路由跳转、权限被拒后引导跳转系统设置均工作正常
- 运行日志中观察到的 `macOS photos 权限请求失败: permanentlyDenied` 属预期行为(用户在 TCC 弹窗拒绝),应用正确引导用户前往系统设置
#### 静态分析清理25 → 200 error / 0 warning
| 文件 | 修复 |
|------|------|
| `lib/features/reading_report/presentation/reading_report_page.dart` | 移除未使用的 `go_router` import |
| `lib/core/router/app_nav_extension.dart` | 移除冗余的 `flutter/widgets.dart` importcupertino.dart 已覆盖) |
| `test/l10n/translation_coverage_test.dart` | 添加 `ignore_for_file: avoid_print`(测试诊断输出) |
#### 权限跳转日志增强
**`lib/core/services/auth/permission_service.dart`**
- `openSettings()` 新增可选参数 `AppPermission? permission`
- macOS 分支透传 `permission.macosPermissionName``MacosPlatformService.openPermissionSettings()`
- 原生日志从「权限: nil」改善为「权限: photos」等具名输出macOS 无法深链到具体权限子页,仅用于日志可读性)
**调用点同步更新**4 处):
- `_showSettingsDialog``openSettings(perm)`
- `_showDeniedDialog``openSettings(perm)`
- `permission_management_page.dart``openSettings(p)`
- `theme_sections_style.dart``openSettings(AppPermission.photos)`
#### 验证
- `flutter analyze` 通过0 error / 0 warning剩余 20 个 infoasync gap、`bytes` 废弃、参数冗余)按需后续处理
---
## [v6.138.0] - 2026-06-26
### 🔧 全量迁移应用数据至 Application Supportv6.137.0 后续)

View File

@@ -1,13 +1,12 @@
// ============================================================
// 闲言APP — 跨平台导航扩展
// 创建时间: 2026-05-18
// 更新时间: 2026-06-23
// 更新时间: 2026-06-26
// 作用: 统一导航API鸿蒙端使用OhosNavBridge其他端使用GoRouter自动记录最近路由
// 上次更新: appPushWidget 新增 extra 参数 — 工作台模式下传递额外数据到右栏
// 上次更新: 移除冗余的 flutter/widgets.dart importcupertino.dart 已覆盖)
// ============================================================
import 'package:flutter/cupertino.dart';
import 'package:flutter/widgets.dart';
import 'package:go_router/go_router.dart';
import 'package:xianyan/core/utils/platform/platform_utils.dart' as pu;
import 'package:xianyan/core/router/ohos_nav_bridge.dart';

View File

@@ -3,14 +3,9 @@
/// 创建时间: 2026-04-23
/// 更新时间: 2026-06-26
/// 作用: 统一管理应用权限请求,支持相机/相册/通知/位置/蓝牙/附近设备/麦克风/存储/网络/剪贴板/分享/本地服务器权限 + iOS ATT授权
/// 上次更新: 1. macOS 端权限改为动态申请(原生 MethodChannel
/// 新增 macOS 权限名称映射camera/microphone/photos/notification
/// checkStatus 调用 MacosPlatformService.checkPermission 查询 TCC 状态,
/// requestPermission 调用 MacosPlatformService.requestPermission 触发系统弹窗,
/// openSettings 调用 MacosPlatformService.openPermissionSettings 跳转系统设置。
/// 替代之前"直接返回 granted"的简化方案,让用户能在权限管理页面主动触发授权。
/// 2. 保留 localServer 虚拟权限、isPlatformRelevant 全平台适配、
/// MissingPluginException 兜底等既有逻辑。
/// 上次更新: openSettings() 新增可选 permission 参数透传权限名到原生日志macOS
/// 改善「权限: nil」日志可读性调用点同步更新_showSettingsDialog /
/// _showDeniedDialog / permission_management_page / theme_sections_style
/// ============================================================
import 'dart:async';
@@ -814,12 +809,16 @@ class PermissionService {
/// - macOS: 通过原生 MethodChannel 打开"系统设置 > 隐私与安全性"
/// - Linux: 使用 xdg-open 打开系统设置(无统一协议,尝试 gnome-control-center
/// - 其他平台: 使用 permission_handler 的 openAppSettings()
static Future<bool> openSettings() async {
///
/// [permission] 可选,传入触发跳转的权限以丰富原生日志(仅 macOS 生效)。
static Future<bool> openSettings([AppPermission? permission]) async {
// macOS: 通过原生 MethodChannel 打开系统设置(统一跳转入口)
if (pu.isMacOS) {
try {
await MacosPlatformService.openPermissionSettings(null);
_log.i('打开 macOS 系统设置: 隐私与安全性');
// 透传权限名到原生层仅用于日志可读性macOS 无法深链到具体权限子页)
final macosName = permission?.macosPermissionName;
await MacosPlatformService.openPermissionSettings(macosName);
_log.i('打开 macOS 系统设置: 隐私与安全性${macosName != null ? '$macosName' : ''}');
return true;
} catch (e) {
_log.e('打开 macOS 系统设置失败', e);
@@ -924,7 +923,7 @@ class PermissionService {
child: const Text('去设置'),
onPressed: () {
Navigator.pop(context);
openSettings();
openSettings(perm);
},
),
],
@@ -1025,7 +1024,7 @@ class PermissionService {
child: const Text('去设置'),
onPressed: () {
Navigator.pop(context);
openSettings();
openSettings(perm);
},
),
CupertinoDialogAction(

View File

@@ -1,16 +1,15 @@
/// ============================================================
/// 闲言APP — 使用报告主页面
/// 创建时间: 2026-05-02
/// 更新时间: 2026-06-22
/// 更新时间: 2026-06-26
/// 作用: 周/月/年报切换 + 摘要卡片 + 趋势图 + 热力图 + 成就回顾
/// 上次更新: 新增 CSV 导出按钮、热力图点击查看当日详情、同比环比变化率展示
/// 上次更新: 移除未使用的 go_router import静态分析清理
/// ============================================================
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_animate/flutter_animate.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:go_router/go_router.dart';
import 'package:share_plus/share_plus.dart';
import '../../../core/router/app_nav_extension.dart';

View File

@@ -328,7 +328,7 @@ class _PermissionManagementPageState
permission: p,
status: statuses[p] ?? AppPermissionStatus.notDetermined,
onRequest: () => _requestPermission(p),
onOpenSettings: () => PermissionService.openSettings(),
onOpenSettings: () => PermissionService.openSettings(p),
perm: perm,
bounceAnimation: isNotification ? _bounceAnimation : null,
),

View File

@@ -990,7 +990,7 @@ class WallpaperSection extends ConsumerWidget {
child: Text(t.theme.goToSettings),
onPressed: () {
Navigator.pop(ctx);
PermissionService.openSettings();
PermissionService.openSettings(AppPermission.photos);
},
),
],

View File

@@ -21,7 +21,7 @@
name: xianyan
description: "闲言 — 灵感语录更纯粹。每日拾句 + 壁纸创作 APP"
publish_to: 'none'
version: 6.6.25+2606260
version: 6.6.27+2606271
# 年月日-次 7位
environment:

View File

@@ -20,7 +20,7 @@
name: xianyan
description: "闲言 — 灵感语录更纯粹。每日拾句 + 壁纸创作 APP"
publish_to: 'none'
version: 6.6.25+2606260
version: 6.6.27+2606271
# 年月日-次 7位
environment:

View File

@@ -1,11 +1,13 @@
/// ============================================================
/// 闲言APP — 翻译覆盖率检测测试
/// 创建时间: 2026-05-29
/// 更新时间: 2026-05-29
/// 更新时间: 2026-06-26
/// 作用: CI翻译覆盖率检测确保各语言翻译完整度
/// 上次更新: 初始创建
/// 上次更新: 添加 avoid_print 文件级忽略(测试诊断输出)
/// ============================================================
// ignore_for_file: avoid_print
import 'package:flutter_test/flutter_test.dart';
import 'package:xianyan/l10n/translation_coverage.dart';