Dedupe native transfer/notification code and split ServerProvider into focused controllers
Build APK / build (push) Successful in 5m20s
Build APK / build (push) Successful in 5m20s
Consolidates duplicated GET/PUT/notification-channel logic across DownloadService/ShareUploadService/SyncEngine into shared Kotlin helpers, gives upload/download real batch queueing instead of dropping a second concurrent batch, and dedupes repeated Dart channel-argument boilerplate. Replaces the 2300+ line ServerProvider god object with ten focused ChangeNotifiers (SessionController, SettingsController, FilesController, PhotosController, FavoritesController, TrashController, SharesController, RecentController, SyncStatusController, PickController) plus ItemOperations, a plain coordinator for cross-domain item mutations - fixing the coupling where device-sync status, per-tab data, and global UI prefs all lived in one object. Updates every view/widget call site accordingly and refreshes the architecture/server/standards/styling docs to match. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
import 'dart:convert';
|
||||
import 'package:flutter/services.dart';
|
||||
import '../models/nextcloud_item.dart';
|
||||
import '../providers/server_provider.dart';
|
||||
import '../providers/session_controller.dart';
|
||||
import 'native_channel.dart';
|
||||
|
||||
/// Hands a download off to `DownloadService.kt`'s Android foreground
|
||||
/// service - the download counterpart of `UploadService`/
|
||||
@@ -20,15 +21,10 @@ class DownloadService {
|
||||
/// progress/completion/cancellation through its own notification, not
|
||||
/// back to the app.
|
||||
static Future<void> startDownload(
|
||||
ServerProvider provider,
|
||||
SessionController session,
|
||||
List<NextcloudItem> items,
|
||||
) async {
|
||||
final service = provider.service;
|
||||
final authHeader = service?.authHeaders['Authorization'];
|
||||
if (service == null || authHeader == null) {
|
||||
throw Exception('Not logged in.');
|
||||
}
|
||||
|
||||
final args = baseChannelArgs(session);
|
||||
final filesJson = jsonEncode(
|
||||
items
|
||||
.map(
|
||||
@@ -42,11 +38,6 @@ class DownloadService {
|
||||
.toList(),
|
||||
);
|
||||
|
||||
await _channel.invokeMethod('startDownload', {
|
||||
'files': filesJson,
|
||||
'serverUrl': provider.serverUrl,
|
||||
'username': provider.username,
|
||||
'authHeader': authHeader,
|
||||
});
|
||||
await _channel.invokeMethod('startDownload', {...args, 'files': filesJson});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user