Output actual App Store name of an installed app - #1292
Conversation
`InstalledApp` derived `name` solely from the Spotlight attribute `_kMDItemDisplayNameWithExtensions`, which records an app bundle's on-disk name rather than its App Store name. Neither Spotlight nor `Info.plist` records the App Store name, so the output name was only an approximation; e.g., "WFMU Radio" (324175340) was output as "WFMU". Resolve each installed app's name via the iTunes Search API instead, reusing the existing `Environment.lookupAppFromAppID` abstraction that `mas lookup` & `mas outdated` already use. Lookups run concurrently. Apps that the App Store does not know about, such as TestFlight apps, & apps whose lookup fails, such as when offline, keep their approximated names. `InstalledApp.init(for:)` must stay synchronous, so the resolved name is applied afterwards, in `installedApps(matching:withFullJSON:)`, before apps are sorted by name. `concurrentMap(maxConcurrentTaskCount:_:)` is no longer unused, so its `unused_declaration` & `periphery:ignore` suppressions are removed. Fixes mas-cli#784
|
|
Thanks for submitting this. SummaryThis functionality won't be able to be added until #1226 is released (I am currently working on it), presumably in 7.2.0 (see why in Details below). 7.1.0 will be released after a few more days ensuring that the App Store remains in sync with local data. If you want to submit PRs for other issues, I can:
DetailsI'm not sure if it's better to provide installed app names from iTunes Search or to use local app names. e.g., I personally prefer to see Also, if you have multiple installations of the same app, local names distinguish between them. It might be best to output the local names by default, but offer the option to fetch the iTunes Search names, too. Both could be included in the JSON output (I have ideas for—but haven't finalized—their respective keys). iTunes Search app names should not be used until after some issues I'm currently working on have been resolved. #1226 is required for this PR to be merged. The other listed issues would be useful, and might also block this PR (TBD). My relevant roadmap (small improvements & bug fixes might also be resolved, too, but the large issues are listed below):
Ignore project milestones: they're outdated & include tons of issues that will almost definitely not be released in the respective versions (they're lists of issues to think about thinking about). #1226 allows selecting whichever name you prefer in the command line. #1275 fetches additional data for apps more frequently, so I must cache fetched catalog apps per installed app to reuse the same results to provide multiple values. #838 allows persistent settings, so you'll be able to persistently choose local names or iTunes Search names, etc. |



Summary
Fixes #784.
InstalledAppderivednamesolely from the Spotlight attribute_kMDItemDisplayNameWithExtensions, which records an app bundle's on-disk name rather than its App Store name. Neither Spotlight norInfo.plistrecords the App Store name, so the output name was only an approximation — e.g. "WFMU Radio" (adamID 324175340) was output as just "WFMU".Fix
Resolves each installed app's name via the iTunes Search API instead, reusing the existing
Environment.lookupAppFromAppIDabstraction thatmas lookupandmas outdatedalready use, rather than adding a new HTTP call. Lookups run concurrently via the existingconcurrentMap.InstalledApp.init(for:)has to stay synchronous, so the resolved name is applied afterward, ininstalledApps(matching:withFullJSON:), before apps are sorted by name.concurrentMap'sunused_declaration/periphery:ignoresuppressions are removed since it's no longer unused.Test plan
Added
Tests/MASTests/Models/MASTests+InstalledApp.swiftwith 3 cases, following the existing test suite's conventions (fixture-basedEnvironment.$current.withValueinjection):swift buildsucceeds cleanly. I could not runswift testin my environment — it fails witherror: no such module 'Testing'(the Swift Testing framework), but I confirmed this is a pre-existing environment limitation and not something this change introduced: the same error occurs on a clean checkout ofmainwith no changes at all. I don't have a full Xcode install available, only Command Line Tools, which appears to be the gap. Happy to have CI confirm the test suite, or take pointers on getting Testing available locally.