π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
fix: UI not refreshing when deleting and hiding items from location screen
ashilknb25d06ac2eed
diff --git a/lib/ui/viewer/location/location_screen.dart b/lib/ui/viewer/location/location_screen.dartindex ecdf902af2..b05db7a952 100644--- a/lib/ui/viewer/location/location_screen.dart+++ b/lib/ui/viewer/location/location_screen.dart@@ -1,3 +1,4 @@+import "dart:async";import 'dart:developer' as dev;import "package:flutter/material.dart";@@ -138,15 +139,17 @@ class LocationGalleryWidget extends StatefulWidget {class _LocationGalleryWidgetState extends State<LocationGalleryWidget> {late final Future<FileLoadResult> fileLoadResult;+ late final List<EnteFile> allFilesWithLocation;late Widget galleryHeaderWidget;final _selectedFiles = SelectedFiles();+ late final StreamSubscription<LocalPhotosUpdatedEvent> _filesUpdateEvent;@overridevoid initState() {final collectionsToHide =CollectionsService.instance.archivedOrHiddenCollectionIds();- fileLoadResult =- FilesDB.instance.fetchAllUploadedAndSharedFilesWithLocation(+ fileLoadResult = FilesDB.instance+ .fetchAllUploadedAndSharedFilesWithLocation(galleryLoadStartTime,galleryLoadEndTime,limit: null,@@ -155,14 +158,35 @@ class _LocationGalleryWidgetState extends State<LocationGalleryWidget> {ignoredCollectionIDs: collectionsToHide,hideIgnoredForUpload: true,),- );+ )+ .then((value) {+ allFilesWithLocation = value.files;+ _filesUpdateEvent =+ Bus.instance.on<LocalPhotosUpdatedEvent>().listen((event) {+ if (event.type == EventType.deletedFromDevice ||+ event.type == EventType.deletedFromEverywhere ||+ event.type == EventType.deletedFromRemote ||+ event.type == EventType.hide) {+ for (var updatedFile in event.updatedFiles) {+ allFilesWithLocation.remove(updatedFile);+ }+ if (mounted) {+ setState(() {});+ }+ }+ });+ return value;+ });+galleryHeaderWidget = const GalleryHeaderWidget();+super.initState();}@overridevoid dispose() {InheritedLocationScreenState.memoryCountNotifier.value = null;+ _filesUpdateEvent.cancel();super.dispose();}@@ -178,8 +202,8 @@ class _LocationGalleryWidgetState extends State<LocationGalleryWidget> {final FileLoadResult result = await fileLoadResult;//wait for ignored files to be removed after initfinal stopWatch = Stopwatch()..start();- final copyOfFiles = List<EnteFile>.from(result.files);- copyOfFiles.removeWhere((f) {+ final filesInLocation = allFilesWithLocation;+ filesInLocation.removeWhere((f) {return !LocationService.instance.isFileInsideLocationTag(centerPoint,f.location!,@@ -191,11 +215,11 @@ class _LocationGalleryWidgetState extends State<LocationGalleryWidget> {);stopWatch.stop();InheritedLocationScreenState.memoryCountNotifier.value =- copyOfFiles.length;+ filesInLocation.length;return Future.value(FileLoadResult(- copyOfFiles,+ filesInLocation,result.hasMore,),);