π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Fix storage viewer not refreshing after clearing cache
Neeraja12afb78be61
diff --git a/mobile/apps/photos/lib/ui/tools/debug/app_storage_viewer.dart b/mobile/apps/photos/lib/ui/tools/debug/app_storage_viewer.dartindex 400dbc4b1a..2adac3f413 100644--- a/mobile/apps/photos/lib/ui/tools/debug/app_storage_viewer.dart+++ b/mobile/apps/photos/lib/ui/tools/debug/app_storage_viewer.dart@@ -187,9 +187,7 @@ class _AppStorageViewerState extends State<AppStorageViewer> {},itemCount: paths.length,),- const SizedBox(- height: 24,- ),+ const SizedBox(height: 24),MenuItemWidget(leadingIcon: Icons.delete_sweep_outlined,captionedTextWidget: CaptionedTextWidget(@@ -202,9 +200,7 @@ class _AppStorageViewerState extends State<AppStorageViewer> {onTap: () async {for (var pathItem in paths) {if (pathItem.allowCacheClear) {- await deleteDirectoryContents(- pathItem.path,- );+ await deleteDirectoryContents(pathItem.path);}}if (!Platform.isAndroid) {@@ -212,15 +208,17 @@ class _AppStorageViewerState extends State<AppStorageViewer> {iosTempDirectoryPath,);}+ // Small delay to allow file system to sync+ await Future.delayed(+ const Duration(milliseconds: 300),+ );_refreshCounterKey++;if (mounted) {setState(() => {});}},),- const SizedBox(- height: 24,- ),+ const SizedBox(height: 24),],),],diff --git a/mobile/apps/photos/lib/ui/tools/debug/path_storage_viewer.dart b/mobile/apps/photos/lib/ui/tools/debug/path_storage_viewer.dartindex 699ba673c6..e96184c6ab 100644--- a/mobile/apps/photos/lib/ui/tools/debug/path_storage_viewer.dart+++ b/mobile/apps/photos/lib/ui/tools/debug/path_storage_viewer.dart@@ -17,11 +17,7 @@ class PathStorageItem {final String title;final bool allowCacheClear;- PathStorageItem.name(- this.path,- this.title, {- this.allowCacheClear = false,- });+ PathStorageItem.name(this.path, this.title, {this.allowCacheClear = false});}class PathStorageViewer extends StatefulWidget {@@ -44,22 +40,36 @@ class PathStorageViewer extends StatefulWidget {class _PathStorageViewerState extends State<PathStorageViewer> {final Logger _logger = Logger((_PathStorageViewerState).toString());+ late Future<DirectoryStat> _statFuture;@overridevoid initState() {super.initState();+ _statFuture = getDirectoryStat(Directory(widget.item.path));+ }++ @override+ void didUpdateWidget(PathStorageViewer oldWidget) {+ super.didUpdateWidget(oldWidget);+ // Refresh the future when the widget updates (key changes)+ if (oldWidget.item.path != widget.item.path ||+ oldWidget.key != widget.key) {+ _statFuture = getDirectoryStat(Directory(widget.item.path));+ }}void _safeRefresh() async {if (mounted) {- setState(() => {});+ setState(() {+ _statFuture = getDirectoryStat(Directory(widget.item.path));+ });}}@overrideWidget build(BuildContext context) {return FutureBuilder<DirectoryStat>(- future: getDirectoryStat(Directory(widget.item.path)),+ future: _statFuture,builder: (context, snapshot) {if (snapshot.hasData) {return _buildMenuItemWidget(snapshot.data, null);@@ -90,9 +100,9 @@ class _PathStorageViewerState extends State<PathStorageViewer> {padding: const EdgeInsets.only(left: 12.0),child: Text(formatBytes(stat.size),- style: getEnteTextTheme(context)- .small- .copyWith(color: getEnteColorScheme(context).textFaint),+ style: getEnteTextTheme(+ context,+ ).small.copyWith(color: getEnteColorScheme(context).textFaint),),): SizedBox.fromSize(diff --git a/mobile/apps/photos/lib/utils/standalone/directory_content.dart b/mobile/apps/photos/lib/utils/standalone/directory_content.dartindex 74ad9c8943..d41b798738 100644--- a/mobile/apps/photos/lib/utils/standalone/directory_content.dart+++ b/mobile/apps/photos/lib/utils/standalone/directory_content.dart@@ -101,8 +101,9 @@ Future<DirectoryStat> getDirectoryStat(size += fileSize;fileNameToSize[entity.uri.pathSegments.last] = fileSize;} else if (entity is Directory) {- final DirectoryStat subDirStat =- await getDirectoryStat(Directory(entity.path));+ final DirectoryStat subDirStat = await getDirectoryStat(+ Directory(entity.path),+ );subDirectories.add(subDirStat);size += subDirStat.size;}@@ -121,7 +122,11 @@ Future<void> deleteDirectoryContents(String directoryPath) async {// Iterate through the list and delete each file or directoryfor (final fileOrDirectory in contents) {- await fileOrDirectory.delete();+ if (fileOrDirectory is Directory) {+ await fileOrDirectory.delete(recursive: true);+ } else {+ await fileOrDirectory.delete();+ }}}diff --git a/mobile/apps/photos/scripts/internal_changes.txt b/mobile/apps/photos/scripts/internal_changes.txtindex 9303ebfd49..4a0c2d4164 100644--- a/mobile/apps/photos/scripts/internal_changes.txt+++ b/mobile/apps/photos/scripts/internal_changes.txt@@ -1,3 +1,4 @@+- Neeraj: Fix storage viewer not refreshing after clearing cache- Neeraj: Remove feature flags from manage_links_widget (album layout, allow joining album, copy embed HTML)- Ashil: Use better copy on auto-add people selection page- Ashil: Add more logs to debug app stuck at splash screen issue