Add in-app copy/move, background downloads, and a Favorites tab
Build APK / build (push) Successful in 5m18s
Build APK / build (push) Successful in 5m18s
- WebDAV MOVE/COPY-backed copy/move for files and folders, with a destination picker (independent nav state so it doesn't disturb the Files tab's browsing position) and a conflict-resolution sheet (overwrite all / keep both / decide per item). - Downloads now use the same foreground-service + notification approach as uploads, surviving app closure. - Favorites is now its own tab (account-wide, via a WebDAV SEARCH query) instead of a Files-tab filter toggle, which couldn't represent favorited items outside the currently browsed folder correctly. - Share sheet restyled to match the app's design language, plus a "share file directly" action via the OS share sheet; details sheet tab icons resized to match the bottom nav. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
import 'dart:convert';
|
||||
import 'package:flutter/services.dart';
|
||||
import '../models/nextcloud_item.dart';
|
||||
import '../providers/server_provider.dart';
|
||||
|
||||
/// Hands a download off to `DownloadService.kt`'s Android foreground
|
||||
/// service - the download counterpart of `UploadService`/
|
||||
/// `ShareUploadService.kt` (see that pair's doc comments for why this
|
||||
/// isn't done in Dart/Dio: only a real Android Service survives the
|
||||
/// Flutter engine/Activity being gone, the same guarantee a real
|
||||
/// file-manager app's download notification gives you). Saves straight
|
||||
/// into the device's public Downloads folder with one cancellable
|
||||
/// progress notification for the whole batch, instead of the old
|
||||
/// download-to-app-cache-then-`file_saver`-prompt flow.
|
||||
class DownloadService {
|
||||
static const _channel = MethodChannel('dev.ayushya.noo/download_service');
|
||||
|
||||
/// Starts downloading [items]. Fire-and-forget from Dart's perspective -
|
||||
/// once this returns, the service owns the rest and reports
|
||||
/// progress/completion/cancellation through its own notification, not
|
||||
/// back to the app.
|
||||
static Future<void> startDownload(
|
||||
ServerProvider provider,
|
||||
List<NextcloudItem> items,
|
||||
) async {
|
||||
final service = provider.service;
|
||||
final authHeader = service?.authHeaders['Authorization'];
|
||||
if (service == null || authHeader == null) {
|
||||
throw Exception('Not logged in.');
|
||||
}
|
||||
|
||||
final filesJson = jsonEncode(
|
||||
items
|
||||
.map(
|
||||
(i) => {
|
||||
'path': i.path,
|
||||
'name': i.name,
|
||||
'mimeType': i.mimeType,
|
||||
'size': i.size,
|
||||
},
|
||||
)
|
||||
.toList(),
|
||||
);
|
||||
|
||||
await _channel.invokeMethod('startDownload', {
|
||||
'files': filesJson,
|
||||
'serverUrl': provider.serverUrl,
|
||||
'username': provider.username,
|
||||
'authHeader': authHeader,
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user