shouldIncludeFullData method
bool
shouldIncludeFullData(
- ObslyEventBase event,
- String currentSessionId,
- App currentApp,
- Device currentDevice,
- bool isCrashEvent,
Check if device/app data should be included for this event
Implementation
bool shouldIncludeFullData(
ObslyEventBase event,
String currentSessionId,
App currentApp,
Device currentDevice,
bool isCrashEvent,
) {
// Always include full data for crash events
if (isCrashEvent) {
return true;
}
// Check if session changed (new session)
if (_lastSessionId != currentSessionId) {
_lastSessionId = currentSessionId;
_sessionEventCount = 0;
_eventCount = 0;
// Capture baseline when including full data
_lastAppData = currentApp;
_lastDeviceData = currentDevice;
return true; // First event of new session
}
// First event of the app lifecycle
if (_eventCount == 0) {
// Capture baseline when including full data
_lastAppData = currentApp;
_lastDeviceData = currentDevice;
return true;
}
// Every 100th event (based on next event index since counters update after decision)
if (((_sessionEventCount + 1) % fullDataInterval) == 0) {
// Refresh baseline when including periodic full data
_lastAppData = currentApp;
_lastDeviceData = currentDevice;
return true;
}
// Check if app data changed
if (_appDataChanged(currentApp)) {
_lastAppData = currentApp;
return true;
}
// Check if device data changed
if (_deviceDataChanged(currentDevice)) {
_lastDeviceData = currentDevice;
return true;
}
return false;
}