Skip to content

Install: reinstall from the library or a saved IPA, and tell whether the game is still on the phone - #155

Merged
LNPANDY merged 2 commits into
task-145-resign-expiryfrom
install-reinstall-on-phone
Oct 28, 2026
Merged

LNPANDY merged 2 commits into
task-145-resign-expiryfrom
install-reinstall-on-phone

Conversation

@LNPANDY

@LNPANDY LNPANDY commented Oct 28, 2026

Copy link
Copy Markdown
Owner

Follow-up to #149/#151 (stacked on #151; retarget to main once the stack merges). Three gaps the owner hit:

  1. Reinstall only lived on the build-complete card. Most reinstalls happen long after the build, when the build folder or derived data may be gone. Manage → Reinstall is now offered for every game recorded on a device — with the cached app, else the saved IPA, else a file picker.
  2. Reinstall only knew the cached .app. It now falls back to the IPA saved with Save IPA… (recorded per game, so no picker next time), and with neither it opens Choose the IPA to install…. An IPA is unpacked to a temporary folder (Payload/*.app), installed with devicectl, and the folder removed. The bundle identifier is read while the unpacked app still exists and recorded, so detection works afterwards.
  3. The library could not tell whether the game is still on the phone. onDevice only checked the local record and cached app, so any game ever installed said "Open on ". The launcher now reads xcrun devicectl device info apps --device <UDID> --json-output - per paired device — on launch/devices change, on selection (one-minute cache), and after every install/reinstall/re-sign — and matches the recorded bundle identifier. When the phone no longer has it: the hero says "not on (deleted)" with Reinstall, the card's status line says "· not on ", and the primary button becomes "Reinstall on " instead of an Open that can only fail. When the phone cannot be read (unplugged, locked, old devicectl), nothing is claimed and the previous behaviour stands.

Supporting changes:

  • A cleaned build folder now forgets only the cached app path, not where the game was installed (installedDevice/installedBundleID survive), which is what makes Manage → Reinstall reachable in the owner's scenario.
  • LibraryGame gains installedBundleID and savedIPAPath (both backward-compatible in library.json).

Verified

  • swift test --package-path frontend → 199 tests, 6 skipped, 0 failures.
  • New cases: install-material choice (app > IPA > none), result.apps[].bundleIdentifier parsing (list, empty list, missing key, garbage), isOnDevice true/false/unknown, the full IPA reinstall through the fake xcrun (unpacked path exists at install time, …/Payload/DmIOS.app, temp folder removed, bundle id recorded), the install record surviving pruneMissingPaths, the saved-IPA/bundle record through the library file, and the Manage row (present only with a recorded device, disabled while building).
  • The parser was checked against a real capture from the owner's iPhone (devicectl device info apps --json-output -): result.apps[].bundleIdentifier, e.g. com.xindong.torchlight2.

Not verified

  • A real Manage → Reinstall (cached app, saved IPA and picker paths), and the "not on the phone" state against a real delete — the owner's device run.
  • A game installed before this change has no recorded installedBundleID; the match falls back to the cached app's identifier, then to org.nxnative.<titleID>, so a team-variant install from before this change can read as "not on the phone" until it is installed once more.

…the phone has

Three gaps the owner hit after installing a game:

- The build-complete card was the only place with Reinstall. Most
  reinstalls happen long after the build, when derived data or the
  build folder may be gone. Manage now has Reinstall for any game
  recorded on a device, whether or not the cached app is still there.
- Reinstall only knew the signed .app from the last build. It now falls
  back to the IPA the player saved with Save IPA… (recorded per game),
  and with neither it opens a file picker for an .ipa. An IPA is
  unpacked (Payload/*.app) to a temporary folder, installed, and the
  folder removed.
- The library said "Open on <device>" for any game that had ever been
  installed, even after the player deleted it on the phone. It now
  reads `devicectl device info apps` per paired device (on launch, on
  selection after a minute, and after every install) and shows "not on
  <device> (deleted)", with Reinstall as the primary action, when the
  app is gone.

A cleaned build folder no longer forgets where the game was installed
(only the cached app path is cleared), and the bundle identifier an
install used is recorded so the phone's list can be matched after the
app is gone.

Verified: swift test --package-path frontend -> 199 tests, 6 skipped,
0 failures (7 new: the install material choice, the device app-list
parse and its unknown/empty cases, the IPA reinstall through the fake
xcrun including the unpacked path and its cleanup, the install record
outliving a cleaned build folder, the saved-IPA/bundle record through
the library file, and the Manage row's presence and enabled state).
The parsing was also checked against a real `devicectl device info
apps --json-output -` capture from the owner's iPhone.
Not verified: a real reinstall/picker run and the "not on the phone"
state on a device (the owner's).
…t "not built"

Two things the owner saw on the collection card:

- Status and its notes ("· tool update · signature 3 days · not on the
  phone") shared one HStack, and two notes were enough to truncate all
  of them. The notes are their own row now, under the status, on the
  hero and on the card.
- A game whose build folder was cleaned showed "Not built yet" even
  though it was installed and can be put back (the install record, a
  saved IPA, Manage → Reinstall all survive). A recorded install is a
  state of its own: green "Installed before, can be reinstalled"
  instead of grey "not built yet". The hero's primary action already
  handles it (Reinstall); nothing else changes.

Verified: swift test --package-path frontend -> 248 tests, 7 skipped,
0 failures (1 new: the record survives pruneMissingPaths with no local
paths left, so the status reads the record, not the build folder).
@LNPANDY
LNPANDY force-pushed the task-145-resign-expiry branch from 544a9c2 to 53aa99c Compare October 28, 2026 19:24
@LNPANDY
LNPANDY force-pushed the install-reinstall-on-phone branch from 210eec3 to ae53c60 Compare October 28, 2026 19:24
@LNPANDY
LNPANDY merged commit 31f0ad3 into task-145-resign-expiry Oct 28, 2026
8 checks passed
@v0lumehi
v0lumehi deleted the install-reinstall-on-phone branch October 29, 2026 21:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant