@onyx-p/imlib-web 2.2.1 → 2.2.3

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/index.esm.js CHANGED
@@ -20846,8 +20846,18 @@ class MessageLoader {
20846
20846
  MessageReceiptManager$1.get()?.sendArrivalReceipts(normalMessages);
20847
20847
  }
20848
20848
  if (done) {
20849
- if (seqno.ge(this.serverMsgSeqno)) {
20850
- this.serverMsgSeqno = seqno;
20849
+ let seqNo_long;
20850
+ if (seqno) {
20851
+ if (Long.isLong(seqno)) {
20852
+ seqNo_long = seqno;
20853
+ } else if (typeof seqno === 'string') {
20854
+ seqNo_long = Long.fromString(seqno);
20855
+ } else if (typeof seqno === 'number') {
20856
+ seqNo_long = Long.fromNumber(seqno);
20857
+ }
20858
+ }
20859
+ if (seqNo_long && Long.isLong(seqNo_long) && seqNo_long.ge(this.serverMsgSeqno)) {
20860
+ this.serverMsgSeqno = seqNo_long;
20851
20861
  }
20852
20862
  const isFinished = this.serverMsgSeqno.lessThanOrEqual(offset);
20853
20863
  logger.info(`pullMsg success -> syncTime: ${offset}, finished: ${isFinished}`);
@@ -21697,6 +21707,7 @@ class LibLoader {
21697
21707
  code: ErrorCode.BIZ_ERROR_CONNECTING
21698
21708
  };
21699
21709
  }
21710
+ webSocketServer.close();
21700
21711
  const code = await webSocketServer.connect();
21701
21712
  this.isInternalConnected = true;
21702
21713
  return {
@@ -21789,6 +21800,9 @@ class LibLoader {
21789
21800
  }
21790
21801
  handleUserConnected() {
21791
21802
  logger.info('user connected -> ', accountStore.uid.toString());
21803
+ if (!this.messageLoader) {
21804
+ this.messageLoader = new MessageLoader(this.watcher, this.options);
21805
+ }
21792
21806
  this.messageLoader?.start();
21793
21807
  setTimeout(() => {
21794
21808
  if (this.connectionStatus !== ConnectionStatus.CONNECTED) return;
@@ -29162,8 +29176,10 @@ class IMClient extends EventEmitter {
29162
29176
  return this.libLoader.disconnect();
29163
29177
  }
29164
29178
  setUserLogged(info) {
29165
- accountStore.setLogged(info);
29166
- this.libLoader.setUserLogged();
29179
+ if (info.uid !== accountStore.uid.toString()) {
29180
+ accountStore.setLogged(info);
29181
+ this.libLoader.setUserLogged();
29182
+ }
29167
29183
  }
29168
29184
  logOut() {
29169
29185
  accountStore.logOut();
package/index.umd.js CHANGED
@@ -20852,8 +20852,18 @@
20852
20852
  MessageReceiptManager$1.get()?.sendArrivalReceipts(normalMessages);
20853
20853
  }
20854
20854
  if (done) {
20855
- if (seqno.ge(this.serverMsgSeqno)) {
20856
- this.serverMsgSeqno = seqno;
20855
+ let seqNo_long;
20856
+ if (seqno) {
20857
+ if (Long.isLong(seqno)) {
20858
+ seqNo_long = seqno;
20859
+ } else if (typeof seqno === 'string') {
20860
+ seqNo_long = Long.fromString(seqno);
20861
+ } else if (typeof seqno === 'number') {
20862
+ seqNo_long = Long.fromNumber(seqno);
20863
+ }
20864
+ }
20865
+ if (seqNo_long && Long.isLong(seqNo_long) && seqNo_long.ge(this.serverMsgSeqno)) {
20866
+ this.serverMsgSeqno = seqNo_long;
20857
20867
  }
20858
20868
  const isFinished = this.serverMsgSeqno.lessThanOrEqual(offset);
20859
20869
  logger.info(`pullMsg success -> syncTime: ${offset}, finished: ${isFinished}`);
@@ -21703,6 +21713,7 @@
21703
21713
  code: exports.ErrorCode.BIZ_ERROR_CONNECTING
21704
21714
  };
21705
21715
  }
21716
+ webSocketServer.close();
21706
21717
  const code = await webSocketServer.connect();
21707
21718
  this.isInternalConnected = true;
21708
21719
  return {
@@ -21795,6 +21806,9 @@
21795
21806
  }
21796
21807
  handleUserConnected() {
21797
21808
  logger.info('user connected -> ', accountStore.uid.toString());
21809
+ if (!this.messageLoader) {
21810
+ this.messageLoader = new MessageLoader(this.watcher, this.options);
21811
+ }
21798
21812
  this.messageLoader?.start();
21799
21813
  setTimeout(() => {
21800
21814
  if (this.connectionStatus !== exports.ConnectionStatus.CONNECTED) return;
@@ -29168,8 +29182,10 @@
29168
29182
  return this.libLoader.disconnect();
29169
29183
  }
29170
29184
  setUserLogged(info) {
29171
- accountStore.setLogged(info);
29172
- this.libLoader.setUserLogged();
29185
+ if (info.uid !== accountStore.uid.toString()) {
29186
+ accountStore.setLogged(info);
29187
+ this.libLoader.setUserLogged();
29188
+ }
29173
29189
  }
29174
29190
  logOut() {
29175
29191
  accountStore.logOut();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onyx-p/imlib-web",
3
- "version": "2.2.1",
3
+ "version": "2.2.3",
4
4
  "main": "index.umd.js",
5
5
  "module": "index.esm.js",
6
6
  "types": "types/index.d.ts",