@opexa/portal-sdk 0.59.94 → 0.59.95

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.js CHANGED
@@ -1,8 +1,9 @@
1
- import { CmsPortalService, GameService, ExtensionService, FileService, WalletService, AccountService, ReportService, PortalService, TriggerService, AuthService, getFingerPrint } from './chunk-4TI5IXXM.js';
2
- import { GraphQLClient, isPlainObject } from './chunk-5WRVWQBT.js';
3
- import './chunk-ROBGEUSE.js';
1
+ import { CmsPortalService, GameService, ExtensionService, FileService, WalletService, AccountService, ReportService, PortalService, TriggerService, AuthService, getFingerPrint } from './chunk-RCMZBLLX.js';
2
+ import { GraphQLClient, isPlainObject } from './chunk-7APXFZ5G.js';
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';
6
7
  import { Capacitor } from '@capacitor/core';
7
8
  import cookies from 'js-cookie';
8
9
 
@@ -3530,10 +3531,14 @@ var Sdk = class {
3530
3531
  const interval = clamp(input.interval ?? 3e4, 5e3, 6e4);
3531
3532
  let counter = 0;
3532
3533
  let timeout = null;
3534
+ let isForeground = true;
3535
+ const listener = App.addListener("appStateChange", ({ isActive }) => {
3536
+ isForeground = isActive;
3537
+ });
3533
3538
  const assignTimeout = () => {
3534
3539
  const duration = counter <= 0 ? interval * 0.5 : interval;
3535
3540
  return setTimeout(async () => {
3536
- {
3541
+ if (isForeground) {
3537
3542
  let res;
3538
3543
  try {
3539
3544
  res = await this.sessionManager.verify();
@@ -3553,6 +3558,7 @@ var Sdk = class {
3553
3558
  if (timeout) {
3554
3559
  clearTimeout(timeout);
3555
3560
  }
3561
+ listener.then((handle) => handle.remove());
3556
3562
  };
3557
3563
  }
3558
3564
  async session() {