mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-24 00:39:32 +09:00
Fix #4421
This commit is contained in:
parent
2782e7d26f
commit
0b27d8a717
@ -172,7 +172,11 @@ export default class MiOS extends EventEmitter {
|
|||||||
callback();
|
callback();
|
||||||
|
|
||||||
// Init service worker
|
// 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
|
* Register service worker
|
||||||
*/
|
*/
|
||||||
@autobind
|
@autobind
|
||||||
private registerSw() {
|
private registerSw(swPublickey) {
|
||||||
// Check whether service worker and push manager supported
|
// Check whether service worker and push manager supported
|
||||||
const isSwSupported =
|
const isSwSupported =
|
||||||
('serviceWorker' in navigator) && ('PushManager' in window);
|
('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
|
// A public key your push server will use to send
|
||||||
// messages to client apps via a push server.
|
// messages to client apps via a push server.
|
||||||
applicationServerKey: urlBase64ToUint8Array(this.meta.data.swPublickey)
|
applicationServerKey: urlBase64ToUint8Array(swPublickey)
|
||||||
};
|
};
|
||||||
|
|
||||||
// Subscribe push notification
|
// Subscribe push notification
|
||||||
|
Loading…
Reference in New Issue
Block a user