Commit graph

309 commits

Author SHA1 Message Date
nimbleghost 4828e3a691 Add preference 2023-06-28 17:39:44 +02:00
nimbleghost e607944ad1 Update colors 2023-06-28 17:20:01 +02:00
nimbleghost 4f39c7c155 Implement dark mode
Resolves #206
2023-06-28 16:52:35 +02:00
nimbleghost 95cfe16676 Add background notif text to subscribe dialog
only when web push is enabled
2023-06-28 08:57:57 +02:00
nimbleghost dabb6a481f Add server name to background notification setting 2023-06-28 08:44:05 +02:00
Philipp C. Heckel 0b3e268f2c
Merge pull request #784 from nimbleghost/pref-responsive
Web app UI: make preferences responsive
2023-06-26 20:45:07 -04:00
binwiederhier 12df164245 Formatting 2023-06-26 20:38:18 -04:00
nimbleghost d51ca20992 Use dvh for main height
This takes into account browser UI for the viewport calculation
2023-06-26 23:36:04 +02:00
nimbleghost 4a1adaeab2 Make login and sign up form responsive 2023-06-26 23:34:22 +02:00
nimbleghost fd5bfd161d Web app UI: make preferences responsive 2023-06-26 23:19:58 +02:00
nimbleghost 175ab5ea76 Fix: refresh web push pref on standalone change 2023-06-26 08:56:07 +02:00
binwiederhier 5627097a6c Remove WebPush.js, move to hooks.js; add docblocks 2023-06-25 21:46:26 -04:00
binwiederhier 94fb23ba17 Style changes 2023-06-25 21:10:25 -04:00
nimbleghost 833293ad77 Set PWA web push enabled on launch instead 2023-06-25 22:00:45 +02:00
nimbleghost a8d3297c4e Correctly handle standalone (PWA) mode changes
- Also handle notification permission changes
- Remove web push schedule worker since this complicates
  things and doesn’t do _that_ much. We have the reminder
  notification if the user truly doesn’t reload ntfy in
  more than a week.
2023-06-25 21:25:52 +02:00
nimbleghost 48d1f7887d Default web push to enabled on PWAs 2023-06-24 20:22:34 +02:00
nimbleghost 30a8f66db2 Reorder start/stopWorkers 2023-06-17 22:32:24 +02:00
nimbleghost 9ba733d4e0 Add a reload button to error boundary
There are sometimes edge cases on iOS which cause the app to crash,
it’s good to have a reload button as there’s no browser chrome (reload,
back, forward) in an iOS standalone PWA.
2023-06-17 22:15:02 +02:00
nimbleghost b197ea3ab6 Use the same notification pipeline everywhere
This means less duplication and `actions` support for all
notifications.
2023-06-15 00:43:18 +02:00
nimbleghost 83eb4c39e5 Add i18n to service worker 2023-06-14 20:58:58 +02:00
nimbleghost e2120bc66d Improve WebPushEnabled conditional display 2023-06-14 14:33:35 +02:00
nimbleghost 67b9d2eaf6 Add missing await 2023-06-14 14:31:34 +02:00
binwiederhier 7083ed9f6b Move websocketSubscriptions to useConnectionListeners 2023-06-14 08:18:55 -04:00
binwiederhier 790fd43369 Tiny changes 2023-06-14 08:04:16 -04:00
binwiederhier 6b38499bdc Revert alert text and button, and warning 2023-06-13 22:03:00 -04:00
nimbleghost 390d42c607 Format & fix lint 2023-06-13 14:02:54 +02:00
nimbleghost 8ccfa5c3fb Fix session replica behaviour (merge with session)
The harder-to-refactor parts are the places where exists/username/token
are called within a React component. However, `resetAndRedirect` and
`store` are already called from async contexts, so adding an `await`
is simple.

This thus merges the logic, keeping localStorage for the components to
call, but making sure reset/store behaviour works correctly for the
replica.
2023-06-13 14:00:51 +02:00
binwiederhier eb220544a3 Change wording in prefs based on setting 2023-06-10 20:51:24 -04:00
binwiederhier 9d5556c7f5 Rename things, add comments 2023-06-10 20:42:02 -04:00
binwiederhier 2e8292a65f No real changes, just renames 2023-06-09 14:32:34 -04:00
binwiederhier 75a4b5bd88 Small refactor 2023-06-08 12:20:12 -04:00
nimbleghost 46798ac322 Make web push toggle global 2023-06-08 10:46:51 +02:00
nimbleghost 03aa67ed68 Remove webPushDefaultEnabled 2023-06-07 21:09:13 +02:00
nimbleghost 0f0074cbab Implement push subscription expiry 2023-06-07 21:09:13 +02:00
nimbleghost 47ad024ec7 Simplify web push UX and updates
- Use a single endpoint
- Use a declarative web push sync hook. This thus handles all edge cases
  that had to be manually handled before: logout, login, account sync,
  etc.
- Simplify UX: browser notifications are always enabled (unless denied),
  web push toggle only shows up if permissions are already granted.
2023-06-07 20:38:21 +02:00
nimbleghost 7aa3d8f59b Hide web push toggles if disabled on server 2023-06-07 20:38:21 +02:00
nimbleghost 4648f83669 Format emojis in the service worker directly 2023-06-07 20:38:21 +02:00
nimbleghost ff5c854192 Add PWA, service worker and Web Push
- Use new notification request/opt-in flow for push
- Implement unsubscribing
- Implement muting
- Implement emojis in title
- Add iOS specific PWA warning
- Don’t use websockets when web push is enabled
- Fix duplicate notifications
- Implement default web push setting
- Implement changing subscription type
- Implement web push subscription refresh
- Implement web push notification click
2023-06-07 20:38:20 +02:00
nimbleghost 453bf435b0 Fix account sync race condition 2023-05-31 19:37:29 +02:00
nimbleghost da17e4ee8a Make small code style improvements 2023-05-25 07:17:05 +02:00
nimbleghost d178be7576 Fix param reassignment issue 2023-05-25 07:17:05 +02:00
binwiederhier a90bd4cd06 Formatting, npm update 2023-05-24 21:44:12 -04:00
binwiederhier d1e59fe08c Merge branch 'main' into switch-to-vite 2023-05-24 21:37:28 -04:00
binwiederhier b7c121e78e Revert inputProps things 2023-05-24 21:32:15 -04:00
nimbleghost d625a003b8 Use esm mui imports for Vite compatibility
See: https://github.com/mui/material-ui/issues/31835#issuecomment-1153393901
2023-05-24 22:16:10 +02:00
nimbleghost 7ccc5be9b4 Fix jsx key issue 2023-05-24 21:10:09 +02:00
nimbleghost 9ebeb7f12f Fix mui inputProps 2023-05-24 21:08:33 +02:00
nimbleghost 59011c8a32 Make manual eslint fixes
These are safe fixes, more complicated fixes can be done separately
(just disabled those errors for now).

- Reorder declarations to fix `no-use-before-define`
- Rename parameters for `no-shadow`
- Remove unused parameters, functions, imports
- Switch from `++` and `—` to `+= 1` and `-= 1` for `no-unary`
- Use object spreading instead of parameter reassignment in auth utils
- Use `window.location` instead of `location` global
- Use inline JSX strings instead of unescaped values
-
2023-05-24 12:58:48 +02:00
nimbleghost 8319f1cf26 Run eslint autofixes 2023-05-24 12:51:53 +02:00
nimbleghost f558b4dbe9 Add .jsx filename extension
(This is also required for Vite later)
2023-05-24 12:51:53 +02:00