Skip to content

chore: sync upstream PR #8636 - fix(SystemBars): defer safe area CSS injection until the document exists - #175

Closed
riderx wants to merge 39 commits into
plusfrom
sync/upstream-pr-8636
Closed

riderx wants to merge 39 commits into
plusfrom
sync/upstream-pr-8636

Conversation

@riderx

@riderx riderx commented Oct 1, 2026 •

Copy link
Copy Markdown
Member

Merge Conflict Review Required

The sync of upstream PR ionic-team#8636 from @kttalley encountered merge conflicts.

Original PR: ionic-team#8636

What happened

  • Git applied the upstream-preferred merge strategy
  • This PR requires CI and manual review before merging

Synced from upstream by Capacitor+ Bot


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Review in cubic

Github Workflow (on behalf of markemer) and others added 30 commits May 7, 2026 16:55
Co-authored-by: jcesarmobile <jcesarmobile@gmail.com>
Co-authored-by: Joey Pender <joey.pender@outsystems.com>
Co-authored-by: Pedro Bilro <pedro.gustavo.bilro@outsystems.com>
Co-authored-by: Mark Anderson <mark.anderson@outsystems.com>
…#8476)

Co-authored-by: jcesarmobile <jcesarmobile@gmail.com>
…am#8492)

Co-authored-by: Mark Anderson <mark.anderson@outsystems.com>
ItsChaceD and others added 9 commits August 31, 2026 16:49
…ermissions (ionic-team#8400)

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Pedro Bilro <pedro.gustavo.bilro@outsystems.com>
The window insets listener can fire before the WebView has a document,
so `document.documentElement` is null and the injected script logs
"Cannot read properties of null (reading 'style')" on startup.

Apply the values immediately when `document.documentElement` exists,
otherwise apply the most recent values once on `DOMContentLoaded`.

Closes ionic-team#8530
@riderx

riderx commented Oct 1, 2026

Copy link
Copy Markdown
Member Author

Git applied the upstream-preferred strategy to resolve this sync. Please review the branch carefully before merging.

@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown

Beta npm build

Maintainers can publish one Capacitor Plus workspace package from this PR to npm for fast testing.

Comment /publish-beta <package> after the PR checks are green.

Examples:

/publish-beta core
/publish-beta cli
/publish-beta @capacitor-plus/core

If exactly one workspace package changed, /publish-beta without a package will use that package.

Packages:

  • core (@capacitor-plus/core)
  • cli (@capacitor-plus/cli)
  • android (@capacitor-plus/android)
  • ios (@capacitor-plus/ios)

The workflow will:

  • publish a prerelease package on the beta tag
  • update this comment with the install command

Security note: beta publish is only enabled for branches inside this repository.

@coderabbitai

coderabbitai Bot commented Oct 1, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 5 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 0393f151-18e6-40ad-b429-115c78cb67dd

📥 Commits

Reviewing files that changed from the base of the PR and between 8687b31 and ce02565.

📒 Files selected for processing (45)
  • .github/workflows/ci.yml
  • CHANGELOG.md
  • android/CHANGELOG.md
  • android/capacitor/src/androidTest/AndroidManifest.xml
  • android/capacitor/src/androidTest/java/com/getcapacitor/android/HttpInterceptorNavigationTest.java
  • android/capacitor/src/androidTest/java/com/getcapacitor/android/InterceptorAllowingPlugin.java
  • android/capacitor/src/androidTest/java/com/getcapacitor/android/TestHostActivity.java
  • android/capacitor/src/main/assets/native-bridge.js
  • android/capacitor/src/main/java/com/getcapacitor/Bridge.java
  • android/capacitor/src/main/java/com/getcapacitor/BridgeWebChromeClient.java
  • android/capacitor/src/main/java/com/getcapacitor/Plugin.java
  • android/capacitor/src/main/java/com/getcapacitor/WebViewLocalServer.java
  • android/capacitor/src/main/java/com/getcapacitor/cordova/MockCordovaWebViewImpl.java
  • android/capacitor/src/main/java/com/getcapacitor/plugin/SystemBars.java
  • android/capacitor/src/test/java/com/getcapacitor/plugin/SystemBarsTest.java
  • android/capacitor/src/test/java/com/getcapacitor/plugin/util/HttpRequestHandlerTest.java
  • android/package.json
  • cli/CHANGELOG.md
  • cli/package.json
  • cli/src/declarations.ts
  • cli/src/ios/update.ts
  • cli/src/tasks/migrate-uiscene.ts
  • cli/src/tasks/migrate.ts
  • cli/src/tasks/run.ts
  • cli/src/util/node.ts
  • cli/src/util/spm.ts
  • cli/src/util/xcode.ts
  • cli/test/migrate-uiscene-plist.spec.ts
  • cli/test/migrate-uiscene-scan.spec.ts
  • cli/test/xcode.spec.ts
  • core/CHANGELOG.md
  • core/native-bridge.ts
  • core/package.json
  • core/system-bars.md
  • ios-pods-template/App/App/Info.plist
  • ios-spm-template/App/App/Info.plist
  • ios/CHANGELOG.md
  • ios/Capacitor/Capacitor.xcodeproj/project.pbxproj
  • ios/Capacitor/Capacitor/CAPSceneDelegateProxy.swift
  • ios/Capacitor/Capacitor/CapacitorBridge.swift
  • ios/Capacitor/Capacitor/WebViewAssetHandler.swift
  • ios/Capacitor/Capacitor/WebViewDelegationHandler.swift
  • ios/Capacitor/Capacitor/assets/native-bridge.js
  • ios/Capacitor/CapacitorTests/HttpInterceptorNavigationTests.swift
  • ios/package.json
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

25 issues found across 45 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="ios/Capacitor/Capacitor/CAPSceneDelegateProxy.swift">

<violation number="1" location="ios/Capacitor/Capacitor/CAPSceneDelegateProxy.swift:24">
P1: This observer consumes the pending connection options on the first `capacitorViewDidAppear` from any scene. In a multi-scene app, another scene can trigger delivery before this scene's plugins are ready, and removing the observer prevents a later retry; retain a per-scene bridge-readiness check before removing it.</violation>
</file>

<file name="cli/src/util/spm.ts">

<violation number="1" location="cli/src/util/spm.ts:141">
P2: Keep normalizing the symlink path: `join()` emits backslashes on Windows, producing an invalid Swift string in `Package.swift` and breaking the later iOS build. Apply `convertToUnixPath` to `symlinkFolder` too.</violation>

<violation number="2" location="cli/src/util/spm.ts:278">
P1: This hardcodes `Main` for migrated apps whose existing plist names a different storyboard or has no main storyboard, so UIKit may fail while creating the scene. Copy the existing `UIMainStoryboardFile` value and omit this key when it is absent.</violation>
</file>

<file name="android/capacitor/src/test/java/com/getcapacitor/plugin/SystemBarsTest.java">

<violation number="1" location="android/capacitor/src/test/java/com/getcapacitor/plugin/SystemBarsTest.java:68">
P2: This helper can exercise only the show path, and the deleted hide tests leave `setHidden(true, ...)` untested. Keep the helper parameterized and retain tests for the hide calls.</violation>
</file>

<file name="core/system-bars.md">

<violation number="1" location="core/system-bars.md:68">
P2: `css` is documented as injecting correct inset values, but older WebViews and pages without `viewport-fit=cover` receive `0px` for these variables. Qualify this description so apps do not rely on unavailable inset values.</violation>
</file>

<file name="cli/test/migrate-uiscene-scan.spec.ts">

<violation number="1" location="cli/test/migrate-uiscene-scan.spec.ts:10">
P2: Removing these cases leaves delegate scanning untested for braces inside Swift strings. The new `hasCustomDelegateBody` loop counts every brace, so a `}` in a vanilla handler can truncate its body and produce a false custom-handler warning; add caller-level regression cases for these string forms.</violation>

<violation number="2" location="cli/test/migrate-uiscene-scan.spec.ts:155">
P3: The scanner still explicitly excludes `.build`, but this fixture no longer exercises that behavior. Keep the `.build` artifact fixture so regressions that warn on SwiftPM build output remain caught.</violation>
</file>

<file name="ios/Capacitor/Capacitor/WebViewDelegationHandler.swift">

<violation number="1" location="ios/Capacitor/Capacitor/WebViewDelegationHandler.swift:78">
P2: This path-only check also cancels external URLs that happen to use the reserved prefix, bypassing both `shouldAllowNavigation` and the later system-browser handling. Restrict the cancellation to the configured local or server origin.</violation>
</file>

<file name="ios-pods-template/App/App/Info.plist">

<violation number="1" location="ios-pods-template/App/App/Info.plist:38">
P2: UIKit now creates the storyboard's `CAPBridgeViewController`, but `SceneDelegate.scene(_:willConnectTo:)` discards it and creates another one. Remove this storyboard entry or use the storyboard-created controller; otherwise its `loadView` can initialize an unused second bridge and WebView.</violation>
</file>

<file name="android/capacitor/src/main/java/com/getcapacitor/plugin/SystemBars.java">

<violation number="1" location="android/capacitor/src/main/java/com/getcapacitor/plugin/SystemBars.java:227">
P1: The non-passthrough branch passes zeroed insets to `injectSafeAreaCSS()`, so CSS safe-area variables become `0px` for apps using this path. Inject from the original `insets` instead.</violation>
</file>

<file name="ios-spm-template/App/App/Info.plist">

<violation number="1" location="ios-spm-template/App/App/Info.plist:40">
P2: This makes UIKit load `Main.storyboard`'s initial `CAPBridgeViewController`, while `SceneDelegate.scene(_:willConnectTo:options:)` creates another window and bridge controller. Remove this storyboard entry so the scene uses the delegate's single manually created bridge.</violation>
</file>

<file name="cli/CHANGELOG.md">

<violation number="1" location="cli/CHANGELOG.md:6">
P2: This replaces Capacitor+'s published 8.5.2 history with upstream's 8.5.2 release and removes the fork's separate 8.5.1 entry, so this changelog no longer describes the package's releases. Preserve the Cap-go release entries and list upstream changes under a distinct Capacitor+ release.</violation>
</file>

<file name="ios/package.json">

<violation number="1" location="ios/package.json:2">
P1: Same upstream-preferred conflict regression as core/android: the package reverts to Ionic's `@capacitor/ios` identity and loses the `@capacitor-plus/core` peer dependency. The fork's release tooling (`scripts/sync-peer-dependencies.mjs` CORE_DEPENDENTS), publish workflow (`.github/workflows/build.yml` publishes `@capacitor-plus/$pkg`), and CLI resolution (`cli/src/ios/update.ts:399-409` looks up `@capacitor-plus/ios`) all assume the plus scope, so installing/publishing this package under the new name breaks the drop-in `@capacitor-plus` flow. Restore the pr-base `@capacitor-plus/ios` identifier, Capgo metadata, and the `@capacitor-plus/core` peer dependency.</violation>
</file>

<file name="cli/src/ios/update.ts">

<violation number="1" location="cli/src/ios/update.ts:64">
P2: This new block duplicates the Package.swift Capacitor-version patching already present below it (lines ~92-130, present at pr-base), so every plugin's Package.swift is now read, rewritten, and warned about twice per sync. The new copy also differs from the old one in two risky ways: it calls `getCapacitorPackageVersion` inside the `.map` (redundantly repeating the node_modules lookup per plugin) and it has no try/catch, whereas the existing block guards the call with `try { ... } catch { logger.warn('Skipping plugin Package.swift Capacitor version patching: ...') }` — an unguarded `fatal()` from `requireCapacitorPackage` (e.g., missing `@capacitor/ios` in node_modules) now hard-fails the sync. Keep only one block, hoist the version lookup out of the loop, and preserve the try/catch.</violation>
</file>

<file name="CHANGELOG.md">

<violation number="1" location="CHANGELOG.md:6">
P3: This conflict resolution replaced the fork's own 8.5.1/8.5.2 release entries (Cap-go/capacitor-plus compare links, released 2026-08-25/26, listing the plus-branch CI fixes #109/#110) with upstream's release records dated 2026-08-31/2026-09-11. The version-header, issue, and commit links now all point to `ionic-team/capacitor`, and the @capacitor-plus packages were actually published as 8.5.2 on 2026-08-26 (per the deleted lines and pr-base). Readers can no longer tell what the fork's own 8.5.x releases contained, and clicking "8.5.2" or any fix link lands in the upstream repo instead of Cap-go/capacitor-plus. Either preserve the fork-specific entries beneath the synced notes (retaining the Cap-go links) or add a line clarifying these are upstream-mirrored records rather than the fork's published releases.</violation>
</file>

<file name="cli/src/tasks/migrate.ts">

<violation number="1" location="cli/src/tasks/migrate.ts:449">
P2: This drops the `@capacitor-plus/ios` check, so apps using this fork's own plus-scoped iOS package no longer see the Capacitor 8.5 UIScene migration warning. The rest of this function already treats both package scopes equally (the `breaking` list above includes both `@capacitor-plus/*` and `@capacitor/*`), and this PR's actual scope (SystemBars safe-area CSS fix) doesn't touch migration messaging, so this looks like an accidental conflict-resolution drop.</violation>
</file>

<file name=".github/workflows/ci.yml">

<violation number="1" location=".github/workflows/ci.yml:24">
P2: These six `timeout-minutes: 30` bumps (setup, lint, test-cli, test-core, test-ios, test-android) contradict AGENTS.md, which caps CI jobs at 10 minutes: "Cap at 10 min max: `timeout-minutes: 10` in CI". Every other workflow in this repo (`test.yml`, `build.yml`, `publish-ios.yml`, etc.) uses 10. The change is also out of scope for this sync: upstream PR #8636 only modifies `SystemBars.java`, so this CI alteration is merge-conflict noise. A blanket 30-minute limit on the `setup` job (node/bun setup + cache only) masks long-hanging jobs and delays failure feedback. Revert to 10, or raise only the job that genuinely needs it (e.g., test-ios with Xcode download) with a comment justifying it.</violation>
</file>

<file name="core/package.json">

<violation number="1" location="core/package.json:2">
P0: This rename reverts the fork's package identity to upstream's Ionic-owned `@capacitor/core` scope and is unrelated to PR #8636, which only touched `SystemBars.java` — it comes from the "upstream-preferred" conflict resolution of the sync merge. The fork cannot publish `@capacitor/*` (Ionic owns that npm scope), and the release tooling is hard-coded to `@capacitor-plus`: `.github/workflows/build.yml` publishes `@capacitor-plus/$pkg`, and `scripts/sync-peer-dependencies.mjs` (run by `npm run version`) crashes because `ls().find(p => p.name === '@capacitor-plus/core')` returns `undefined`. Restore the pr-base `@capacitor-plus/core` name along with the Capgo description/homepage/author.</violation>
</file>

<file name="cli/src/tasks/run.ts">

<violation number="1" location="cli/src/tasks/run.ts:125">
P2: Removing the Android manifest revert from the error path leaves the project half-reverted: if `run()` throws after `writeCordovaAndroidManifest(cordovaPlugins, config, platformName, true)` (live reload on Android), the catch block now reverts only cap.config.json, while `android:usesCleartextTraffic="true"` and the cordova manifest edits stay in AndroidManifest.xml. The SIGINT handler (line 111) still performs both reverts, so the next build without live reload keeps the live-reload-only manifest state. Restore the guarded `writeCordovaAndroidManifest(..., false)` call in the catch block (it also guarded against `liveReloadManifestUpdated` being false, which this removal loses).</violation>
</file>

<file name="cli/src/tasks/migrate-uiscene.ts">

<violation number="1" location="cli/src/tasks/migrate-uiscene.ts:232">
P2: The naive brace-counting loop here (and the identical loops in `extractConfigurationForConnecting` and `insertBeforeAppDelegateClassEnd`) no longer ignores braces inside comments and string literals, regressing the behavior of the deleted `findMatchingBrace`. A `}` inside a `//` comment or a string literal prematurely closes the scope, so `insertBeforeAppDelegateClassEnd` can inject the `configurationForConnecting` snippet before the real class end and corrupt the user's AppDelegate.swift; an unbalanced `{` makes `hasCustomDelegateBody` return false and silently suppresses the scan warning. The regression tests covering ordinary/raw/multiline string literals were removed in the same PR.</violation>
</file>

<file name="android/package.json">

<violation number="1" location="android/package.json:2">
P1: Same conflict-resolution regression as core: the sync reverted this package to `@capacitor/android` (Ionic-owned scope) plus Ionic metadata, and dropped the `@capacitor-plus/core` peer dependency that grounded it in the fork's core. `scripts/sync-peer-dependencies.mjs` expects `@capacitor-plus/android` to sync its `@capacitor-plus/core` peer range on every release version bump, so the rename silently breaks peer-dependency versioning even if the publish step were fixed. Restore the pr-base file: `@capacitor-plus/android` name, Capgo metadata, and both peer dependencies (`@capacitor-plus/core` + `@capacitor/core`).</violation>
</file>

<file name="cli/src/util/xcode.ts">

<violation number="1" location="cli/src/util/xcode.ts:23">
P2: The new early return drops the previous 'file reference exists but is not in the target Sources build phase' recovery: a pbxproj with a stale `PBXFileReference` (file present, build entry missing, e.g. after the App target was regenerated or a partial migrate) now silently returns `{added: false}` instead of re-adding the file to the Sources build phase via `addToPbxBuildFileSection`/`addToPbxSourcesBuildPhase` as before. In the migrate-uiscene flow (cli/src/tasks/migrate-uiscene.ts:68) this means such partial states are no longer repaired and SceneDelegate.swift can remain uncompiled with only a warning.</violation>
</file>

<file name="ios/Capacitor/Capacitor/CapacitorBridge.swift">

<violation number="1" location="ios/Capacitor/Capacitor/CapacitorBridge.swift:267">
P2: `UIScene.willEnterForegroundNotification` and `UIScene.didEnterBackgroundNotification` are now each observed twice, so the document receives `resume`/`pause` twice per transition. These two new observers fire `triggerSceneLifecycleJSEvent("resume"/"pause", ...)`, and the pre-existing observers at lines ~272-284 (unchanged in this merge) fire `triggerDocumentJSEvent("resume"/"pause")` directly for the same notification and the same scene. On a normal foreground after the initial load, both paths pass and the page gets two `resume` events back to back (and two `pause` on background) — a regression from the pre-PR behavior where the scene observers were the only ones firing. The unguarded pre-existing observers also still evaluate `window.Capacitor.triggerEvent(...)` while the page is reloading after web-content-process termination, which is exactly the "JS Eval error" case the new guard's doc comment says it prevents, so that scenario is not actually fixed.</violation>
</file>

<file name="android/capacitor/src/main/java/com/getcapacitor/BridgeWebChromeClient.java">

<violation number="1" location="android/capacitor/src/main/java/com/getcapacitor/BridgeWebChromeClient.java:416">
P2: Removing the static state storage breaks image-capture file chooser handling on activity recreation, and only for this one picker. `showVideoCapturePicker` and `showFilePicker` still set `pendingFilePathCallback`/`pendingFileChooserType`, so on recreation the constructor callback reaches `handlePendingFileChooserResult`; but `showImageCapturePicker` now leaves them null, so `handlePendingFileChooserResult` returns early and `filePathCallback.onReceiveValue(...)` is never called, leaving the web file input (and future file uploads) hung. Restore the state storage for the IMAGE_CAPTURE path to stay consistent with the other two pickers.</violation>
</file>

<file name="cli/package.json">

<violation number="1" location="cli/package.json:2">
P1: The sync overwrote the fork's package identity with upstream Ionic values: name reverts from `@capacitor-plus/cli` to `@capacitor/cli`, and description/homepage/author revert to Ionic's, while `repository.url` and `bugs.url` in the same file still point to `Cap-go/capacitor-plus`. The repo's README and cli/README.md both state this fork publishes under the `@capacitor-plus` scope as `@capacitor-plus/cli`. Publishing with this name would collide with Ionic's already-published `@capacitor/cli` package. This looks like an accidental upstream-side conflict resolution unrelated to the SystemBars fix; restore the fork-specific metadata.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread core/package.json
@@ -1,9 +1,9 @@
{
"name": "@capacitor-plus/core",
"name": "@capacitor/core",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P0: This rename reverts the fork's package identity to upstream's Ionic-owned @capacitor/core scope and is unrelated to PR ionic-team#8636, which only touched SystemBars.java — it comes from the "upstream-preferred" conflict resolution of the sync merge. The fork cannot publish @capacitor/* (Ionic owns that npm scope), and the release tooling is hard-coded to @capacitor-plus: .github/workflows/build.yml publishes @capacitor-plus/$pkg, and scripts/sync-peer-dependencies.mjs (run by npm run version) crashes because ls().find(p => p.name === '@capacitor-plus/core') returns undefined. Restore the pr-base @capacitor-plus/core name along with the Capgo description/homepage/author.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At core/package.json, line 2:

<comment>This rename reverts the fork's package identity to upstream's Ionic-owned `@capacitor/core` scope and is unrelated to PR #8636, which only touched `SystemBars.java` — it comes from the "upstream-preferred" conflict resolution of the sync merge. The fork cannot publish `@capacitor/*` (Ionic owns that npm scope), and the release tooling is hard-coded to `@capacitor-plus`: `.github/workflows/build.yml` publishes `@capacitor-plus/$pkg`, and `scripts/sync-peer-dependencies.mjs` (run by `npm run version`) crashes because `ls().find(p => p.name === '@capacitor-plus/core')` returns `undefined`. Restore the pr-base `@capacitor-plus/core` name along with the Capgo description/homepage/author.</comment>

<file context>
@@ -1,9 +1,9 @@
 {
-  "name": "@capacitor-plus/core",
+  "name": "@capacitor/core",
   "version": "8.5.2",
-  "description": "Capacitor+: Enhanced Capacitor with automated upstream sync - Cross-platform apps with JavaScript and the web",
</file context>
Suggested change
"name": "@capacitor/core",
"name": "@capacitor-plus/core",

var token: NSObjectProtocol?
token = NotificationCenter.default.addObserver(forName: .capacitorViewDidAppear, object: nil, queue: .main) { [weak self] _ in
guard let self, Self.isBridgeReady(for: scene) else { return }
token = NotificationCenter.default.addObserver(forName: .capacitorViewDidAppear, object: nil, queue: .main) { _ in

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: This observer consumes the pending connection options on the first capacitorViewDidAppear from any scene. In a multi-scene app, another scene can trigger delivery before this scene's plugins are ready, and removing the observer prevents a later retry; retain a per-scene bridge-readiness check before removing it.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At ios/Capacitor/Capacitor/CAPSceneDelegateProxy.swift, line 24:

<comment>This observer consumes the pending connection options on the first `capacitorViewDidAppear` from any scene. In a multi-scene app, another scene can trigger delivery before this scene's plugins are ready, and removing the observer prevents a later retry; retain a per-scene bridge-readiness check before removing it.</comment>

<file context>
@@ -22,12 +21,10 @@ public class SceneDelegateProxy: NSObject, UISceneDelegate {
         var token: NSObjectProtocol?
-        token = NotificationCenter.default.addObserver(forName: .capacitorViewDidAppear, object: nil, queue: .main) { [weak self] _ in
-            guard let self, Self.isBridgeReady(for: scene) else { return }
+        token = NotificationCenter.default.addObserver(forName: .capacitorViewDidAppear, object: nil, queue: .main) { _ in
             if let token {
                 NotificationCenter.default.removeObserver(token)
</file context>

Comment thread cli/src/util/spm.ts
{
UISceneConfigurationName: 'Default Configuration',
UISceneDelegateClassName: '$(PRODUCT_MODULE_NAME).SceneDelegate',
UISceneStoryboardFile: 'Main',

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: This hardcodes Main for migrated apps whose existing plist names a different storyboard or has no main storyboard, so UIKit may fail while creating the scene. Copy the existing UIMainStoryboardFile value and omit this key when it is absent.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At cli/src/util/spm.ts, line 278:

<comment>This hardcodes `Main` for migrated apps whose existing plist names a different storyboard or has no main storyboard, so UIKit may fail while creating the scene. Copy the existing `UIMainStoryboardFile` value and omit this key when it is absent.</comment>

<file context>
@@ -275,6 +275,7 @@ export async function addSceneManifestIfNeeded(config: Config): Promise<void> {
         {
           UISceneConfigurationName: 'Default Configuration',
           UISceneDelegateClassName: '$(PRODUCT_MODULE_NAME).SceneDelegate',
+          UISceneStoryboardFile: 'Main',
         },
       ],
</file context>
Suggested change
UISceneStoryboardFile: 'Main',
...(entries['UIMainStoryboardFile']
? { UISceneStoryboardFile: entries['UIMainStoryboardFile'] }
: {}),

)
.build();

injectSafeAreaCSS(newInsets);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: The non-passthrough branch passes zeroed insets to injectSafeAreaCSS(), so CSS safe-area variables become 0px for apps using this path. Inject from the original insets instead.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At android/capacitor/src/main/java/com/getcapacitor/plugin/SystemBars.java, line 227:

<comment>The non-passthrough branch passes zeroed insets to `injectSafeAreaCSS()`, so CSS safe-area variables become `0px` for apps using this path. Inject from the original `insets` instead.</comment>

<file context>
@@ -286,9 +223,19 @@ private void initWindowInsetsListener() {
                     )
                     .build();
+
+                injectSafeAreaCSS(newInsets);
+
+                return newInsets;
</file context>
Suggested change
injectSafeAreaCSS(newInsets);
injectSafeAreaCSS(insets);

Comment thread ios/package.json
@@ -1,9 +1,9 @@
{
"name": "@capacitor-plus/ios",
"name": "@capacitor/ios",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: Same upstream-preferred conflict regression as core/android: the package reverts to Ionic's @capacitor/ios identity and loses the @capacitor-plus/core peer dependency. The fork's release tooling (scripts/sync-peer-dependencies.mjs CORE_DEPENDENTS), publish workflow (.github/workflows/build.yml publishes @capacitor-plus/$pkg), and CLI resolution (cli/src/ios/update.ts:399-409 looks up @capacitor-plus/ios) all assume the plus scope, so installing/publishing this package under the new name breaks the drop-in @capacitor-plus flow. Restore the pr-base @capacitor-plus/ios identifier, Capgo metadata, and the @capacitor-plus/core peer dependency.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At ios/package.json, line 2:

<comment>Same upstream-preferred conflict regression as core/android: the package reverts to Ionic's `@capacitor/ios` identity and loses the `@capacitor-plus/core` peer dependency. The fork's release tooling (`scripts/sync-peer-dependencies.mjs` CORE_DEPENDENTS), publish workflow (`.github/workflows/build.yml` publishes `@capacitor-plus/$pkg`), and CLI resolution (`cli/src/ios/update.ts:399-409` looks up `@capacitor-plus/ios`) all assume the plus scope, so installing/publishing this package under the new name breaks the drop-in `@capacitor-plus` flow. Restore the pr-base `@capacitor-plus/ios` identifier, Capgo metadata, and the `@capacitor-plus/core` peer dependency.</comment>

<file context>
@@ -1,9 +1,9 @@
 {
-  "name": "@capacitor-plus/ios",
+  "name": "@capacitor/ios",
   "version": "8.5.2",
-  "description": "Capacitor+: Enhanced Capacitor with automated upstream sync - Cross-platform apps with JavaScript and the web",
</file context>
Suggested change
"name": "@capacitor/ios",
"name": "@capacitor-plus/ios",

Comment thread cli/src/util/xcode.ts

const targetUuid = project.getFirstTarget().uuid;
if (project.hasFile(fileRelPath) && isSwiftFileInTargetSources(project, fileRelPath, targetUuid)) {
if (project.hasFile(fileRelPath)) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: The new early return drops the previous 'file reference exists but is not in the target Sources build phase' recovery: a pbxproj with a stale PBXFileReference (file present, build entry missing, e.g. after the App target was regenerated or a partial migrate) now silently returns {added: false} instead of re-adding the file to the Sources build phase via addToPbxBuildFileSection/addToPbxSourcesBuildPhase as before. In the migrate-uiscene flow (cli/src/tasks/migrate-uiscene.ts:68) this means such partial states are no longer repaired and SceneDelegate.swift can remain uncompiled with only a warning.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At cli/src/util/xcode.ts, line 23:

<comment>The new early return drops the previous 'file reference exists but is not in the target Sources build phase' recovery: a pbxproj with a stale `PBXFileReference` (file present, build entry missing, e.g. after the App target was regenerated or a partial migrate) now silently returns `{added: false}` instead of re-adding the file to the Sources build phase via `addToPbxBuildFileSection`/`addToPbxSourcesBuildPhase` as before. In the migrate-uiscene flow (cli/src/tasks/migrate-uiscene.ts:68) this means such partial states are no longer repaired and SceneDelegate.swift can remain uncompiled with only a warning.</comment>

<file context>
@@ -21,8 +20,7 @@ export function addSwiftFileToAppTarget(
 
-  const targetUuid = project.getFirstTarget().uuid;
-  if (project.hasFile(fileRelPath) && isSwiftFileInTargetSources(project, fileRelPath, targetUuid)) {
+  if (project.hasFile(fileRelPath)) {
     return { added: false };
   }
</file context>

observers.append(NotificationCenter.default.addObserver(forName: UIApplication.willEnterForegroundNotification, object: nil, queue: OperationQueue.main) { [weak self] _ in
guard self?.viewController?.view.window?.windowScene == nil else { return }
self?.triggerDocumentJSEvent(eventName: "resume")
observers.append(NotificationCenter.default.addObserver(forName: UIScene.willEnterForegroundNotification, object: nil, queue: OperationQueue.main) { [weak self] notification in

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: UIScene.willEnterForegroundNotification and UIScene.didEnterBackgroundNotification are now each observed twice, so the document receives resume/pause twice per transition. These two new observers fire triggerSceneLifecycleJSEvent("resume"/"pause", ...), and the pre-existing observers at lines ~272-284 (unchanged in this merge) fire triggerDocumentJSEvent("resume"/"pause") directly for the same notification and the same scene. On a normal foreground after the initial load, both paths pass and the page gets two resume events back to back (and two pause on background) — a regression from the pre-PR behavior where the scene observers were the only ones firing. The unguarded pre-existing observers also still evaluate window.Capacitor.triggerEvent(...) while the page is reloading after web-content-process termination, which is exactly the "JS Eval error" case the new guard's doc comment says it prevents, so that scenario is not actually fixed.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At ios/Capacitor/Capacitor/CapacitorBridge.swift, line 267:

<comment>`UIScene.willEnterForegroundNotification` and `UIScene.didEnterBackgroundNotification` are now each observed twice, so the document receives `resume`/`pause` twice per transition. These two new observers fire `triggerSceneLifecycleJSEvent("resume"/"pause", ...)`, and the pre-existing observers at lines ~272-284 (unchanged in this merge) fire `triggerDocumentJSEvent("resume"/"pause")` directly for the same notification and the same scene. On a normal foreground after the initial load, both paths pass and the page gets two `resume` events back to back (and two `pause` on background) — a regression from the pre-PR behavior where the scene observers were the only ones firing. The unguarded pre-existing observers also still evaluate `window.Capacitor.triggerEvent(...)` while the page is reloading after web-content-process termination, which is exactly the "JS Eval error" case the new guard's doc comment says it prevents, so that scenario is not actually fixed.</comment>

<file context>
@@ -263,13 +264,11 @@ open class CapacitorBridge: NSObject, CAPBridgeProtocol {
-            observers.append(NotificationCenter.default.addObserver(forName: UIApplication.willEnterForegroundNotification, object: nil, queue: OperationQueue.main) { [weak self] _ in
-                guard self?.viewController?.view.window?.windowScene == nil else { return }
-                self?.triggerDocumentJSEvent(eventName: "resume")
+            observers.append(NotificationCenter.default.addObserver(forName: UIScene.willEnterForegroundNotification, object: nil, queue: OperationQueue.main) { [weak self] notification in
+                self?.triggerSceneLifecycleJSEvent("resume", for: notification)
             })
</file context>

takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, imageFileUri);
takePictureIntent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION);

// Store in static variables to survive activity recreation

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Removing the static state storage breaks image-capture file chooser handling on activity recreation, and only for this one picker. showVideoCapturePicker and showFilePicker still set pendingFilePathCallback/pendingFileChooserType, so on recreation the constructor callback reaches handlePendingFileChooserResult; but showImageCapturePicker now leaves them null, so handlePendingFileChooserResult returns early and filePathCallback.onReceiveValue(...) is never called, leaving the web file input (and future file uploads) hung. Restore the state storage for the IMAGE_CAPTURE path to stay consistent with the other two pickers.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At android/capacitor/src/main/java/com/getcapacitor/BridgeWebChromeClient.java, line 416:

<comment>Removing the static state storage breaks image-capture file chooser handling on activity recreation, and only for this one picker. `showVideoCapturePicker` and `showFilePicker` still set `pendingFilePathCallback`/`pendingFileChooserType`, so on recreation the constructor callback reaches `handlePendingFileChooserResult`; but `showImageCapturePicker` now leaves them null, so `handlePendingFileChooserResult` returns early and `filePathCallback.onReceiveValue(...)` is never called, leaving the web file input (and future file uploads) hung. Restore the state storage for the IMAGE_CAPTURE path to stay consistent with the other two pickers.</comment>

<file context>
@@ -412,12 +412,6 @@ private boolean showImageCapturePicker(final ValueCallback<Uri[]> filePathCallba
-        pendingFileChooserType = FileChooserType.IMAGE_CAPTURE;
-
         activityListener = (activityResult) -> {
             Uri[] result = null;
             if (activityResult.getResultCode() == Activity.RESULT_OK) {
</file context>

});

it('skips Pods/, build/, DerivedData/, and .build/ directories', async () => {
it('skips Pods/, build/, and DerivedData/ directories', async () => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: The scanner still explicitly excludes .build, but this fixture no longer exercises that behavior. Keep the .build artifact fixture so regressions that warn on SwiftPM build output remain caught.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At cli/test/migrate-uiscene-scan.spec.ts, line 155:

<comment>The scanner still explicitly excludes `.build`, but this fixture no longer exercises that behavior. Keep the `.build` artifact fixture so regressions that warn on SwiftPM build output remain caught.</comment>

<file context>
@@ -172,19 +152,13 @@ describe('scanAndWarn', () => {
   });
 
-  it('skips Pods/, build/, DerivedData/, and .build/ directories', async () => {
+  it('skips Pods/, build/, and DerivedData/ directories', async () => {
     const podsDir = join(iosDir, 'App', 'Pods');
     const buildDir = join(iosDir, 'App', 'build');
</file context>

Comment thread CHANGELOG.md

## [8.5.1](https://github.com/Cap-go/capacitor-plus/compare/8.3.12...8.5.1) (2026-08-25)

## [8.5.2](https://github.com/ionic-team/capacitor/compare/8.5.1...8.5.2) (2026-09-11)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: This conflict resolution replaced the fork's own 8.5.1/8.5.2 release entries (Cap-go/capacitor-plus compare links, released 2026-08-25/26, listing the plus-branch CI fixes #109/#110) with upstream's release records dated 2026-08-31/2026-09-11. The version-header, issue, and commit links now all point to ionic-team/capacitor, and the @capacitor-plus packages were actually published as 8.5.2 on 2026-08-26 (per the deleted lines and pr-base). Readers can no longer tell what the fork's own 8.5.x releases contained, and clicking "8.5.2" or any fix link lands in the upstream repo instead of Cap-go/capacitor-plus. Either preserve the fork-specific entries beneath the synced notes (retaining the Cap-go links) or add a line clarifying these are upstream-mirrored records rather than the fork's published releases.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At CHANGELOG.md, line 6:

<comment>This conflict resolution replaced the fork's own 8.5.1/8.5.2 release entries (Cap-go/capacitor-plus compare links, released 2026-08-25/26, listing the plus-branch CI fixes #109/#110) with upstream's release records dated 2026-08-31/2026-09-11. The version-header, issue, and commit links now all point to `ionic-team/capacitor`, and the @capacitor-plus packages were actually published as 8.5.2 on 2026-08-26 (per the deleted lines and pr-base). Readers can no longer tell what the fork's own 8.5.x releases contained, and clicking "8.5.2" or any fix link lands in the upstream repo instead of Cap-go/capacitor-plus. Either preserve the fork-specific entries beneath the synced notes (retaining the Cap-go links) or add a line clarifying these are upstream-mirrored records rather than the fork's published releases.</comment>

<file context>
@@ -3,33 +3,29 @@
-
-## [8.5.1](https://github.com/Cap-go/capacitor-plus/compare/8.3.12...8.5.1) (2026-08-25)
-
+## [8.5.2](https://github.com/ionic-team/capacitor/compare/8.5.1...8.5.2) (2026-09-11)
 
 ### Bug Fixes
</file context>

@TorichanCapgo

Copy link
Copy Markdown

Superseded by the full upstream main sync (#190).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.