@social-mail/social-mail-client 1.8.360 → 1.8.361

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@social-mail/social-mail-client",
3
- "version": "1.8.360",
3
+ "version": "1.8.361",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -28,23 +28,6 @@ export default class LoginService {
28
28
  if (this.user?.userID) {
29
29
  // let start syncing...
30
30
  // this.app.resolve(LocalDbService).syncAll(this.user.userID).catch(console.error);
31
- if (PositronInBrowser.isAvailable) {
32
- const deviceToken = await PositronInBrowser.run(function () {
33
-
34
- // this runs inside App's Internal JavaScript Engine
35
- const NSPositronAssembly = this.clr
36
- .assembly("NeuroSpeech.Positron");
37
-
38
- const Positron = NSPositronAssembly
39
- .NeuroSpeech.Positron.Positron;
40
-
41
- return Positron.instance.deviceToken;
42
- });
43
-
44
- if (deviceToken) {
45
- await this.entityService.invoke(LoginSession, "updateDeviceToken", session, "fcm", deviceToken);
46
- }
47
- }
48
31
  }
49
32
  return this.user;
50
33
  }
@@ -5,6 +5,7 @@ import EntityService from "./EntityService";
5
5
  import { LoginSession } from "../model/model";
6
6
  import FetchBuilder from "@web-atoms/core/dist/services/FetchBuilder";
7
7
  import { apiPath } from "../common/apiPath";
8
+ import PositronInBrowser from "@positron-js/context/dist/PositronInBrowser";
8
9
 
9
10
  @DITransient()
10
11
  export default class WebPushService {
@@ -14,7 +15,26 @@ export default class WebPushService {
14
15
 
15
16
  async register() {
16
17
  try {
17
- // ask for push...
18
+
19
+ if (PositronInBrowser.isAvailable) {
20
+ const deviceToken = await PositronInBrowser.run(function () {
21
+
22
+ // this runs inside App's Internal JavaScript Engine
23
+ const NSPositronAssembly = this.clr
24
+ .assembly("NeuroSpeech.Positron");
25
+
26
+ const Positron = NSPositronAssembly
27
+ .NeuroSpeech.Positron.Positron;
28
+
29
+ return Positron.instance.deviceToken;
30
+ });
31
+
32
+ if (deviceToken) {
33
+ const session = await this.entityService.query(LoginSession, "currentUser").firstOrDefault();
34
+ await this.entityService.invoke(LoginSession, "updateDeviceToken", session, "fcm", deviceToken);
35
+ }
36
+ }
37
+ // ask for push...
18
38
  if (!("serviceWorker" in navigator)) {
19
39
  return;
20
40
  }