-
Notifications
You must be signed in to change notification settings - Fork 42
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
AMP web push with Automattic/newspack-plugin + OneSignal-WordPress-Plugin #272
Comments
Hi @jkasten2 👋 |
Howdy y'all, The plugin now automatically supports AMP (see PR). From the Newspack team, have you tested the latest plugin version? I believe it should work automatically but please let us know if there is other work needed to fully support the integration. |
Thanks for checking and for adding compatibility! We have a number of people using the latest version with AMP-compatibility, and it's been working well for them so far. If there is one feature request we can make it would be to have the AMP version respect the left/right settings from the WP Admin options screen. Currently it's hard-coded to the right corner. Totally not a big deal or hurry though. Feel free to close this issue. :) |
Certainly! Great to hear it's working well. I'll create a separate issue for the placement improvement. |
Thanks for opening that issue regarding bell placement! #291 |
Scope
Creating this issue to track and discuss how to make AMP web push compatible with
Automattic/newspack-plugin
andOneSignal-WordPress-Plugin
.Status
<amp-web-push>
Tag DetailsThanks to @westonruter for these details
Example of the
amp-web-push
component, configured with a custom element like so:And then there are two custom elements for subscribing and unsubscribing to the notifications:
Integration TODO:
Thanks again to @westonruter for these details
So for configuration with OneSignal, I think it's mainly a matter of just supplying the relevant URLs to
<amp-web-push>
. See an example in the Newspack plugin's yet-unmerged PR Automattic/newspack-plugin#417 which seeks to add AMP-compatible push notifications. Theamp-web-push
attributes could be set accordingly:helper-iframe-url
: https://github.com/Automattic/newspack-plugin/blob/4ef2275b580e230392a77a1c2b84d3bdc58e53b8/includes/raw_assets/html/amp-web-push-helper-frame.htmlpermission-dialog-url
: https://github.com/Automattic/newspack-plugin/blob/4ef2275b580e230392a77a1c2b84d3bdc58e53b8/includes/raw_assets/html/amp-web-push-permission-dialog.htmlservice-worker-url
: https://github.com/Automattic/newspack-plugin/blob/4ef2275b580e230392a77a1c2b84d3bdc58e53b8/includes/raw_assets/html/amp-web-push-service-worker.jsservice-worker-scope
: Since the OneSignal service worker no longer needs to control the page, then this could be a path to wherever the script is located (instead of/
).So when
amp_is_request()
returnstrue
, then that component could be rendered on the page. Iffalse
(or the function is not defined), then the plugin could continue doing what it does at present inOneSignal_Public::onesignal_header()
.See also #258.
The text was updated successfully, but these errors were encountered: