From 638581720a878146796a799ca0c75ccc1b8f2e25 Mon Sep 17 00:00:00 2001 From: Pratik Canopas <109139581+cp-pratik-k@users.noreply.github.com> Date: Mon, 9 Dec 2024 16:11:22 +0530 Subject: [PATCH] Improve auto backup flow (#60) * Improve auto-backup-flow * Did improvement --- .../ui/flow/home/home_screen_view_model.dart | 2 +- .../repositories/media_process_repository.dart | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/app/lib/ui/flow/home/home_screen_view_model.dart b/app/lib/ui/flow/home/home_screen_view_model.dart index e35e614..25aced4 100644 --- a/app/lib/ui/flow/home/home_screen_view_model.dart +++ b/app/lib/ui/flow/home/home_screen_view_model.dart @@ -576,7 +576,7 @@ class HomeViewStateNotifier extends StateNotifier if (media.dropboxMediaRefId != null && ids.contains(media.dropboxMediaRefId) && media.isCommonStored) { - return media.removeLocalRef(); + return media.removeDropboxRef(); } else if (media.dropboxMediaRefId != null && ids.contains(media.dropboxMediaRefId) && media.isDropboxStored) { diff --git a/data/lib/repositories/media_process_repository.dart b/data/lib/repositories/media_process_repository.dart index bc3c69c..b2e00a9 100644 --- a/data/lib/repositories/media_process_repository.dart +++ b/data/lib/repositories/media_process_repository.dart @@ -188,11 +188,13 @@ class MediaProcessRepo extends ChangeNotifier { for (AppMedia localMedia in localMedias.toList()) { if (_uploadQueue - .where((element) => element.media_id == localMedia.id) + .where( + (element) => + element.media_id == localMedia.id && + element.status.isRunning, + ) .isNotEmpty || - dgMedias - .where((gdMedia) => gdMedia.path == localMedia.id) - .isNotEmpty) { + dgMedias.where((gdMedia) => gdMedia.id == localMedia.id).isNotEmpty) { localMedias.removeWhere((media) => media.id == localMedia.id); } } @@ -227,10 +229,14 @@ class MediaProcessRepo extends ChangeNotifier { for (AppMedia localMedia in localMedias.toList()) { if (_uploadQueue - .where((element) => element.media_id == localMedia.id) + .where( + (element) => + element.media_id == localMedia.id && + element.status.isRunning, + ) .isNotEmpty || dropboxMedias - .where((gdMedia) => gdMedia.path == localMedia.id) + .where((gdMedia) => gdMedia.id == localMedia.id) .isNotEmpty) { localMedias.removeWhere((media) => media.id == localMedia.id); }