Desktop: folders keep claiming their store records before the config read returns; a store app with a folder's id is never listed twice

This commit is contained in:
CRTkafa 2026-10-23 09:18:03 +08:00
parent 5e82010ace
commit 7c769c18f4
3 changed files with 38 additions and 2 deletions

View file

@ -134,6 +134,20 @@ export function buildApps<P extends IdProject>(i: BuildInput<P>): UnifiedApp<P>[
});
}
// guard: a store app with the same App Store id / bundle id / package name as a folder is that folder's record, never a
// second entry (the folder could not take it above, e.g. it is linked elsewhere); it is dropped, not shown separately
const folderIds = new Set<string>();
for (const p of i.projects) {
const s = i.summaryOf(p);
if (s?.apple?.appId) folderIds.add(`ios:id:${s.apple.appId}`);
if (s?.apple?.bundleId) folderIds.add(`ios:bundle:${s.apple.bundleId}`);
if (s?.play?.packageName) folderIds.add(`android:${s.play.packageName}`);
}
for (const r of refs) {
if (used.has(r.key)) continue;
if (r.store === 'ios' ? folderIds.has(`ios:id:${r.app.id}`) || folderIds.has(`ios:bundle:${r.app.bundleId}`) : folderIds.has(`android:${r.app.id}`)) used.add(r.key);
}
// 2. pairs among the remaining store apps
const freeIos = () => refs.filter(r => r.store === 'ios' && !used.has(r.key));
const freeAndroid = () => refs.filter(r => r.store === 'android' && !used.has(r.key));