Skip to main content
coreydaley.dev

Asking for an App Store rating once, at a neutral moment

New in Purrchiver 1.1. If you don't see it, update Purrchiver from the App Store.

At the end of September, Purrchiver had no ratings and no reviews, anywhere. Every App Store search tile read “No Ratings”, right next to Keka and The Unarchiver, which have thousands. Search is where people find a Mac utility, and a tile with no stars is easy to skip.

The obvious fix is to ask. The problem was a promise on Purrchiver’s privacy and security page, which said, in bold: No “rate this app” prompt. Ever. Apps that nag for ratings are part of what Purrchiver set out not to be.

So 1.1 asks, but in a way I’m willing to put my name to: once, ever, in Apple’s own dialog, at a moment when you’re not in the middle of anything. Getting the “moment” part right took two tries.

Changing a published promise

I didn’t want to quietly break the old line, so it changed before the code did. The page now says Purrchiver asks at most once, only after you’ve used it successfully a few times, never on launch, never mid-task, never after an error, and never again whatever you choose.

And there’s a menu item for people who’d rather do it themselves: Help ▸ Rate Purrchiver on the App Store… It’s always there, and it opens the App Store app straight on Purrchiver’s write-a-review page. It uses a macappstore:// link rather than https://apps.apple.com, because on a Mac the web link opens the browser first and makes you click through. Using it has no effect on the one-time prompt.

The dialog itself is Apple’s. Apps can’t customize it or show it on demand, and however often an app asks, the system shows it at most three times in 365 days. App Review rules out homemade review prompts, and I won’t put a “do you like this app?” screen in front of it either. macOS draws the dialog and submits the rating, so the rating goes to Apple, Purrchiver sends nothing, and it still has no network permission at all.

The first version asked at the worst moment

The first version was simple: after your third successful extract or create, ask.

It was wrong, and the privacy page itself said why. The same page has a “post-completion rule”: when an extract or compress finishes, you get an inline status update, an optional notification if you turned that on, and that’s it. “There is nothing else.” A rating prompt right after the third extract is exactly the something else that rule promises you won’t get.

It’s also wrong from your side of the screen. The moment an extract finishes is the moment you want your files. A dialog in front of them, however polite, is in the way.

The conflict was already on my list; I’d just written the code before deciding it. When I did decide, I kept the rule and changed the trigger. The fix landed about twenty minutes after the first version, and neither had shipped.

A neutral moment: an archive just opened

The shipped version still counts successful extracts and creates, but it never asks when one finishes. It asks when an archive has just opened, its contents are on screen, and nothing else is running.

Every one of these has to be true:

  • It has never asked before.
  • This isn’t the first time you’ve launched Purrchiver.
  • You’ve finished at least three extracts or creates, ever. Opening, testing, encrypting and the rest don’t count.
  • This is at least the second archive you’ve opened since launch. The first one never asks, because double-clicking an archive in Finder is often what launches the app, and “never on launch” means never.
  • No other job is running. If something is still extracting in the background, you’re mid-task.

There’s no timer. “Used it successfully a few times” means those counts, not a number of days.

A few details make the “never” rules hold:

  • Failures and cancellations don’t count and can’t trigger anything. Only a job that finishes successfully is even looked at.
  • A password prompt blocks it. An archive that has to ask for its password before it can list anything ends as cancelled, so it doesn’t count as an open. An encrypted ZIP is different: it lists first and asks for the password after, so the open has already succeeded. So the window waits a second after an open before asking, and never asks while it has a sheet up. If a sheet appears, the request waits until it’s gone.
  • Once means once per install. A flag is saved the moment Purrchiver asks, whether or not macOS actually shows the dialog. After that it stops counting.

When there’s no window to ask from

Purrchiver also runs headless, from Shortcuts. An “Inspect Archive” action opens an archive with no window on screen. Jobs a Shortcut runs are marked as headless, and a headless open isn’t a moment to ask: it can’t trigger the prompt, and it doesn’t count toward “the second archive since launch”. Extracts and creates run from Shortcuts still count as successes.

That still leaves the case where the moment comes and no window can take it. A plain “should ask” flag would cause trouble here: it would sit there, set, and fire the moment a window next appeared, which could easily be the next launch. So the decision works differently:

  1. Deciding to ask bumps a number, rather than setting a yes or no that stays set.
  2. Open archive windows watch for that number to change.
  3. The first window to see the change asks, and no other window does.
  4. If no window is open, nobody asks, and that doesn’t count as having asked. The next eligible open gets a fresh chance.

The number lives only in memory, so it starts over each launch. The ask itself is SwiftUI’s requestReview action from the environment, called from a modifier on each window:

struct ReviewPromptModifier: ViewModifier {
    @Environment(\.requestReview) private var requestReview
    let coordinator: ReviewPromptCoordinator
    let isBlocked: Bool                     // the window has a sheet up
    @State private var gate = ReviewPromptGate()
    @State private var blockedNow = false

    func body(content: Content) -> some View {
        content
            .onChange(of: coordinator.requestToken) { _, token in
                gate.requested(token)
            }
            .task(id: gate.pending) {       // let the window settle first
                guard gate.pending != nil else { return }
                try? await Task.sleep(for: .seconds(1))
                ask(gate.ready(blocked: blockedNow))
            }
            .onAppear { blockedNow = isBlocked }
            .onChange(of: isBlocked) { _, blocked in
                blockedNow = blocked
                if !blocked { ask(gate.ready(blocked: false)) }
            }
    }

    private func ask(_ token: Int?) {
        if let token, coordinator.claim(token: token) { requestReview() }
    }
}

The gate holds a request until the window has had a second to settle and has no sheet up, then hands it over once. claim saves the “asked” flag and succeeds only once per change.

How it’s tested

The rules are a pure function, so each one can be tested on its own: one test where everything holds, then one case per rule showing that rule alone blocks the ask. The rest of the tests cover the behavior around it:

  • Ten extracts and ten creates in a row never produce a prompt. This is the test that would have caught the first version. I ran it against that version to make sure it fails.
  • The first archive opened after a relaunch never asks.
  • Nothing asks in the first session, however much you do.
  • Successes carry over between launches, and the “asked” flag survives a relaunch.
  • Only one window can claim a request, and an unclaimed one isn’t used up.
  • An open run by a Shortcut never counts, however many there are.
  • A request waits while the window has a sheet up, then goes exactly once.
  • The job queue reports success only on success, never on failure or cancellation, and an open that stops for a password adds nothing.

The dialog itself can’t be driven by tests. In development builds macOS shows it every time it’s requested, so tests switch the prompt off entirely, or it would pop up in the middle of UI test runs.

What I’d tell another indie developer

  • Ask at a quiet moment, not a finished one. The end of a task feels like the natural time to ask, which is exactly why it’s the worst: it’s when people want their result.
  • Test the moment you’re avoiding, not just the one you want. That’s what the ten-extracts test is.
  • Use Apple’s dialog, and only Apple’s. App Review requires it, and a “do you like us?” screen in front of it is the nag you’re trying to avoid.
  • Keep a stricter limit than Apple’s. Once is plenty.
  • If you’ve promised something publicly, change the promise first. Then the code.

Have you ever had to change a public promise before you could ship a feature, and did you change the promise or the feature?

Related posts