Skip to content

feat(launcher): pause and resume for unlocks, a separate cancel, and a question before quitting - #126

Draft
utkuhalis wants to merge 1 commit into
mainfrom
feat/parity-unlock-pause
Draft

utkuhalis wants to merge 1 commit into
mainfrom
feat/parity-unlock-pause

Conversation

@utkuhalis

Copy link
Copy Markdown
Collaborator

Waits for AnyTogether/AnyPS5-Desktop#151. Do not merge this one on its own: the two land together.

What

This is the Mac counterpart of AnyTogether/AnyPS5-Desktop#151 by lenny4250, "Pause and resume for unlocks, a separate Cancel button, and a confirmation before closing the window". It follows the Desktop PR as it will be after the changes our review asks for there, in the Mac launcher's own SwiftUI style.

Only an unlock the user asked for gets the new controls. A game prepared in the background, an update of an installed game and an unlock started to play afterwards keep what they do today.

  • Pause and Resume. The main button of an unlock under way is now Pause. It freezes the relinker (SIGSTOP, as a game starting already does for the background preparation) and the launcher's own steps wait at their next file. The button then says Resume, the Status card and the line over the bar say Paused, and the bar stays where it stood.
  • A paused unlock steps aside. The next game in the queue starts while the paused one stays frozen. Resume while another unlock runs puts it back in line: it reads Queued, keeps its bar, and its main button pauses it again. One press never drops its work. When the running one ends, the waiting one goes on before the queue's next game.
  • A small Cancel button (✕) follows the main button while an unlock runs, is paused or waits to go on. It asks first: "Cancel the unlock of ?", with Keep going focused and Cancel unlock on the right, and the line "The work done so far is lost. Pause instead to stop now and go on later." While the work is being stopped the main button reads Cancelling… and does nothing. A game that only waits in the queue loses nothing, so its main button stays Cancel and drops it at once. When the ✕ goes away the focus goes back to the main button.
  • Quitting asks first while a user unlock is under way, paused, waiting or queued, or while a game is being removed. Cmd-Q, the window's close button, Home menu › Quit AnyPS5 and Escape's Quit AnyPS5? all reach it through applicationShouldTerminate. The card offers Go back and Cancel and quit (Quit anyway when only a removal runs), with "Cancel and quit throws the work away. To stop and go on later, go back and use Pause, and keep the launcher open." and, during a removal, "Removing games can be neither paused nor cancelled." Cancel and quit empties the queue, cancels every unlock (a paused one gets SIGCONT so it receives the termination, as Installer.cancel already does) and the background preparation, waits up to ten seconds for them to end, then quits. On every quit that does not ask, the same cancel runs, so no stopped relinker is left behind. Games prepared in the background alone do not make it ask.
  • Phone remote. A paused unlock is reported as locked, and the phone's Unlock on it resumes it. Cancelling is still installing. The activity card follows the unlock that actually runs, not a paused one.
  • Work folders. The rescan's leftover cleanup now also waits while a paused unlock exists, so a paused unlock's work folder is never cleared under it.
  • Texts: 15 keys. Desktop's 14 with the same wording plus cancelUnlock ("Cancel unlock"), which the Mac did not have. English and Turkish are in full, as are German, Spanish, French and Portuguese with the PR's own texts and 18 more languages. Amharic, Bhojpuri, Khmer and Lao get cancelUnlock from Desktop's files and show the other texts in English, as the launcher does for any text a file lacks. Turkish uses "Duraklat", "Devam et" and "Kilit açmayı iptal et", as Desktop does.

Deliberate differences from Desktop

  • No Pause and quit. The Desktop PR has half of one (saved percentages, a restart-from-zero Resume) that nothing calls, and our review asks to remove it. Here it is not ported.
  • Pause and the ✕ are for plain unlocks only, which is what our review asks Desktop for. An update keeps its button.
  • Every quit path asks on the Mac. All of them go through applicationShouldTerminate. Our review asks Desktop to hook the native close (onExitRequested) the same way.
  • The unlocks are behind a small UnlockWork protocol (pause, resume, cancel), which Installer conforms to, so the tests can drive the queue without a relinker.

Release note

Unlocks can be paused: the button of a game being unlocked is now Pause, and Resume goes on from where it stopped while the next game in line goes ahead. A small ✕ beside it cancels the unlock after asking, and quitting while games are being unlocked or removed asks first.

Tested

CI only. Nothing was built or run on a Mac: there was no local swift build or swift test, and the screens were not looked at.

  • Tests/AnyPS5Tests/UnlockPauseTests.swift, with stand-in unlocks that count what they are asked: pausing lets the next one start, Resume while another runs waits and is never dropped by its main button, Resume with nothing else running goes on at once, the ✕ asks first and Keep going keeps the work, a paused unlock can be cancelled while a queued one drops at once, quitting asks (Escape's question and the app delegate's path) and Cancel and quit cancels the paused one too and waits for the work to end, quitting with nothing unlocked asks nothing, the phone's mapping and activity, and the texts in English and Turkish.
  • LanguageCheckTests covers the 28 files.

Checklist

…a question before quitting

The Mac counterpart of AnyPS5-Desktop boykopovar#151. The main button of an unlock
the user asked for is Pause, then Resume. A paused unlock steps aside so
the next one starts, and a Resume while another one runs waits its turn.
A small Cancel button after it asks first. Quitting (Cmd-Q, the window's
close, Quit AnyPS5) while games are unlocked or removed asks first, and
Cancel and quit stops every unlock, a paused one included, before the
app goes. The phone sees a paused unlock as locked.

This branch has not been deployed

No deployments
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