71 lines
3.4 KiB
TypeScript
71 lines
3.4 KiB
TypeScript
/* Metro module 7113; source: modules/analytics_sessions/SessionAdGenerator.tsx; dependencies: [672, 491, 4882, 694, 1216, 2] */
|
|
function _fun56853(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#56853, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7291:6, offset: 0x013d3b9b, size: 180 bytes, params: 8, frame: 20
|
|
const env0_0 = require;
|
|
const closure = isAdSessionExpired;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const Millis = (importDefault(672) /* metro dependency 672: Durations */).Millis;
|
|
const HOUR = Millis.HOUR;
|
|
const env0_3 = 12 * HOUR;
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/analytics_sessions/SessionAdGenerator.tsx');
|
|
exports.getOrRefreshAdSession = getOrRefreshAdSession;
|
|
exports.clearAdSession = function() {
|
|
env0_4 = null;
|
|
};
|
|
exports.getCurrentAdSession = getCurrentAdSession;
|
|
exports.isAdSessionExpired = closure;
|
|
}
|
|
|
|
function isAdSessionExpired(a0) { // fn#56854, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7291:128, offset: 0x013d3c4f, size: 193 bytes, params: 2, frame: 18
|
|
const Date = global.Date;
|
|
let value = Date.now();
|
|
if (value < a0.createdAtTimestamp) {
|
|
(importDefault(1216) /* metro dependency 1216: SentryUtilsNative */).addBreadcrumb({category: 'ad',
|
|
message: 'future facing timestamp Date.now(): ' + value + ', initialized timestamp: ' + a0.createdAtTimestamp});
|
|
return true;
|
|
}
|
|
const value2 = value - a0.lastUsedTimestamp;
|
|
const SESSION_IDLE_TIMEOUT_MILLIS = (require(4882) /* metro dependency 4882: SessionUtils */).SESSION_IDLE_TIMEOUT_MILLIS;
|
|
const value4 = value2 > SESSION_IDLE_TIMEOUT_MILLIS;
|
|
value -= a0.createdAtTimestamp;
|
|
value = value > env0_3;
|
|
return value4 || value;
|
|
}
|
|
|
|
function getOrRefreshAdSession() { // fn#56855, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7291:560, offset: 0x013d3d10, size: 194 bytes, params: 1, frame: 17
|
|
var object2;
|
|
const CLIENT_SESSION_STORAGE_VERSION = (require(4882) /* metro dependency 4882: SessionUtils */).CLIENT_SESSION_STORAGE_VERSION;
|
|
let value = a0;
|
|
let r0 = value !== undefined ? value : false;
|
|
const Date = global.Date;
|
|
value = Date.now();
|
|
if (env0_4 == null) {
|
|
object2 = {};
|
|
object2.uuid = (require(491) /* metro dependency 491 */).v4();
|
|
object2.createdAtTimestamp = value;
|
|
object2.lastUsedTimestamp = value;
|
|
object2.version = CLIENT_SESSION_STORAGE_VERSION;
|
|
env0_4 = object2;
|
|
value = importDefault(694) /* metro dependency 694: Dispatcher */;
|
|
value.dispatch({type: 'AD_SESSION_RESET'});
|
|
r0 = env0_4;
|
|
} else if (isAdSessionExpired(env0_4)) {
|
|
object2 = {};
|
|
object2.uuid = (require(491) /* metro dependency 491 */).v4();
|
|
object2.createdAtTimestamp = value;
|
|
object2.lastUsedTimestamp = value;
|
|
object2.version = CLIENT_SESSION_STORAGE_VERSION;
|
|
env0_4 = object2;
|
|
value = importDefault(694) /* metro dependency 694: Dispatcher */;
|
|
value.dispatch({type: 'AD_SESSION_RESET'});
|
|
r0 = env0_4;
|
|
} else {
|
|
if (r0) {
|
|
env0_4.lastUsedTimestamp = value;
|
|
}
|
|
r0 = env0_4;
|
|
}
|
|
return r0;
|
|
}
|
|
|