-
Notifications
You must be signed in to change notification settings - Fork 412
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
Fixing NotificationsList on Service Worker #8686
base: develop
Are you sure you want to change the base?
Fixing NotificationsList on Service Worker #8686
Conversation
✅ Deploy Preview for care-ohc ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
LGTM |
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.
@vishwansh01 the logic looks, just some suggestions on readability
setIsSubscribed("SubscribedOnThisDevice"); | ||
} else { | ||
setIsSubscribed("SubscribedOnAnotherDevice"); | ||
try { |
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.
we already have a try on line 223, this can be removed
if ( | ||
navigator.serviceWorker !== null && | ||
navigator.serviceWorker !== undefined | ||
) { | ||
if ( | ||
status === "NotSubscribed" || | ||
status === "SubscribedOnAnotherDevice" | ||
) { | ||
subscribe(); | ||
} else { | ||
unsubscribe(); | ||
} |
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.
This is a bit hard to follow, let's re-write it
if ( | |
navigator.serviceWorker !== null && | |
navigator.serviceWorker !== undefined | |
) { | |
if ( | |
status === "NotSubscribed" || | |
status === "SubscribedOnAnotherDevice" | |
) { | |
subscribe(); | |
} else { | |
unsubscribe(); | |
} | |
if (!navigator.serviceWorker) { | |
return; | |
} | |
if (["NotSubscribed", "SubscribedOnAnotherDevice"].includes(status)) { | |
subscribe(); | |
} else { | |
unsubscribe(); | |
} |
pf_p256dh: "", | ||
pf_auth: "", | ||
}; | ||
if (reg.pushManager !== null && reg.pushManager !== undefined) { |
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.
same here too, let's negate the logic and return (similar to the previous comment), that makes it more readable
@vishwansh01 can you update the status here? |
Hey @bodhish, Since @vishwansh01 hasn’t responded to the requested changes on the PR, can I create a new PR for this issue if he remains inactive? |
Proposed Changes
@ohcnetwork/care-fe-code-reviewers
Merge Checklist