Skip to content
Snippets Groups Projects
Commit 0b7a8ecd authored by Greg Fodor's avatar Greg Fodor
Browse files

Deal with weird chrome state

parent 3bda3afe
No related branches found
No related tags found
No related merge requests found
......@@ -50,7 +50,11 @@ export default class Subscriptions {
// registration becomes null if failed, non null if registered
while (this.registration === undefined) await nextTick();
if (!this.registration || !this.registration.pushManager) return null;
if ((await this.registration.pushManager.permissionState()) !== "granted") return null;
try {
if ((await this.registration.pushManager.permissionState()) !== "granted") return null;
} catch (e) {
return null; // Chrome can throw here complaining about userVisible if push is not right
}
const sub = await this.registration.pushManager.getSubscription();
if (!sub) return null;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment