Merge branch 'fix-push-notifications-safari' into 'master'
Fix Notifications page broken page on Safari Closes #772 See merge request framasoft/mobilizon!991
This commit is contained in:
commit
9b6aee0102
@ -50,7 +50,7 @@ export async function unsubscribeUserToPush(): Promise<string | undefined> {
|
||||
console.log("performing unsubscribeUserToPush");
|
||||
const registration = await navigator.serviceWorker.ready;
|
||||
console.log("found registration", registration);
|
||||
const subscription = await registration.pushManager.getSubscription();
|
||||
const subscription = await registration.pushManager?.getSubscription();
|
||||
console.log("found subscription", subscription);
|
||||
if (subscription && (await subscription?.unsubscribe()) === true) {
|
||||
console.log("done unsubscription");
|
||||
|
@ -715,7 +715,7 @@ export default class Notifications extends Vue {
|
||||
private async isSubscribed(): Promise<boolean> {
|
||||
if (!("serviceWorker" in navigator)) return Promise.resolve(false);
|
||||
const registration = await navigator.serviceWorker.getRegistration();
|
||||
return (await registration?.pushManager.getSubscription()) != null;
|
||||
return (await registration?.pushManager?.getSubscription()) != null;
|
||||
}
|
||||
|
||||
private async deleteFeedToken(token: string): Promise<void> {
|
||||
|
Loading…
Reference in New Issue
Block a user