tryQueueFirstOpen static method
Try to queue a first_open event.
Implementation
static Future<void> tryQueueFirstOpen(int firstOpenTime, int initTimestamp) async {
try {
final isSent = Prefs.getBool(_isSentKey) ?? false;
if (isSent) return;
final isPending = Prefs.getBool(_pendingDurableKey) ?? false;
if (isPending) return;
final diff = initTimestamp - firstOpenTime;
final withinWindow = _isWithinInstallWindow(diff);
// Mark as pending durable (not yet confirmed by server)
await Prefs.setBool(_pendingDurableKey, true);
await Prefs.setInt(_pendingInstallDiffKey, diff);
await _markFirstOpenNotLocallyStored();
await _recordFirstOpenEvent(
firstOpenTime,
diff,
recordEvent: onRecordEvent,
withinWindow: withinWindow,
);
await _confirmPendingFirstOpenStored(firstOpenTime);
} catch (e, st) {
dbLogger.severe('FirstOpenTracker: tryQueueFirstOpen failed', e, st);
}
}