Fix device sync: folder status badges, remove-deletes-local, multi-select, header summary
Build APK / build (push) Successful in 5m35s
Build APK / build (push) Successful in 5m35s
- Folders now show the synced status badge themselves, not just their nested files - device-sync state never tracked folders individually, so syncStatusFor derives a folder's badge from whether its path falls within sync scope instead. - Turning sync off for a path now deletes its local mirror and clears its native sync-state entries (SyncEngine.removeLocalSync), instead of just stopping future updates and leaving the downloaded copy behind. - "Sync to device" in Files' selection toolbar now works over the whole selection at once instead of being gated to a single selected item. - The sync header's expanded panel shows real folder/item counts instead of a static "Synced" label that stayed accurate-sounding even before anything had actually synced. - Confirmation SnackBars on starting/stopping sync from both the selection toolbar and Settings' Device Sync card. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -21,6 +21,27 @@ import '../providers/sync_status_controller.dart';
|
||||
};
|
||||
}
|
||||
|
||||
/// The expanded sync panel's headline - actual folder/item counts instead
|
||||
/// of just repeating the compact chip's generic "Synced" label, which reads
|
||||
/// as true even when nothing has actually finished syncing yet (e.g. right
|
||||
/// after adding a folder, before the first pass completes).
|
||||
String _syncSummary(SyncStatusController sync) {
|
||||
if (sync.syncConflicts.isNotEmpty) return 'Sync issue';
|
||||
if (sync.isSyncingNow) return 'Syncing…';
|
||||
final items = sync.syncedItemCount;
|
||||
if (sync.syncEverything) {
|
||||
return items > 0 ? '$items item${items == 1 ? '' : 's'} synced' : 'Sync off';
|
||||
}
|
||||
final folders = sync.syncedFolderCount;
|
||||
if (folders == 0) return 'Sync off';
|
||||
final folderWord = folders == 1 ? 'folder' : 'folders';
|
||||
if (items == 0) {
|
||||
return '$folders $folderWord selected — nothing synced yet';
|
||||
}
|
||||
final itemWord = items == 1 ? 'item' : 'items';
|
||||
return '$folders $folderWord & $items $itemWord synced';
|
||||
}
|
||||
|
||||
String formatBytes(int bytes) {
|
||||
if (bytes <= 0) return '0 B';
|
||||
if (bytes < 1024) return '$bytes B';
|
||||
@@ -361,8 +382,7 @@ class _SyncedStretchPanel extends StatelessWidget {
|
||||
// Reaches 1.0 (title fully hidden) at 50px of pull — comfortably
|
||||
// before the 100px lock threshold.
|
||||
final progress = forceVisible ? 1.0 : (stretch / 50).clamp(0.0, 1.0);
|
||||
final status = syncStatus.syncHeaderStatus;
|
||||
final (_, statusLabel) = _syncHeaderDisplay(status);
|
||||
final statusLabel = _syncSummary(syncStatus);
|
||||
final conflicts = syncStatus.syncConflicts;
|
||||
|
||||
return Stack(
|
||||
|
||||
Reference in New Issue
Block a user