@capacitor/ios 8.5.2-nightly-20260909T151228.0 → 8.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -265,19 +265,38 @@ open class CapacitorBridge: NSObject, CAPBridgeProtocol {
265
265
  registerCordovaPlugins()
266
266
  } else {
267
267
  observers.append(NotificationCenter.default.addObserver(forName: UIScene.willEnterForegroundNotification, object: nil, queue: OperationQueue.main) { [weak self] notification in
268
- if let scene = notification.object as? UIWindowScene, scene === self?.viewController?.view.window?.windowScene {
269
- self?.triggerDocumentJSEvent(eventName: "resume")
270
- }
271
-
268
+ self?.triggerSceneLifecycleJSEvent("resume", for: notification)
272
269
  })
273
270
  observers.append(NotificationCenter.default.addObserver(forName: UIScene.didEnterBackgroundNotification, object: nil, queue: OperationQueue.main) { [weak self] notification in
274
- if let scene = notification.object as? UIWindowScene, scene === self?.viewController?.view.window?.windowScene {
275
- self?.triggerDocumentJSEvent(eventName: "pause")
276
- }
271
+ self?.triggerSceneLifecycleJSEvent("pause", for: notification)
277
272
  })
278
273
  }
279
274
  }
280
275
 
276
+ /**
277
+ Forward a scene lifecycle transition to the page as a document event, but only once
278
+ the page exists to receive it.
279
+
280
+ On a cold start `UIScene.willEnterForegroundNotification` is posted while the initial
281
+ load is still in flight, before `window.Capacitor` has been defined. Evaluating
282
+ `triggerEvent` at that point throws inside the web view and surfaces as a
283
+ "JS Eval error" in the log. The same happens when the web content process was
284
+ terminated and the page is being reloaded. In both cases the page is about to load
285
+ from scratch, so there is nothing for it to resume or pause; the event is dropped
286
+ rather than deferred, because a "resume" delivered right after a fresh load would
287
+ make the page react to a transition it never went through.
288
+ */
289
+ private func triggerSceneLifecycleJSEvent(_ eventName: String, for notification: Notification) {
290
+ guard let scene = notification.object as? UIWindowScene,
291
+ scene === viewController?.view.window?.windowScene else {
292
+ return
293
+ }
294
+ guard case .subsequentLoad = webViewDelegationHandler.webViewLoadingState, webView?.isLoading == false else {
295
+ return
296
+ }
297
+ triggerDocumentJSEvent(eventName: eventName)
298
+ }
299
+
281
300
  /**
282
301
  Export the core Cordova JS runtime
283
302
  */
@@ -367,12 +367,6 @@ var nativeBridge = (function (exports) {
367
367
  }
368
368
  };
369
369
  const platform = getPlatformId(win);
370
- if (platform == 'android' && typeof win.CapacitorSystemBarsAndroidInterface !== 'undefined') {
371
- // add DOM ready listener for System Bars
372
- document.addEventListener('DOMContentLoaded', function () {
373
- win.CapacitorSystemBarsAndroidInterface.onDOMReady();
374
- });
375
- }
376
370
  if (platform == 'android' || platform == 'ios') {
377
371
  // patch document.cookie on Android/iOS
378
372
  win.CapacitorCookiesDescriptor =
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capacitor/ios",
3
- "version": "8.5.2-nightly-20260909T151228.0",
3
+ "version": "8.5.2",
4
4
  "description": "Capacitor: Cross-platform apps with JavaScript and the web",
5
5
  "homepage": "https://capacitorjs.com",
6
6
  "author": "Ionic Team <hi@ionic.io> (https://ionic.io)",
@@ -25,7 +25,7 @@
25
25
  "xc:build:CapacitorCordova": "cd CapacitorCordova && xcodebuild && cd .."
26
26
  },
27
27
  "peerDependencies": {
28
- "@capacitor/core": "^8.5.0-nightly-20260909T151228.0"
28
+ "@capacitor/core": "^8.5.0"
29
29
  },
30
30
  "publishConfig": {
31
31
  "access": "public"