@opexa/portal-sdk 0.59.99 → 0.59.100

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/dist/index.cjs CHANGED
@@ -1,7 +1,6 @@
1
1
  'use strict';
2
2
 
3
3
  var objectId = require('@opexa/object-id');
4
- var app = require('@capacitor/app');
5
4
  var core = require('@capacitor/core');
6
5
  var thumbmarkjs = require('@thumbmarkjs/thumbmarkjs');
7
6
  var cookies = require('js-cookie');
@@ -10827,35 +10826,30 @@ var Sdk = class {
10827
10826
  const interval = clamp(input.interval ?? 3e4, 5e3, 6e4);
10828
10827
  let counter = 0;
10829
10828
  let timeout = null;
10830
- let isForeground = true;
10831
10829
  let stopped = false;
10832
- const listener = app.App.addListener("appStateChange", ({ isActive }) => {
10833
- isForeground = isActive;
10834
- });
10835
10830
  const stop = () => {
10836
10831
  stopped = true;
10837
10832
  if (timeout) {
10838
10833
  clearTimeout(timeout);
10839
10834
  timeout = null;
10840
10835
  }
10841
- listener.then((handle) => handle.remove());
10842
10836
  };
10843
10837
  const assignTimeout = () => {
10844
- const duration = counter <= 0 ? interval * 0.5 : interval;
10838
+ const duration = counter <= 0 ? interval * 1.5 : interval;
10845
10839
  return setTimeout(async () => {
10846
- if (isForeground) {
10847
- let res;
10848
- try {
10849
- res = await this.sessionManager.verify();
10850
- } catch {
10851
- res = null;
10852
- }
10853
- if (stopped) return;
10854
- if (res && !res.valid) {
10855
- stop();
10856
- await input.onInvalid(res.reason ?? "INVALID_SESSION");
10857
- return;
10858
- }
10840
+ let res;
10841
+ try {
10842
+ res = await this.sessionManager.verify();
10843
+ } catch {
10844
+ res = null;
10845
+ }
10846
+ if (stopped) {
10847
+ return;
10848
+ }
10849
+ if (res && !res.valid) {
10850
+ stop();
10851
+ await input.onInvalid(res.reason ?? "INVALID_SESSION");
10852
+ return;
10859
10853
  }
10860
10854
  counter += 1;
10861
10855
  timeout = assignTimeout();