processEvent static method
Implementation
static EnrichedSessionEvent processEvent({
required SessionState? state,
required int now,
required String messageId,
required String timestamp,
int foregroundSessionTimeout = 0,
int backgroundSessionTimeout = 0,
bool isAppInBackground = false,
}) {
final shouldRotate = state == null ||
shouldRotateOnResume(
state,
now,
backgroundSessionTimeout: backgroundSessionTimeout,
) ||
(!isAppInBackground &&
shouldRotateOnInactivity(
state,
now,
foregroundSessionTimeout: foregroundSessionTimeout,
));
final currentState = shouldRotate
? rotateSession(state, now, messageId, timestamp)
: ensureFirstEvent(state, messageId, timestamp);
return enrichEvent(
currentState,
now,
updateActivity: !isAppInBackground,
);
}