@social-mail/social-mail-client 1.2.71 → 1.2.73
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/content/pwa/service-worker.js +3 -2
- package/dist/services/WebPushService.d.ts.map +1 -1
- package/dist/services/WebPushService.js +1 -21
- package/dist/services/WebPushService.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/web/AppIndex.pack.js +1 -21
- package/dist/web/AppIndex.pack.js.map +1 -1
- package/dist/web/AppIndex.pack.min.js +1 -1
- package/dist/web/AppIndex.pack.min.js.map +1 -1
- package/package.json +1 -1
- package/src/services/WebPushService.ts +2 -22
package/package.json
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable no-console */
|
|
1
2
|
import DITransient from "@web-atoms/core/dist/di/DITransient";
|
|
2
3
|
import { Inject } from "@web-atoms/core/dist/di/Inject";
|
|
3
4
|
import EntityService from "./EntityService";
|
|
@@ -47,30 +48,9 @@ export default class WebPushService {
|
|
|
47
48
|
return s;
|
|
48
49
|
}
|
|
49
50
|
async updateRegistration(s: PushSubscription) {
|
|
50
|
-
const endpoint = s.endpoint;
|
|
51
|
-
const expirationTime = s.expirationTime;
|
|
52
51
|
|
|
53
|
-
const toHex = (a: ArrayBuffer) => {
|
|
54
|
-
let n = "";
|
|
55
|
-
const u = new Uint8Array(a);
|
|
56
|
-
for (const iterator of u) {
|
|
57
|
-
n += iterator.toString(16).padStart(2, '0');
|
|
58
|
-
}
|
|
59
|
-
return n;
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
const p256dh = toHex(s.getKey("p256dh"));
|
|
63
|
-
const auth = toHex(s.getKey("auth"));
|
|
64
|
-
const json = {
|
|
65
|
-
endpoint,
|
|
66
|
-
expirationTime,
|
|
67
|
-
keys: {
|
|
68
|
-
p256dh,
|
|
69
|
-
auth
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
52
|
const session = await this.entityService.query(LoginSession, "currentUser").firstOrDefault();
|
|
73
|
-
session.deviceToken = JSON.stringify(
|
|
53
|
+
session.deviceToken = JSON.stringify(s);
|
|
74
54
|
session.deviceTokenType = "WebPush";
|
|
75
55
|
const cloner = this.entityService.cloner(session);
|
|
76
56
|
await this.entityService.save(cloner.copy);
|