diff --git a/CHANGELOG.md b/CHANGELOG.md index 1ff77ef2f..ceee2654c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ All notable changes to this project will be documented in this file. - opening app from launcher always show home page - use dates with western arabic numerals for maghreb arabic locales +- album unique names are case insensitive - upgraded Flutter to stable v3.19.5 ### Fixed diff --git a/lib/model/source/album.dart b/lib/model/source/album.dart index 2e6057334..cf9bbc565 100644 --- a/lib/model/source/album.dart +++ b/lib/model/source/album.dart @@ -196,19 +196,19 @@ mixin AlbumMixin on SourceBase { final parts = pContext.split(dirPath); for (var i = parts.length - 1; i > 0; i--) { final name = pContext.joinAll(['', ...parts.skip(i)]); - final testName = '$separator$name'; + final testName = '$separator${name.toLowerCase()}'; if (others.every((item) => !item.endsWith(testName))) return name; } return dirPath; } - final otherAlbumsOnDevice = _directories.whereNotNull().where((item) => item != dirPath).toSet(); + final otherAlbumsOnDevice = _directories.whereNotNull().where((item) => item != dirPath).map((v) => v.toLowerCase()).toSet(); final uniqueNameInDevice = unique(dirPath, otherAlbumsOnDevice); if (uniqueNameInDevice.length <= relativeDir.length) { return uniqueNameInDevice; } - final volumePath = dir.volumePath; + final volumePath = dir.volumePath.toLowerCase(); String trimVolumePath(String? path) => path!.substring(dir.volumePath.length); final otherAlbumsOnVolume = otherAlbumsOnDevice.where((path) => path.startsWith(volumePath)).map(trimVolumePath).toSet(); final uniqueNameInVolume = unique(trimVolumePath(dirPath), otherAlbumsOnVolume); diff --git a/lib/services/analysis_service.dart b/lib/services/analysis_service.dart index 1b302917e..6efd63410 100644 --- a/lib/services/analysis_service.dart +++ b/lib/services/analysis_service.dart @@ -76,7 +76,7 @@ Future _init() async { enum AnalyzerState { running, stopping, stopped } -class Analyzer { +class Analyzer with WidgetsBindingObserver { late AppLocalizations _l10n; final ValueNotifier _serviceStateNotifier = ValueNotifier(AnalyzerState.stopped); AnalysisController? _controller; @@ -102,6 +102,7 @@ class Analyzer { } _serviceStateNotifier.addListener(_onServiceStateChanged); _source.stateNotifier.addListener(_onSourceStateChanged); + WidgetsBinding.instance.addObserver(this); } void dispose() { @@ -111,11 +112,18 @@ class Analyzer { } _stopUpdateTimer(); _controller?.dispose(); + WidgetsBinding.instance.removeObserver(this); _serviceStateNotifier.removeListener(_onServiceStateChanged); _source.stateNotifier.removeListener(_onSourceStateChanged); _source.dispose(); } + @override + void didHaveMemoryPressure() { + super.didHaveMemoryPressure(); + reportService.log('Analyzer memory pressure'); + } + Future start(dynamic args) async { List? entryIds; var force = false; @@ -126,7 +134,7 @@ class Analyzer { progressTotal = args['progressTotal']; progressOffset = args['progressOffset']; } - debugPrint('$runtimeType start for ${entryIds?.length ?? 'all'} entries, at $progressOffset/$progressTotal'); + await reportService.log('Analyzer start for ${entryIds?.length ?? 'all'} entries, at $progressOffset/$progressTotal'); _controller?.dispose(); _controller = AnalysisController( canStartService: false, @@ -147,8 +155,8 @@ class Analyzer { }); } - void stop() { - debugPrint('$runtimeType stop'); + Future stop() async { + await reportService.log('Analyzer stop'); _serviceStateNotifier.value = AnalyzerState.stopped; } diff --git a/lib/widgets/aves_app.dart b/lib/widgets/aves_app.dart index bfe0bcc6a..fce1cb80d 100644 --- a/lib/widgets/aves_app.dart +++ b/lib/widgets/aves_app.dart @@ -404,6 +404,12 @@ class _AvesAppState extends State with WidgetsBindingObserver { } } + @override + void didHaveMemoryPressure() { + super.didHaveMemoryPressure(); + reportService.log('App memory pressure'); + } + @override void didChangeMetrics() => _updateCutoutInsets(); diff --git a/test/model/collection_source_test.dart b/test/model/collection_source_test.dart index f21fcc516..994f42d3b 100644 --- a/test/model/collection_source_test.dart +++ b/test/model/collection_source_test.dart @@ -366,6 +366,8 @@ void main() { FakeMediaStoreService.newImage('${FakeStorageService.removablePath}Marcus Aurelius', '1'), FakeMediaStoreService.newImage('${FakeStorageService.primaryPath}Pictures/Hannah Arendt', '1'), FakeMediaStoreService.newImage('${FakeStorageService.primaryPath}Pictures/Arendt', '1'), + FakeMediaStoreService.newImage('${FakeStorageService.primaryPath}Pictures/Something', '1'), + FakeMediaStoreService.newImage('${FakeStorageService.primaryPath}Movies/SomeThing', '1'), }; final source = await _initSource(); @@ -387,6 +389,8 @@ void main() { expect(source.getAlbumDisplayName(context, '${FakeStorageService.removablePath}Marcus Aurelius'), 'Marcus Aurelius'); expect(source.getAlbumDisplayName(context, '${FakeStorageService.primaryPath}Pictures/Hannah Arendt'), 'Hannah Arendt'); expect(source.getAlbumDisplayName(context, '${FakeStorageService.primaryPath}Pictures/Arendt'), 'Arendt'); + expect(source.getAlbumDisplayName(context, '${FakeStorageService.primaryPath}Pictures/Something'), 'Pictures/Something'); + expect(source.getAlbumDisplayName(context, '${FakeStorageService.primaryPath}Movies/SomeThing'), 'Movies/SomeThing'); return const Placeholder(); }, ),