Skip to content

Commit

Permalink
Expose env-dependent constant to service worker; Add Brave Browser-sp…
Browse files Browse the repository at this point in the history
…ecific push registration error and guidance; Remove unused fetch debug plugin
  • Loading branch information
Soxasora committed Mar 6, 2025
1 parent 75d0a8e commit b133df8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
9 changes: 8 additions & 1 deletion components/notifications.js
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,10 @@ export function NotificationAlert () {
const [supported, setSupported] = useState(false)
const sw = useServiceWorker()

useEffect(() => {
console.log(error)
}, [error])

useEffect(() => {
const isSupported = sw.support.serviceWorker && sw.support.pushManager && sw.support.notification
if (isSupported) {
Expand All @@ -733,7 +737,10 @@ export function NotificationAlert () {
error
? (
<Alert variant='danger' dismissible onClose={() => setError(null)}>
<span>{error.toString()}</span>
<span>{navigator?.brave && error.name === 'AbortError'
? 'Push registration failed. Enable "Use Google services for push messaging" in Brave\'s privacy settings and try again.'
: error.toString()}
</span>
</Alert>
)
: showAlert
Expand Down
1 change: 1 addition & 0 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ module.exports = withPlausibleProxy()({
'process.env.NEXT_PUBLIC_NORMAL_POLL_INTERVAL': JSON.stringify(process.env.NEXT_PUBLIC_NORMAL_POLL_INTERVAL),
'process.env.NEXT_PUBLIC_LONG_POLL_INTERVAL': JSON.stringify(process.env.NEXT_PUBLIC_LONG_POLL_INTERVAL),
'process.env.NEXT_PUBLIC_EXTRA_LONG_POLL_INTERVAL': JSON.stringify(process.env.NEXT_PUBLIC_EXTRA_LONG_POLL_INTERVAL),
'process.env.SANCTIONED_COUNTRY_CODES': JSON.stringify(process.env.SANCTIONED_COUNTRY_CODES),
'process.env.NEXT_IS_EXPORT_WORKER': 'true'
})
]
Expand Down
4 changes: 0 additions & 4 deletions sw/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ self.addEventListener('install', () => self.skipWaiting())
// Also, the offline fallback only works if request matched a route
setDefaultHandler(new NetworkOnly({
plugins: [{
fetchDidFail: async (args) => {
// tell us why a request failed in dev
process.env.NODE_ENV !== 'production' && console.log('fetch did fail', ...args)
},
fetchDidSucceed: async ({ request, response, event, state }) => {
if (
response.ok &&
Expand Down

0 comments on commit b133df8

Please sign in to comment.