ba53a0d478
- api_config.dart:API 基址单源(消除各处重复 _kApiUrl) - api_client.dart:统一鉴权 HTTP 客户端,401→AuthNotifier.refresh→重试一次, 错误统一 AuthApiException;+ 单测覆盖 401 刷新重试 - 模型 me/device/plan/usage_point(对齐后端 snake_case 契约) - account_api.dart:/v1/me、/v1/plans、/v1/me/devices(列表+删)、/v1/usage、 /v1/redeem、/v1/ads/unlock 封装 - auth_provider:注入 AuthApi + refresh();account_providers 装配 ApiClient/AccountApi - 顺带修复 onboarding 提交遗留的测试 stub(_NullTokenStore 缺 isOnboarded/markOnboarded) flutter analyze 0 error;114 tests passed。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
29 lines
719 B
Dart
29 lines
719 B
Dart
// device.dart — 已登录设备(GET /v1/me/devices)。
|
|
class Device {
|
|
const Device({
|
|
required this.uuid,
|
|
required this.name,
|
|
required this.platform,
|
|
this.lastSeen,
|
|
});
|
|
|
|
final String uuid;
|
|
final String name;
|
|
|
|
/// 'ios' | 'android' | 'windows' | 'macos'。
|
|
final String platform;
|
|
|
|
/// 最近活跃(UTC);从未上线为 null。
|
|
final DateTime? lastSeen;
|
|
|
|
factory Device.fromJson(Map<String, dynamic> m) {
|
|
final ls = m['last_seen'] as String?;
|
|
return Device(
|
|
uuid: m['uuid'] as String? ?? '',
|
|
name: m['name'] as String? ?? '',
|
|
platform: m['platform'] as String? ?? '',
|
|
lastSeen: (ls != null && ls.isNotEmpty) ? DateTime.tryParse(ls) : null,
|
|
);
|
|
}
|
|
}
|