Monitor ADB device presence and withdraw stale registrations in 0.2.6

This commit is contained in:
tongtong committed 2026-11-13 21:55:45 +08:00
1 parent 03e729a60b
commit dc29a20a41
17 files changed
+488 -23

No files matched your search

+4 -2
View File
@@ -26,8 +26,10 @@ abstract class ManagedPhone with _$ManagedPhone {
: connected
? lastError == null
? "已注册"
: "转发异常"
: "等待注册"} · ${target ?? adbSerial ?? ""}';
: "转发异常:$lastError"
: lastError == null
? "等待注册"
: "未就绪:$lastError"} · ${target ?? adbSerial ?? ""}';
}
@freezed
+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.2.5+6
version: 0.2.6+7
environment:
sdk: ^3.14.0
@@ -0,0 +1,25 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:ads_manager/data/agent_models.dart';
void main() {
test('unregistered phone shows its ADB absence reason', () {
const phone = ManagedPhone(
id: 'phone',
adbSerial: 'USB-A',
enabled: true,
connected: false,
lastError: 'ADB 未发现该设备',
);
expect(phone.description, contains('ADB 未发现'));
expect(phone.description, isNot(contains('已注册')));
});
test('disabled phone remains explicitly disabled', () {
const phone = ManagedPhone(
id: 'phone',
enabled: false,
connected: false,
lastError: 'offline',
);
expect(phone.description, contains('已停用'));
});
}