Answer push_off before no_subscriptions and give every iOS browser the Home Screen copy (Feature 19)
CI / ci (push) Successful in 6m17s
CI / ci (pull_request) Successful in 7m26s

SendTest now reads the plan_ready push preference before the stored
subscriptions, so with push off and no device subscribed the test-push
endpoint answers 409 push_off rather than 409 no_subscriptions.

Onboarding step 3's unsupported result now gives the Home Screen guidance
in any iOS browser, not only Safari. isIos in InstallHint.tsx is the one
check for iPhone, iPod and iPad; isIosSafari builds on it and InstallHint
itself stays Safari-only.

Task f89279b8-b92c-4d9f-a6c2-fd87fccda509

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-09 17:17:58 -04:00
co-authored by Claude Opus 5.5
parent 875a0faaae
commit 3ce0935b52
7 changed files with 88 additions and 22 deletions
+16 -5
View File
@@ -115,12 +115,23 @@ type TestSent struct {
// notification outbox as a plan_ready event whose tap opens TestURL. Its
// key, "plan_ready:test-" and a new id, is never used twice, so it is never
// taken for an event already sent. It goes to push alone, never to Google
// Chat. With no subscription it is ErrNoSubscriptions, and with push
// switched off for plan_ready it is notify.ErrPushOff; neither queues
// anything. Delivery happens after SendTest returns, with the outbox's
// retries.
// Chat. With push switched off for plan_ready it is notify.ErrPushOff,
// whether or not any device has turned on push; otherwise with no
// subscription it is ErrNoSubscriptions. Neither queues anything. Delivery
// happens after SendTest returns, with the outbox's retries.
func (s *Service) SendTest(ctx context.Context) (TestSent, error) {
subs, err := db.New(s.st.Reader).ListPushSubscriptions(ctx)
q := db.New(s.st.Reader)
pref, err := q.GetNotificationPref(ctx, string(notify.PlanReady))
if errors.Is(err, sql.ErrNoRows) {
return TestSent{}, fmt.Errorf("push: no notification preference for %s", notify.PlanReady)
}
if err != nil {
return TestSent{}, fmt.Errorf("push: read notification preference for %s: %w", notify.PlanReady, err)
}
if pref.Push != 1 {
return TestSent{}, fmt.Errorf("%w: %s", notify.ErrPushOff, notify.PlanReady)
}
subs, err := q.ListPushSubscriptions(ctx)
if err != nil {
return TestSent{}, fmt.Errorf("push: list subscriptions: %w", err)
}