From 24d909fa3e0a6ffae5d8c2fb167c0383b3eae3b7 Mon Sep 17 00:00:00 2001 From: useruserdev <256019073+useruserdev@users.noreply.github.com> Date: Fri, 5 Jun 2026 11:53:19 +0500 Subject: [PATCH] Refresh on cold launch so notifications don't require pull-to-refresh The launch refresh was wired only to onChange(of: scenePhase) for .active. scenePhase is already .active on cold launch, so onChange never fires for it and refreshAll() (which detects changes and posts notifications) never ran at startup. Updates only surfaced after a manual pull-to-refresh. Trigger the refresh from .task, which reliably runs once on first appearance. The onChange(.active) handler stays for background->foreground returns; refreshAll()'s isRefreshing guard makes any overlap a no-op. --- ios/happwn/happwnApp.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ios/happwn/happwnApp.swift b/ios/happwn/happwnApp.swift index 252b5d3..5122f33 100644 --- a/ios/happwn/happwnApp.swift +++ b/ios/happwn/happwnApp.swift @@ -38,6 +38,12 @@ struct HappwnApp: App { if settings.backgroundRefreshEnabled { BackgroundRefresh.schedule(minInterval: settings.minRefreshInterval.seconds) } + // Refresh on cold launch. scenePhase starts at .active, so the + // .onChange below never fires for the initial launch — without + // this, updates (and their notifications) only appear after a + // manual pull-to-refresh. onChange still covers later + // background→active returns. + await coordinator.refreshAll() } .onChange(of: scenePhase) { phase in switch phase {