tryUpdateAppSessionId static method

void tryUpdateAppSessionId()

Call this method on app start and AppLifecycleState.resumed

Implementation

static void tryUpdateAppSessionId() {
  final appSuspended = DateTime.now().difference(DSPrefs.I.getAppLastUsed());
  if (appSuspended.inMinutes >= 1) {
    DSPrefs.I.setAppLastUsed(DateTime.now());
    final newSession = DSPrefs.I.getSessionId() + 1;
    DSPrefs.I.setSessionId(newSession);
    if (_userXRunning) {
      final sessions = DSRemoteConfig.I.getUserXSessions();
      if (sessions != 0 && sessions < newSession) {
        stopUserX();
      }
    }
  }
}