fix: show only local assets from albums selected for backup (#20050)
* show only local assets from albums selected for backup # Conflicts: # mobile/lib/infrastructure/repositories/db.repository.drift.dart * ignore backup selection * fix: backup album ownerId * fix: backup album ownerId * only show local only assets that are selected for backup * add index on visibility and backup selection * fix: video not playing in search view * remove safe area from bottom bar * refactor stack count with a CTE and local asset with a SELECT * fix lint * remove redundant COALESCE * remove stack count from main timeline query --------- Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com> Co-authored-by: Alex <alex.tran1502@gmail.com>
This commit is contained in:
@@ -19,6 +19,7 @@ import 'package:immich_mobile/providers/memory.provider.dart';
|
||||
import 'package:immich_mobile/providers/notification_permission.provider.dart';
|
||||
import 'package:immich_mobile/providers/server_info.provider.dart';
|
||||
import 'package:immich_mobile/providers/tab.provider.dart';
|
||||
import 'package:immich_mobile/providers/user.provider.dart';
|
||||
import 'package:immich_mobile/providers/websocket.provider.dart';
|
||||
import 'package:immich_mobile/services/app_settings.service.dart';
|
||||
import 'package:immich_mobile/services/background.service.dart';
|
||||
@@ -110,7 +111,14 @@ class AppLifeCycleNotifier extends StateNotifier<AppLifeCycleEnum> {
|
||||
.getSetting(AppSettingsEnum.enableBackup);
|
||||
|
||||
if (isEnableBackup) {
|
||||
await _ref.read(driftBackupProvider.notifier).handleBackupResume();
|
||||
final currentUser = _ref.read(currentUserProvider);
|
||||
if (currentUser == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
await _ref
|
||||
.read(driftBackupProvider.notifier)
|
||||
.handleBackupResume(currentUser.id);
|
||||
}
|
||||
});
|
||||
} catch (e, stackTrace) {
|
||||
|
||||
@@ -329,11 +329,11 @@ class ExpBackupNotifier extends StateNotifier<DriftBackupState> {
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> getBackupStatus() async {
|
||||
Future<void> getBackupStatus(String userId) async {
|
||||
final [totalCount, backupCount, remainderCount] = await Future.wait([
|
||||
_backupService.getTotalCount(),
|
||||
_backupService.getBackupCount(),
|
||||
_backupService.getRemainderCount(),
|
||||
_backupService.getBackupCount(userId),
|
||||
_backupService.getRemainderCount(userId),
|
||||
]);
|
||||
|
||||
state = state.copyWith(
|
||||
@@ -343,8 +343,8 @@ class ExpBackupNotifier extends StateNotifier<DriftBackupState> {
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> backup() {
|
||||
return _backupService.backup(_updateEnqueueCount);
|
||||
Future<void> backup(String userId) {
|
||||
return _backupService.backup(userId, _updateEnqueueCount);
|
||||
}
|
||||
|
||||
void _updateEnqueueCount(EnqueueStatus status) {
|
||||
@@ -379,11 +379,11 @@ class ExpBackupNotifier extends StateNotifier<DriftBackupState> {
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> handleBackupResume() async {
|
||||
Future<void> handleBackupResume(String userId) async {
|
||||
final tasks = await FileDownloader().allTasks(group: kBackupGroup);
|
||||
if (tasks.isEmpty) {
|
||||
// Start a new backup queue
|
||||
await backup();
|
||||
await backup(userId);
|
||||
}
|
||||
|
||||
debugPrint("Tasks to resume: ${tasks.length}");
|
||||
|
||||
Reference in New Issue
Block a user