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>
24 lines
855 B
Dart
24 lines
855 B
Dart
import '../providers/session_controller.dart';
|
|
|
|
/// The "get this account's auth header, or bail" guard every native-
|
|
/// MethodChannel service (`UploadService`/`DownloadService`/`SyncService`)
|
|
/// needs before handing a batch off to Kotlin - was independently repeated
|
|
/// in each of them.
|
|
String requireAuthHeader(SessionController session) {
|
|
final authHeader = session.service?.authHeaders['Authorization'];
|
|
if (session.service == null || authHeader == null) {
|
|
throw Exception('Not logged in.');
|
|
}
|
|
return authHeader;
|
|
}
|
|
|
|
/// The `{serverUrl, username, authHeader}` trio every one of those
|
|
/// services' `invokeMethod` argument maps includes.
|
|
Map<String, String> baseChannelArgs(SessionController session) {
|
|
return {
|
|
'serverUrl': session.serverUrl,
|
|
'username': session.username,
|
|
'authHeader': requireAuthHeader(session),
|
|
};
|
|
}
|