Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(android)!: Make service worker requests go through Capacitor bridge #7764

Merged
merged 11 commits into from
Dec 18, 2024

Conversation

jcesarmobile
Copy link
Member

@jcesarmobile jcesarmobile commented Nov 18, 2024

Marking it as breaking as some users might already have a similar code in their MainActivity file or in some plugin and will need to remove that code/plugin or disable Capacitor's registration if they want to keep their own handling.

feat(android)!: automatically register service workers

WIP

chore(android): Update default value for androidxCoreVersion (#7750)

chore(ci): use macos-15 (#7758)

refactor(core)!: Remove deprecated plugin methods/properties (#7749)

fix
@jcesarmobile jcesarmobile changed the title feat(android)!: automatically register service workers feat(android)!: Make service worker requests go through Capacitor bridge Nov 18, 2024
@markemer
Copy link
Member

Is there are good way to test this is working?

@jcesarmobile
Copy link
Member Author

You can use https://github.com/jcesarmobile/app-capable which I created for a different thing, but exposes the problem (it doesn't have platforms added, you'll need to add android to test)
Or also this one from an user
https://github.com/radonirinamaminiaina/capacitor-sw

You'll see this error in logcat
File: https://localhost/main.9677d6e520b8922e.js - Line 1 - Msg: Service worker registration failed with: TypeError: Failed to register a ServiceWorker for scope ('https://localhost/') with script ('https://localhost/ngsw-worker.js'): An unknown error occurred when fetching the script.

With this change applied the error is gone

@jcesarmobile jcesarmobile merged commit 4999cbe into main Dec 18, 2024
6 checks passed
@jcesarmobile jcesarmobile deleted the RDMR-298 branch December 18, 2024 18:03
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.

3 participants