@onyx-p/imlib-web 2.2.9 → 2.3.1

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.
Files changed (3) hide show
  1. package/index.esm.js +21 -20
  2. package/index.umd.js +21 -20
  3. package/package.json +1 -1
package/index.esm.js CHANGED
@@ -20798,7 +20798,9 @@ class MessageLoader {
20798
20798
  if (code !== ErrorCode.SUCCESS) {
20799
20799
  logger.warn('pullMsg failed -> code:', code);
20800
20800
  this.pullingMsg = false;
20801
- this.try2RePullMsg();
20801
+ if (LibLoader.loader?.getConnectionStatus() == ConnectionStatus.CONNECTED) {
20802
+ this.try2RePullMsg();
20803
+ }
20802
20804
  return;
20803
20805
  }
20804
20806
  const {
@@ -21788,34 +21790,32 @@ class LibLoader {
21788
21790
  }
21789
21791
  async connectionStatusListener(status) {
21790
21792
  this.connectionStatus = status;
21791
- setTimeout(() => {
21792
- switch (status) {
21793
- case ConnectionStatus.BLOCKED:
21794
- case ConnectionStatus.KICKED_OFFLINE_BY_OTHER_CLIENT:
21795
- case ConnectionStatus.DISCONNECT_BY_SERVER:
21796
- this.handleDisconnect();
21797
- break;
21798
- case ConnectionStatus.CONNECTING:
21799
- this.handleConnecting();
21800
- break;
21801
- case ConnectionStatus.CONNECTED:
21802
- this.handleConnected();
21803
- break;
21804
- case ConnectionStatus.DISCONNECTED:
21805
- this.handleDisconnect();
21806
- break;
21807
- }
21808
- }, 0);
21793
+ switch (status) {
21794
+ case ConnectionStatus.BLOCKED:
21795
+ case ConnectionStatus.KICKED_OFFLINE_BY_OTHER_CLIENT:
21796
+ case ConnectionStatus.DISCONNECT_BY_SERVER:
21797
+ this.handleDisconnect();
21798
+ break;
21799
+ case ConnectionStatus.CONNECTING:
21800
+ this.handleConnecting();
21801
+ break;
21802
+ case ConnectionStatus.CONNECTED:
21803
+ this.handleConnected();
21804
+ break;
21805
+ case ConnectionStatus.DISCONNECTED:
21806
+ this.handleDisconnect();
21807
+ break;
21808
+ }
21809
21809
  }
21810
21810
  handleConnecting() {
21811
21811
  this.watcher.onConnecting?.();
21812
21812
  }
21813
21813
  handleConnected() {
21814
- this.watcher.onConnected?.();
21815
21814
  if (accountStore.isActive) {
21816
21815
  this.handleUserConnected();
21817
21816
  synchronizeServerTime();
21818
21817
  }
21818
+ this.watcher.onConnected?.();
21819
21819
  }
21820
21820
  handleDisconnect() {
21821
21821
  this.watcher.onDisconnect?.();
@@ -29016,6 +29016,7 @@ async function send(message, sentArgs) {
29016
29016
  const secretKey = await DialogSecretKey$1.getDialogAesKey(dialogId.toString());
29017
29017
  if (!secretKey) {
29018
29018
  receivedMessage.sentStatus = SentStatus.FAILED;
29019
+ await saveSentMessage(receivedMessage, sentArgs);
29019
29020
  return {
29020
29021
  code: ErrorCode.MSG_ENCRYPT_ERROR,
29021
29022
  data: receivedMessage
package/index.umd.js CHANGED
@@ -20804,7 +20804,9 @@
20804
20804
  if (code !== exports.ErrorCode.SUCCESS) {
20805
20805
  logger.warn('pullMsg failed -> code:', code);
20806
20806
  this.pullingMsg = false;
20807
- this.try2RePullMsg();
20807
+ if (LibLoader.loader?.getConnectionStatus() == exports.ConnectionStatus.CONNECTED) {
20808
+ this.try2RePullMsg();
20809
+ }
20808
20810
  return;
20809
20811
  }
20810
20812
  const {
@@ -21794,34 +21796,32 @@
21794
21796
  }
21795
21797
  async connectionStatusListener(status) {
21796
21798
  this.connectionStatus = status;
21797
- setTimeout(() => {
21798
- switch (status) {
21799
- case exports.ConnectionStatus.BLOCKED:
21800
- case exports.ConnectionStatus.KICKED_OFFLINE_BY_OTHER_CLIENT:
21801
- case exports.ConnectionStatus.DISCONNECT_BY_SERVER:
21802
- this.handleDisconnect();
21803
- break;
21804
- case exports.ConnectionStatus.CONNECTING:
21805
- this.handleConnecting();
21806
- break;
21807
- case exports.ConnectionStatus.CONNECTED:
21808
- this.handleConnected();
21809
- break;
21810
- case exports.ConnectionStatus.DISCONNECTED:
21811
- this.handleDisconnect();
21812
- break;
21813
- }
21814
- }, 0);
21799
+ switch (status) {
21800
+ case exports.ConnectionStatus.BLOCKED:
21801
+ case exports.ConnectionStatus.KICKED_OFFLINE_BY_OTHER_CLIENT:
21802
+ case exports.ConnectionStatus.DISCONNECT_BY_SERVER:
21803
+ this.handleDisconnect();
21804
+ break;
21805
+ case exports.ConnectionStatus.CONNECTING:
21806
+ this.handleConnecting();
21807
+ break;
21808
+ case exports.ConnectionStatus.CONNECTED:
21809
+ this.handleConnected();
21810
+ break;
21811
+ case exports.ConnectionStatus.DISCONNECTED:
21812
+ this.handleDisconnect();
21813
+ break;
21814
+ }
21815
21815
  }
21816
21816
  handleConnecting() {
21817
21817
  this.watcher.onConnecting?.();
21818
21818
  }
21819
21819
  handleConnected() {
21820
- this.watcher.onConnected?.();
21821
21820
  if (accountStore.isActive) {
21822
21821
  this.handleUserConnected();
21823
21822
  synchronizeServerTime();
21824
21823
  }
21824
+ this.watcher.onConnected?.();
21825
21825
  }
21826
21826
  handleDisconnect() {
21827
21827
  this.watcher.onDisconnect?.();
@@ -29022,6 +29022,7 @@
29022
29022
  const secretKey = await DialogSecretKey$1.getDialogAesKey(dialogId.toString());
29023
29023
  if (!secretKey) {
29024
29024
  receivedMessage.sentStatus = exports.SentStatus.FAILED;
29025
+ await saveSentMessage(receivedMessage, sentArgs);
29025
29026
  return {
29026
29027
  code: exports.ErrorCode.MSG_ENCRYPT_ERROR,
29027
29028
  data: receivedMessage
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onyx-p/imlib-web",
3
- "version": "2.2.9",
3
+ "version": "2.3.1",
4
4
  "main": "index.umd.js",
5
5
  "module": "index.esm.js",
6
6
  "types": "types/index.d.ts",