fix(devices): 本机也显示 ⋯ 菜单(只「重命名」)—— 修单设备无法改名(1.0.14)
ci-pangolin / Lint — shellcheck (push) Successful in 8s
ci-pangolin / OpenAPI Sync Check (push) Successful in 16s
ci-pangolin / Redline Scan — 脱敏 (UI 文案) (push) Successful in 6s
ci-pangolin / Flutter — analyze + test (push) Failing after 14s
ci-pangolin / Portable SQL — 可移植性 (mysql/sqlite) (push) Successful in 4s
ci-pangolin / Codegen Drift — token 生成物未漂移 (push) Successful in 5s
ci-pangolin / Go — build + test (push) Successful in 9s
ci-pangolin / E2E Smoke — L4 进程级端到端 (push) Successful in 15s
ci-pangolin / Go — integration (mysql/redis testcontainers) (push) Failing after 4m10s
ci-pangolin / Golden — 视觉回归 (components + auth) (push) Successful in 14s
ci-pangolin / Lint — shellcheck (push) Successful in 8s
ci-pangolin / OpenAPI Sync Check (push) Successful in 16s
ci-pangolin / Redline Scan — 脱敏 (UI 文案) (push) Successful in 6s
ci-pangolin / Flutter — analyze + test (push) Failing after 14s
ci-pangolin / Portable SQL — 可移植性 (mysql/sqlite) (push) Successful in 4s
ci-pangolin / Codegen Drift — token 生成物未漂移 (push) Successful in 5s
ci-pangolin / Go — build + test (push) Successful in 9s
ci-pangolin / E2E Smoke — L4 进程级端到端 (push) Successful in 15s
ci-pangolin / Go — integration (mysql/redis testcontainers) (push) Failing after 4m10s
ci-pangolin / Golden — 视觉回归 (components + auth) (push) Successful in 14s
之前 ⋯ 菜单对本机隐藏,而用户唯一设备就是本机 → 根本点不到、改不了名。 改:本机显示 ⋯ 菜单但只含「重命名」(自我强制退出/清除无意义,仍只对他设备)。 测试:本机菜单只有重命名断言;全量 flutter 绿。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -188,7 +188,7 @@ class DevicesScreen extends ConsumerWidget {
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
_statusDot(c, d.online),
|
||||
if (!isLocal) _menu(context, ref, c, d) else const SizedBox(width: 8),
|
||||
_menu(context, ref, c, d, isLocal),
|
||||
]),
|
||||
);
|
||||
}
|
||||
@@ -214,7 +214,8 @@ class DevicesScreen extends ConsumerWidget {
|
||||
]);
|
||||
}
|
||||
|
||||
Widget _menu(BuildContext context, WidgetRef ref, PangolinScheme c, Device d) => PopupMenuButton<String>(
|
||||
// 本机:只给「重命名」(自我踢下线/清除没意义);其他设备:重命名+强制退出+清除。
|
||||
Widget _menu(BuildContext context, WidgetRef ref, PangolinScheme c, Device d, bool isLocal) => PopupMenuButton<String>(
|
||||
icon: Icon(PangolinIcons.moreVertical, size: 18, color: c.fg3),
|
||||
color: c.surface,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(PangolinRadius.md), side: BorderSide(color: c.border)),
|
||||
@@ -223,14 +224,16 @@ class DevicesScreen extends ConsumerWidget {
|
||||
Icon(PangolinIcons.edit, size: 16, color: c.fg2), const SizedBox(width: 10),
|
||||
Text(t.devRename, style: PangolinText.sm.copyWith(color: c.fg1)),
|
||||
])),
|
||||
PopupMenuItem(value: 'logout', child: Row(children: [
|
||||
Icon(PangolinIcons.logOut, size: 16, color: c.fg2), const SizedBox(width: 10),
|
||||
Text(t.devForceLogout, style: PangolinText.sm.copyWith(color: c.fg1)),
|
||||
])),
|
||||
PopupMenuItem(value: 'clear', child: Row(children: [
|
||||
Icon(PangolinIcons.trash, size: 16, color: c.danger), const SizedBox(width: 10),
|
||||
Text(t.devClearLogin, style: PangolinText.sm.copyWith(color: c.danger)),
|
||||
])),
|
||||
if (!isLocal) ...[
|
||||
PopupMenuItem(value: 'logout', child: Row(children: [
|
||||
Icon(PangolinIcons.logOut, size: 16, color: c.fg2), const SizedBox(width: 10),
|
||||
Text(t.devForceLogout, style: PangolinText.sm.copyWith(color: c.fg1)),
|
||||
])),
|
||||
PopupMenuItem(value: 'clear', child: Row(children: [
|
||||
Icon(PangolinIcons.trash, size: 16, color: c.danger), const SizedBox(width: 10),
|
||||
Text(t.devClearLogin, style: PangolinText.sm.copyWith(color: c.danger)),
|
||||
])),
|
||||
],
|
||||
],
|
||||
onSelected: (v) async {
|
||||
if (v == 'rename') {
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
name: pangolin_vpn
|
||||
description: 穿山甲 · Pangolin — 极简、稳定、跨平台网络加速客户端。
|
||||
publish_to: "none"
|
||||
version: 1.0.13+14
|
||||
version: 1.0.14+15
|
||||
|
||||
environment:
|
||||
sdk: ^3.5.0
|
||||
|
||||
@@ -92,12 +92,21 @@ void main() {
|
||||
expect(find.text('iPhone 15'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('本机 ⋯ 菜单只有「重命名」,无强制退出/清除', (tester) async {
|
||||
await pump(tester);
|
||||
// 第一个菜单 = 本机(MacBook Pro)。
|
||||
await tester.tap(find.byType(PopupMenuButton<String>).first);
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text(t.devRename), findsOneWidget);
|
||||
expect(find.text(t.devForceLogout), findsNothing);
|
||||
expect(find.text(t.devClearLogin), findsNothing);
|
||||
});
|
||||
|
||||
testWidgets('非本机行 ⋯ 菜单 → 强制退出 → 确认 → 调 logout 接口', (tester) async {
|
||||
await pump(tester);
|
||||
// 仅非本机(iPhone)有 ⋯ 菜单。
|
||||
final menu = find.byType(PopupMenuButton<String>);
|
||||
expect(menu, findsOneWidget);
|
||||
await tester.tap(menu);
|
||||
// 本机+手机各一个菜单;手机(最后一个)才有强制退出/清除。
|
||||
expect(find.byType(PopupMenuButton<String>), findsNWidgets(2));
|
||||
await tester.tap(find.byType(PopupMenuButton<String>).last);
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text(t.devForceLogout), findsOneWidget);
|
||||
expect(find.text(t.devClearLogin), findsOneWidget);
|
||||
@@ -115,7 +124,7 @@ void main() {
|
||||
|
||||
testWidgets('清除登录信息 → 确认 → 调 DELETE 接口', (tester) async {
|
||||
await pump(tester);
|
||||
await tester.tap(find.byType(PopupMenuButton<String>));
|
||||
await tester.tap(find.byType(PopupMenuButton<String>).last);
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(find.text(t.devClearLogin));
|
||||
await tester.pumpAndSettle();
|
||||
@@ -127,7 +136,7 @@ void main() {
|
||||
|
||||
testWidgets('重命名 → 输入新名 → 保存 → 调 rename 接口', (tester) async {
|
||||
await pump(tester);
|
||||
await tester.tap(find.byType(PopupMenuButton<String>));
|
||||
await tester.tap(find.byType(PopupMenuButton<String>).last);
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(find.text(t.devRename));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
; 前置: 先在 client/ 跑 `flutter build windows`(Release),产物在
|
||||
; ..\..\build\windows\x64\runner\Release
|
||||
#define MyAppName "穿山甲 Pangolin"
|
||||
#define MyAppVersion "1.0.13"
|
||||
#define MyAppVersion "1.0.14"
|
||||
#define MyAppPublisher "Pangolin"
|
||||
#define MyAppExeName "pangolin_vpn.exe"
|
||||
#define BuildDir "..\..\build\windows\x64\runner\Release"
|
||||
|
||||
Reference in New Issue
Block a user