-
Notifications
You must be signed in to change notification settings - Fork 49
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
Push Notifications #417
Push Notifications #417
Conversation
2442b78
to
ca60a86
Compare
includes/class-pwa.php
Outdated
layout="nodisplay" | ||
helper-iframe-url="<?php echo esc_url( $base ); ?>/helper-iframe.html?appId=<?php echo esc_attr( $one_signal_api_key ); ?>" | ||
permission-dialog-url="<?php echo esc_url( $base ); ?>/permission-dialog.html?appId=<?php echo esc_attr( $one_signal_api_key ); ?>" | ||
service-worker-url="<?php echo esc_url( $base ); ?>/service-worker.js?appId=<?php echo esc_attr( $one_signal_api_key ); ?>" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
service-worker-url="<?php echo esc_url( $base ); ?>/service-worker.js?appId=<?php echo esc_attr( $one_signal_api_key ); ?>" | |
service-worker-url="<?php echo esc_url( $base ); ?>/service-worker.js?appId=<?php echo esc_attr( $one_signal_api_key ); ?>" | |
service-worker-scope="<?php echo esc_url( trailingslashit( $base ) ); ?>" |
I wonder if this PR should end up being merged if it works? Perhaps it should rather be upstreamed as part of OneSignal/OneSignal-WordPress-Plugin#187? |
ca60a86
to
ba261de
Compare
b47c96b
to
5dbdabe
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works as advertised, there're just some nitpicky linting errors. Also, Weston's suggestion to add service-worker-scope
seems reasonable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On this screen:
- I've just clicked on the toggle button to enable the push notifications and I get a
[object Object]
in both inputs. - It needs some sort of
help
text to explain how to get the App ID and API key with a link to One Signal (or in the future to the documentation page of this feature on our website)
- It would be nice to have the option to change the copy of both buttons.
- Why do we display both buttons but use
visibility: hidden
to hide one of the two? Visually it creates a massive gap. If we have to "display" both, can we at least usedisplay: none
? - I'd definitely suggest a block to make this feature a bit more flexible within the content.
How should we style to make it a more palatable experience?
Quite frankly I'm not sure. This looks terrible 😂 Can we reduce the window size? Also if you click on the x
to close the pop-up, the window doesn't close... it's just so bad.
When AMP is set to Transitional or Reader, we get this pop-up at the top of the screen. Looks like it's coming from One Signal. Can we style it so it doesn't look so out-of-place? Right now, all I can think is a fake spam advert with the big ugly icon.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall this PR looks great, just a few nits and questions! Thanks for taking the time to integrate OneSignal directly in this plugin.
includes/class-pwa.php
Outdated
$path = null; | ||
|
||
if ( substr( $raw_uri, 0, strlen( '/helper-iframe.html' ) ) === '/helper-iframe.html' ) { | ||
$path = dirname( NEWSPACK_PLUGIN_FILE ) . '/assets/raw/amp-web-push-helper-frame.html'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interested to know why not use /assets/raw/amp-web-push-helper-frame.html
directly with the <amp-web-push>
tag? Instead of going through /helper-iframe.html
then mapping it.
if ( ! $this->is_configured() ) { | ||
return $this->unconfigured_error(); | ||
} | ||
$settings = \OneSignal::get_onesignal_settings(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since you are using OneSignal::save_onesignal_settings()
and OneSignal::get_onesignal_settings()
we will make a note that these are public interfaces should not change in the OneSignal-WordPress-Plugin
repo.
b781c32
to
e604134
Compare
…ml and /permission-dialog.htmfeat: render required push notification html files: /helper-iframe.html and /permission-dialog.htmll
this was brought up in client validation, not in AMP-WP validator, for some reason
…-web-push implementation.
…nected to onesignal plugin.
…tion subscribe UI.
…d by status of plugin install.
Move push notification html files from assets to includes directory. assets is no longer included in release archives.
7067221
to
397965e
Compare
@@ -16,6 +16,13 @@ | |||
*/ | |||
class PWA { | |||
|
|||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rgomezp this commit adds the service worker scope you recommended.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jeffersonrabb Looks good to me!
Closing for now in favour of #1076 |
All Submissions:
Changes proposed in this Pull Request:
Implements basic support for AMP-compatible Push Notifications using One Signal. This PR still has some rough edges but is ready for review/discussion.
Video demo of subscribing: https://cloudup.com/cyyfKRs0tG7
How to test the changes in this Pull Request:
Open Questions
Other information: