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

Add notifications #1352

Merged
merged 3 commits into from
Sep 18, 2018
Merged

Add notifications #1352

merged 3 commits into from
Sep 18, 2018

Conversation

hobinjk
Copy link
Contributor

@hobinjk hobinjk commented Sep 13, 2018

Fixes #1295

@hobinjk hobinjk self-assigned this Sep 13, 2018
@ghost ghost added the review label Sep 13, 2018
Copy link
Member

@benfrancis benfrancis left a comment

Choose a reason for hiding this comment

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

UI looks good to me!

@hobinjk hobinjk changed the title WIP: Add notifications Add notifications Sep 18, 2018
@hobinjk
Copy link
Contributor Author

hobinjk commented Sep 18, 2018

It should work! I'm not sure what it does if the to-be-notified device is asleep/unresponsive

response.status(200).json({publicKey: vapid.publicKey});
});

PushController.post('/register', async (request, response) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

General question: Is there a way to deregister?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If someone revokes the notification permission it will be removed in the sendNotification's error handler

}
async load() {
this.subscriptions = await Database.getPushSubscriptions();
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing a closing } here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Woops, meant to delete this file

*/
function NotificationEffectBlock(ruleArea, onPresentationChange, onRuleUpdate) {
RulePartBlock.call(this, ruleArea, onPresentationChange, onRuleUpdate,
'Notification', '/optimized-images/rule-icons/notification.svg');
Copy link
Contributor

Choose a reason for hiding this comment

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

Line is too long.

Copy link
Contributor

@mrstegeman mrstegeman left a comment

Choose a reason for hiding this comment

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

This is very cool. My only nitpick is that the if/while selector is still enabled when setting a notification, but I can't actually change it.

@codecov-io
Copy link

Codecov Report

Merging #1352 into master will increase coverage by 0.16%.
The diff coverage is 50%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1352      +/-   ##
==========================================
+ Coverage    75.3%   75.46%   +0.16%     
==========================================
  Files         123      125       +2     
  Lines        5989     6225     +236     
  Branches      842      885      +43     
==========================================
+ Hits         4510     4698     +188     
- Misses       1306     1353      +47     
- Partials      173      174       +1
Impacted Files Coverage Δ
src/rules-engine/effects/index.js 100% <ø> (ø) ⬆️
src/controllers/settings_controller.js 34.3% <0%> (+2.91%) ⬆️
src/constants.js 100% <100%> (ø) ⬆️
src/rules-engine/effects/NotificationEffect.js 36.36% <36.36%> (ø)
src/controllers/push_controller.js 58.62% <58.62%> (ø)
src/db.js 75.53% <6.66%> (-6.55%) ⬇️
src/router.js 96.42% <66.66%> (-1.69%) ⬇️
src/models/settings.js 71.05% <77.77%> (+16.05%) ⬆️
src/controllers/logs_controller.js 85.48% <0%> (-10.95%) ⬇️
src/models/thing.js 67.32% <0%> (-1.31%) ⬇️
... and 9 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update aeae87e...b6659c2. Read the comment docs.

@hobinjk
Copy link
Contributor Author

hobinjk commented Sep 18, 2018

Yeah, the if/while thing is just a drawback of a different part of the rules engine that I can fix in a different PR

@hobinjk hobinjk merged commit b248938 into WebThingsIO:master Sep 18, 2018
@ghost ghost removed the review label Sep 18, 2018
@hobinjk hobinjk deleted the rules-alerts branch September 18, 2018 22:00
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.

4 participants