Skip to content
Snippets Groups Projects
Unverified Commit 0b27d8a7 authored by syuilo's avatar syuilo
Browse files

Fix #4421

parent 2782e7d2
No related branches found
No related tags found
No related merge requests found
......@@ -172,7 +172,11 @@ export default class MiOS extends EventEmitter {
callback();
// Init service worker
if (this.shouldRegisterSw) this.registerSw();
if (this.shouldRegisterSw) {
this.getMeta().then(data => {
this.registerSw(data.swPublickey);
});
}
};
// キャッシュがあったとき
......@@ -302,7 +306,7 @@ export default class MiOS extends EventEmitter {
* Register service worker
*/
@autobind
private registerSw() {
private registerSw(swPublickey) {
// Check whether service worker and push manager supported
const isSwSupported =
('serviceWorker' in navigator) && ('PushManager' in window);
......@@ -328,7 +332,7 @@ export default class MiOS extends EventEmitter {
// A public key your push server will use to send
// messages to client apps via a push server.
applicationServerKey: urlBase64ToUint8Array(this.meta.data.swPublickey)
applicationServerKey: urlBase64ToUint8Array(swPublickey)
};
// Subscribe push notification
......
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