Files
noo/lib/providers/folder_browser.dart
ayushyaandClaude Sonnet 5 f2bba2914e
Build APK / build (push) Successful in 5m27s
Offline tab as Files view, automatic background sync, sync notifications
- Offline tab is now FilesView(offline: true) over a FolderBrowser interface
  (FilesController / OfflineController) sharing controls, tiles, thumbnails
- Synced files follow the Files Cache rule (default: refresh every 15 min):
  per-account WorkManager jobs, in-app timer, resume and pull triggers;
  root-etag shortcut skips full walks when nothing changed
- Single sync at a time (shared lock); logging out stops that account's sync
- Sync safety: PROPFIND failures skip the path instead of deleting local files
- Mirror empty folders and remove deleted ones; drop synced paths deleted on
  the server; missing local files are re-downloaded
- Notifications: silent per-account sync notifications, "Background sync
  notifications" setting, audible upload/download completion
- Files refresh in place (no spinner flash); retry after network returns
- Fix sync badges not updating (shared native status stream), "Sync off" on
  launch (eager providers), Files Cache section moved under Device Sync

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-21 18:06:55 -04:00

32 lines
1.2 KiB
Dart

import '../models/nextcloud_item.dart';
/// What `FilesView` needs from whatever is supplying the folder it's
/// showing: the breadcrumb trail, the (already display-pref-filtered and
/// sorted) items, loading/error state, and navigation. Implemented by
/// [FilesController] (the server's folders) and [OfflineController] (the
/// device-sync mirror of those same folders) so the Files tab and the
/// Offline tab are literally the same view over two data sources.
///
/// Deliberately not a `Listenable` - `context.watch` subscribes to the
/// concrete provider registered in `main()`, not to this interface, so the
/// view picks the concrete controller and then treats it as a
/// [FolderBrowser].
abstract interface class FolderBrowser {
List<String> get pathStack;
String get currentFolderPath;
/// Items in [currentFolderPath] with the shared Files display prefs
/// (hidden files, type filter, sort) already applied.
List<NextcloudItem> get items;
bool get isLoading;
String? get errorMessage;
Future<void> navigateToFolder(String path);
Future<void> navigateToPathIndex(int index);
Future<void> navigateUp();
/// Re-reads the current folder (pull-to-refresh / retry).
Future<void> reload();
}