@@ -175,6 +175,22 @@ export function useOneSignal(): UseOneSignalReturn {
175175
176176 const handleNotificationClick = ( e : NotificationClickEvent ) => {
177177 console . log ( `Notification click: ${ e . notification . title ?? '' } ` ) ;
178+ // Persist to localStorage so cold-start clicks are still inspectable
179+ // after the Safari Web Inspector reattaches to the WKWebView.
180+ try {
181+ const existing = JSON . parse ( localStorage . getItem ( 'lastNotificationClicks' ) ?? '[]' ) ;
182+ existing . push ( {
183+ notificationId : e . notification . notificationId ,
184+ title : e . notification . title ?? null ,
185+ body : e . notification . body ?? null ,
186+ actionId : e . result . actionId ?? null ,
187+ url : e . result . url ?? null ,
188+ receivedAt : new Date ( ) . toISOString ( ) ,
189+ } ) ;
190+ localStorage . setItem ( 'lastNotificationClicks' , JSON . stringify ( existing . slice ( - 20 ) ) ) ;
191+ } catch ( err ) {
192+ console . warn ( 'Failed to persist notification click to localStorage' , err ) ;
193+ }
178194 } ;
179195
180196 const handleForegroundWillDisplay = ( e : NotificationWillDisplayEvent ) => {
@@ -280,7 +296,7 @@ export function useOneSignal(): UseOneSignalReturn {
280296
281297 console . log ( 'Loaded OneSignal' ) ;
282298 return ( ) => {
283- console . log ( 'Cleaning up OneSignal listeners ' ) ;
299+ console . log ( 'Cleaning up OneSignal listenerszzz ' ) ;
284300 OneSignal . InAppMessages . removeEventListener ( 'willDisplay' , handleIamWillDisplay ) ;
285301 OneSignal . InAppMessages . removeEventListener ( 'didDisplay' , handleIamDidDisplay ) ;
286302 OneSignal . InAppMessages . removeEventListener ( 'willDismiss' , handleIamWillDismiss ) ;
0 commit comments