albums: looser app folder matching

This commit is contained in:
Thibault Deckers 2024-08-29 19:19:05 +02:00
parent 98c39c2e7b
commit 2c41e82444
2 changed files with 8 additions and 4 deletions

View file

@ -29,10 +29,10 @@ class AppInventory {
areAppNamesReadyNotifier.value = false; areAppNamesReadyNotifier.value = false;
} }
bool isPotentialAppDir(String dir) => _potentialAppDirs.contains(dir); bool isPotentialAppDir(String dir) => _potentialAppDirs.contains(Package.normalizePotentialDir(dir));
String? getAlbumAppPackageName(String albumPath) { String? getAlbumAppPackageName(String albumPath) {
final dir = pContext.split(albumPath).last; final dir = Package.normalizePotentialDir(pContext.split(albumPath).last);
final package = _launcherPackages.firstWhereOrNull((v) => v.potentialDirs.contains(dir)); final package = _launcherPackages.firstWhereOrNull((v) => v.potentialDirs.contains(dir));
return package?.packageName; return package?.packageName;
} }
@ -71,7 +71,11 @@ class Package {
currentLabel, currentLabel,
englishLabel, englishLabel,
...ownedDirs, ...ownedDirs,
].whereNotNull().toSet(); ].whereNotNull().map(normalizePotentialDir).toSet();
static String normalizePotentialDir(String dir) {
return dir.replaceAll('_', ' ').trim().toLowerCase();
}
@override @override
String toString() => '$runtimeType#${shortHash(this)}{packageName=$packageName, categoryLauncher=$categoryLauncher, isSystem=$isSystem, currentLabel=$currentLabel, englishLabel=$englishLabel, ownedDirs=$ownedDirs}'; String toString() => '$runtimeType#${shortHash(this)}{packageName=$packageName, categoryLauncher=$categoryLauncher, isSystem=$isSystem, currentLabel=$currentLabel, englishLabel=$englishLabel, ownedDirs=$ownedDirs}';

View file

@ -43,7 +43,7 @@ class PlatformAppService implements AppService {
'com.sony.playmemories.mobile': {'Imaging Edge Mobile'}, 'com.sony.playmemories.mobile': {'Imaging Edge Mobile'},
'nekox.messenger': {'NekoX'}, 'nekox.messenger': {'NekoX'},
'org.telegram.messenger': {'Telegram Images', 'Telegram Video'}, 'org.telegram.messenger': {'Telegram Images', 'Telegram Video'},
'com.whatsapp': {'Whatsapp', 'WhatsApp Animated Gifs', 'WhatsApp Documents', 'WhatsApp Images', 'WhatsApp Video'} 'com.whatsapp': {'WhatsApp Animated Gifs', 'WhatsApp Documents', 'WhatsApp Images', 'WhatsApp Video'}
}; };
@override @override