markForegrounded static method

SessionState? markForegrounded({
  1. required SessionState? state,
  2. required int now,
  3. int backgroundSessionTimeout = 0,
})

Implementation

static SessionState? markForegrounded({
  required SessionState? state,
  required int now,
  int backgroundSessionTimeout = 0,
}) {
  if (state == null) {
    return state;
  }

  if (shouldRotateOnResume(
    state,
    now,
    backgroundSessionTimeout: backgroundSessionTimeout,
  )) {
    return state;
  }

  return state.copyWith(
    lastActivityAt: now,
    clearBackgroundedAt: true,
  );
}