完善通话短信记录及壁纸交互

This commit is contained in:
tongtong committed 2026-11-22 21:54:16 +08:00
1 parent 6ddffbcf69
commit 15f087f713
64 files changed
+295192 -695

No files matched your search

+22 -2
View File
@@ -236,8 +236,10 @@ class DeviceApi {
debugPrint('[DeviceApi] uploadWallpaperSingle sn=$sn success');
final map = data is Map ? data : null;
final rawSize = map?['fileSize'];
final url = map?['url'] as String?;
if (url != null) await _cacheWallpaperConfig(sn, 0, [url]);
return (
url: map?['url'] as String?,
url: url,
fileSize: (rawSize is int) ? rawSize : null,
error: null,
);
@@ -277,6 +279,9 @@ class DeviceApi {
: null;
debugPrint(
'[DeviceApi] uploadWallpaperRotation sn=$sn count=${files.length} success');
if (urls != null && urls.length == files.length) {
await _cacheWallpaperConfig(sn, 1, urls);
}
return (urls: urls, error: null);
} on ApiException catch (e) {
debugPrint(
@@ -296,6 +301,7 @@ class DeviceApi {
data: {'images': urls},
queryParameters: {'sn': sn},
);
await _cacheWallpaperConfig(sn, 1, urls);
debugPrint('[DeviceApi] reorderWallpaper sn=$sn success, order=$urls');
return null;
} on ApiException catch (e) {
@@ -308,10 +314,24 @@ class DeviceApi {
///
/// 对应后台 `GET /api/v1/client/sn/wallpaper?sn=xxx`。
/// 未配置或无数据时返回 null。
static const _wallpaperPath = 'v1/client/sn/wallpaper';
Future<void> _cacheWallpaperConfig(String sn, int mode, List<String> images) =>
DioClient.storeReadCache(
_wallpaperPath,
{'serialno': sn, 'mode': mode, 'images': images},
queryParameters: {'sn': sn},
);
Future<WallpaperConfig?> getCachedWallpaperConfig(String sn) async {
final data = await DioClient.readCachedGet(_wallpaperPath, queryParameters: {'sn': sn});
return data is Map<String, dynamic> ? WallpaperConfig.fromJson(data) : null;
}
Future<WallpaperConfig?> getWallpaperConfig(String sn) async {
try {
final data = await DioClient.get(
'v1/client/sn/wallpaper',
_wallpaperPath,
allowStale: true,
queryParameters: {'sn': sn},
);