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 (_uxCamRunning) {
      final sessions = DSRemoteConfig.I.getUXCamSessions();
      if (sessions != 0 && sessions < newSession) {
        stopUXCam();
      }
    }
  }
}