Skip to content

chore: sync upstream PR #8683 - fix(android): skip lifecycle events when the Capacitor bridge is not present - #216

Closed
riderx wants to merge 57 commits into
plusfrom
sync/upstream-pr-8683
Closed

riderx wants to merge 57 commits into
plusfrom
sync/upstream-pr-8683

Conversation

@riderx

@riderx riderx commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

Merge Conflict Review Required

The sync of upstream PR ionic-team#8683 from @alexgerardojacinto encountered merge conflicts.

Original PR: ionic-team#8683

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.

View guided diff Turn on auto-fix

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>
Github Workflow (on behalf of OS-pedrogustavobilro) and others added 15 commits October 7, 2026 14:17
…8674)

Co-authored-by: Mark Anderson <mark.anderson@outsystems.com>
Adds a catalog-info.yaml so Capacitor and its core, cli, android, and ios packages show up in OutSystems' Backstage software catalog.
@riderx

riderx commented Oct 29, 2026

Copy link
Copy Markdown
Member Author

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-30T06:06:48.132414Z f98243f New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Oct 29, 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 3 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
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: d7d74fb5-270e-4412-a4d2-6c5d24eeb95c
Commits

Reviewing files that changed from the base of the PR and between cc067ab and f98243f.

Files selected for processing: 58
  • .github/workflows/ci.yml
  • .gitignore
  • CHANGELOG.md
  • android/CHANGELOG.md
  • android/capacitor/proguard-rules.pro
  • 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/main/java/com/getcapacitor/plugin/util/CapacitorHttpUrlConnection.java
  • android/capacitor/src/main/java/com/getcapacitor/plugin/util/HttpRequestHandler.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
  • catalog-info.yaml
  • cli/CHANGELOG.md
  • cli/package.json
  • cli/src/declarations.ts
  • cli/src/index.ts
  • cli/src/ios/update.ts
  • cli/src/tasks/copy.ts
  • cli/src/tasks/doctor.ts
  • cli/src/tasks/migrate-uiscene.ts
  • cli/src/tasks/migrate.ts
  • cli/src/tasks/run.ts
  • cli/src/telemetry.ts
  • cli/src/util/node.ts
  • cli/src/util/npm.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/npm.spec.ts
  • cli/test/telemetry.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
  • lerna.json
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@github-actions

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.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread core/package.json Outdated
@@ -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.

P1 Badge Preserve the Capacitor+ package names

