@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 +14 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +14 -20
- 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-7APXFZ5G.js';
|
|
|
3
3
|
import './chunk-WVFSGB7Y.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
|
|
|
@@ -3674,35 +3673,30 @@ var Sdk = class {
|
|
|
3674
3673
|
const interval = clamp(input.interval ?? 3e4, 5e3, 6e4);
|
|
3675
3674
|
let counter = 0;
|
|
3676
3675
|
let timeout = null;
|
|
3677
|
-
let isForeground = true;
|
|
3678
3676
|
let stopped = false;
|
|
3679
|
-
const listener = App.addListener("appStateChange", ({ isActive }) => {
|
|
3680
|
-
isForeground = isActive;
|
|
3681
|
-
});
|
|
3682
3677
|
const stop = () => {
|
|
3683
3678
|
stopped = true;
|
|
3684
3679
|
if (timeout) {
|
|
3685
3680
|
clearTimeout(timeout);
|
|
3686
3681
|
timeout = null;
|
|
3687
3682
|
}
|
|
3688
|
-
listener.then((handle) => handle.remove());
|
|
3689
3683
|
};
|
|
3690
3684
|
const assignTimeout = () => {
|
|
3691
|
-
const duration = counter <= 0 ? interval *
|
|
3685
|
+
const duration = counter <= 0 ? interval * 1.5 : interval;
|
|
3692
3686
|
return setTimeout(async () => {
|
|
3693
|
-
|
|
3694
|
-
|
|
3695
|
-
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
|
|
3701
|
-
|
|
3702
|
-
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
3687
|
+
let res;
|
|
3688
|
+
try {
|
|
3689
|
+
res = await this.sessionManager.verify();
|
|
3690
|
+
} catch {
|
|
3691
|
+
res = null;
|
|
3692
|
+
}
|
|
3693
|
+
if (stopped) {
|
|
3694
|
+
return;
|
|
3695
|
+
}
|
|
3696
|
+
if (res && !res.valid) {
|
|
3697
|
+
stop();
|
|
3698
|
+
await input.onInvalid(res.reason ?? "INVALID_SESSION");
|
|
3699
|
+
return;
|
|
3706
3700
|
}
|
|
3707
3701
|
counter += 1;
|
|
3708
3702
|
timeout = assignTimeout();
|