@opexa/portal-sdk 0.59.93 → 0.59.94
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 +5 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +5 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3,7 +3,6 @@ import { GraphQLClient, isPlainObject } from './chunk-5WRVWQBT.js';
|
|
|
3
3
|
import './chunk-ROBGEUSE.js';
|
|
4
4
|
import { ObjectId } from '@opexa/object-id';
|
|
5
5
|
export { ObjectId } from '@opexa/object-id';
|
|
6
|
-
import { App } from '@capacitor/app';
|
|
7
6
|
import { Capacitor } from '@capacitor/core';
|
|
8
7
|
import cookies from 'js-cookie';
|
|
9
8
|
|
|
@@ -3529,14 +3528,12 @@ var Sdk = class {
|
|
|
3529
3528
|
}
|
|
3530
3529
|
watchSession(input) {
|
|
3531
3530
|
const interval = clamp(input.interval ?? 3e4, 5e3, 6e4);
|
|
3531
|
+
let counter = 0;
|
|
3532
3532
|
let timeout = null;
|
|
3533
|
-
let isForeground = true;
|
|
3534
|
-
const listener = App.addListener("appStateChange", ({ isActive }) => {
|
|
3535
|
-
isForeground = isActive;
|
|
3536
|
-
});
|
|
3537
3533
|
const assignTimeout = () => {
|
|
3534
|
+
const duration = counter <= 0 ? interval * 0.5 : interval;
|
|
3538
3535
|
return setTimeout(async () => {
|
|
3539
|
-
|
|
3536
|
+
{
|
|
3540
3537
|
let res;
|
|
3541
3538
|
try {
|
|
3542
3539
|
res = await this.sessionManager.verify();
|
|
@@ -3547,15 +3544,15 @@ var Sdk = class {
|
|
|
3547
3544
|
await input.onInvalid(res.reason ?? "INVALID_SESSION");
|
|
3548
3545
|
}
|
|
3549
3546
|
}
|
|
3547
|
+
counter += 1;
|
|
3550
3548
|
timeout = assignTimeout();
|
|
3551
|
-
},
|
|
3549
|
+
}, duration);
|
|
3552
3550
|
};
|
|
3553
3551
|
timeout = assignTimeout();
|
|
3554
3552
|
return function unsubscribe() {
|
|
3555
3553
|
if (timeout) {
|
|
3556
3554
|
clearTimeout(timeout);
|
|
3557
3555
|
}
|
|
3558
|
-
listener.then((handle) => handle.remove());
|
|
3559
3556
|
};
|
|
3560
3557
|
}
|
|
3561
3558
|
async session() {
|