Renaming the workspace packages from @capacitor-plus/* to @capacitor/* breaks the existing release setup. In particular, scripts/sync-peer-dependencies.mjs still searches for @capacitor-plus/core and immediately reads corePkg.version, so the root version hook now fails because that package no longer exists. All four package manifests change scope here; retain the fork's names so releases continue updating and publishing the packages its consumers use.

Useful? React with 👍 / 👎.

Comment on lines +267 to +271
observers.append(NotificationCenter.default.addObserver(forName: UIScene.willEnterForegroundNotification, object: nil, queue: OperationQueue.main) { [weak self] notification in
self?.triggerSceneLifecycleJSEvent("resume", for: notification)
})
observers.append(NotificationCenter.default.addObserver(forName: UIApplication.didEnterBackgroundNotification, object: nil, queue: OperationQueue.main) { [weak self] _ in
guard self?.viewController?.view.window?.windowScene == nil else { return }
self?.triggerDocumentJSEvent(eventName: "pause")
observers.append(NotificationCenter.default.addObserver(forName: UIScene.didEnterBackgroundNotification, object: nil, queue: OperationQueue.main) { [weak self] notification in
self?.triggerSceneLifecycleJSEvent("pause", for: notification)

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 Badge Replace the existing scene observers instead of adding duplicates

For UIScene apps without Cordova plugins, a foreground or background transition after the page loads now dispatches resume or pause twice: these new observers call triggerSceneLifecycleJSEvent, while the existing scene observers immediately below still call triggerDocumentJSEvent for the same notification. This can run application resume/pause side effects twice, and the unguarded observers also preserve the cold-start JavaScript evaluation problem this helper is intended to prevent. Consolidate each notification into one guarded observer.

Useful? React with 👍 / 👎.

Comment on lines 413 to 415
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
pendingFilePathCallback = filePathCallback;
pendingImageFileUri = imageFileUri;
pendingFileChooserType = FileChooserType.IMAGE_CAPTURE;

activityListener = (activityResult) -> {

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 Badge Keep image-capture state available after activity recreation

When an HTML image-capture input opens the camera and Android recreates the host activity before returning, the new BridgeWebChromeClient has no instance activityListener. Its result handler relies on pendingFilePathCallback and pendingImageFileUri in that case, but this change removes their initialization for image capture. The camera result is consequently ignored and the file-input callback never completes. Preserve the pending-state assignments, as the video and file-picker paths still do.

Useful? React with 👍 / 👎.

Comment thread cli/src/tasks/migrate-uiscene.ts Outdated
Comment on lines +251 to +254
while (i < source.length && depth > 0) {
const ch = source[i];
if (ch === '{') depth++;
else if (ch === '}') depth--;

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 Badge Ignore strings and comments when locating the AppDelegate end

For an otherwise eligible UIScene migration whose AppDelegate contains an unmatched brace inside a string or comment, this replacement counts that brace as Swift structure and can insert the generated method inside existing code. For example, an AppDelegate containing let marker = "}" receives the configuration method inside that string literal, corrupting the source file. The previous scanner skipped strings and comments; retain that behavior when finding the insertion point.

Useful? React with 👍 / 👎.

Comment thread cli/src/tasks/run.ts
Comment on lines 121 to 124
} catch (e: any) {
if (options.liveReload) {
await CapLiveReloadHelper.revertCapConfigForLiveReload();
if (liveReloadManifestUpdated && platformName === config.android.name && cordovaPlugins) {
await writeCordovaAndroidManifest(cordovaPlugins, config, platformName, false);
}
}

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 Badge Restore the Android manifest when live reload fails

If an Android live-reload run fails after writeCordovaAndroidManifest(..., true) succeeds, this catch block now restores only the Capacitor config. The generated Cordova manifest retains android:usesCleartextTraffic="true" even when the project's normal server.cleartext setting is false. A subsequent native build without another sync/copy can therefore include the temporary cleartext allowance. Restore the manifest here using the same guarded cleanup retained in the SIGINT handler.

Useful? React with 👍 / 👎.

Comment thread .github/workflows/ci.yml Outdated
setup:
runs-on: ubuntu-latest
timeout-minutes: 10
timeout-minutes: 30

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 Badge Keep CI job timeouts within the documented ten-minute cap

The checked .github/workflows/ci.yml changes all six job timeouts from 10 to 30 minutes. This directly violates the Timeout Policy in AGENTS.md, which explicitly caps GitHub Actions jobs at ten minutes unless requested otherwise; no such exception was requested here. Restore these values to 10 or lower so stalled jobs remain bounded by the repository's required limit.

AGENTS.md reference: AGENTS.md:L127-L129

Useful? React with 👍 / 👎.

@riderx
riderx force-pushed the sync/upstream-pr-8683 branch from 4cd5bb7 to f98243f Compare October 30, 2026 06:03
@riderx

riderx commented Oct 30, 2026

Copy link
Copy Markdown
Member Author

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

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f98243f154

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread cli/src/util/xcode.ts Outdated
Comment on lines 23 to 24
if (project.hasFile(fileRelPath)) {
return { added: false };

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 Badge Check target membership before skipping Swift file registration

For a pre-UIScene project with a stale PBXFileReference for SceneDelegate.swift, but no corresponding file or Sources build-phase entry, readDetectionSignals still classifies the project as eligible. Migration then creates the file and adds SceneDelegate.self to AppDelegate, but this early return leaves SceneDelegate outside the compilation target, so the migrated app cannot build. Preserve the previous target-membership check and repair the Sources entry instead of treating any file reference as complete registration.

Useful? React with 👍 / 👎.

Comment thread cli/src/telemetry.ts Outdated
`${k.replace(/^@capacitor-plus\//, '').replace(/-/g, '_')}_version`,
v,
const versions = capacitorPackages.map(([k, v]): [string, string] => [
`${k.replace(/^@capacitor\//, '').replace(/-/g, '_')}_version`,

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 Badge Strip the same package scope that the telemetry filter selects

For applications using @capacitor-plus/* dependencies, the filter immediately above still selects only that scope, but this replacement now strips @capacitor/ instead. Consequently, @capacitor-plus/core produces @capacitor_plus/core_version rather than the existing core_version field, and the other package-version fields change similarly. This silently changes the emitted telemetry schema instead of merely sanitizing version values; retain the matching @capacitor-plus/ replacement.

Useful? React with 👍 / 👎.

cursoragent and others added 2 commits November 6, 2026 14:04
Co-authored-by: Martin DONADIEU <martindonadieu@gmail.com>
Co-authored-by: Martin DONADIEU <martindonadieu@gmail.com>
@TorichanCapgo

Copy link
Copy Markdown

Already landed on plus, closing as superseded.

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.