Page MenuHomePhabricator

[web] Register service worker for notifs

Authored by michal on Feb 21 2023, 9:12 AM.
Referenced Files
Unknown Object (File)
Sat, Mar 11, 10:20 AM
Unknown Object (File)
Sat, Mar 11, 5:40 AM
Unknown Object (File)
Wed, Mar 8, 10:30 AM
Unknown Object (File)
Sun, Mar 5, 5:04 AM
Unknown Object (File)
Sun, Mar 5, 3:18 AM
Unknown Object (File)
Sat, Mar 4, 10:38 PM
Unknown Object (File)
Sat, Mar 4, 2:03 PM
Unknown Object (File)
Fri, Mar 3, 6:05 PM



We need to register a service worker to get push notifs from the browser. This diff registers the service worker from the endpoint exposed by the keyserver in one of the previous diffs on page load. For now this service worker only logs when installing and activating.

Test Plan
  • check if service worker is correctly registered (you can check that in the browser's dev tools)
  • check that the service worker is correctly updated after changing the service worker file

Diff Detail

rCOMM Comm
Lint Not Applicable
Tests Not Applicable

Event Timeline

Harbormaster returned this revision to the author for changes because remote builds failed.Feb 21 2023, 9:26 AM
Harbormaster failed remote builds in B16714: Diff 22868!
ashoat requested changes to this revision.Feb 22 2023, 11:16 AM

Confused why this needs to be a React component

7 ↗(On Diff #22920)

Is there a reason this needs to be in a React component? What if we just called this from the global scope?

16 ↗(On Diff #22920)

Just wondering... what does ESLint think is missing here? Based on my intuition about this ESLint rule, I would guess it thinks navigator and electron are both global/imported so don't need to be in the dep list

This revision now requires changes to proceed.Feb 22 2023, 11:16 AM

Moved eslint annotation to a later diff.

7 ↗(On Diff #22920)

While right now it's just using global objects, in the later diffs there are react hooks added inside this component.

16 ↗(On Diff #22920)

Sorry, I just forgot to put this in the correct diff when splitting this into multiple diffs. I'm going to move it the diffs that need this annotation.

This revision is now accepted and ready to land.Feb 24 2023, 3:13 PM