82 lines
4.1 KiB
TypeScript
82 lines
4.1 KiB
TypeScript
/* Metro module 7113; source: modules/analytics_sessions/SessionAdGenerator.tsx; dependencies: [672, 491, 4882, 694, 1216, 2] */
|
|
import Durations from '../../utils/Durations.tsx'; /* Metro dependency 672 */
|
|
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as SessionUtilsModule from './SessionUtils.tsx'; /* Metro dependency 4882 */
|
|
|
|
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 isAdSessionExpired2 = isAdSessionExpired;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const Millis = (Durations).Millis;
|
|
const HOUR = Millis.HOUR;
|
|
const env0_3 = 12 * HOUR;
|
|
(FileImportTrackerModule).fileFinishedImporting('modules/analytics_sessions/SessionAdGenerator.tsx');
|
|
exports.getOrRefreshAdSession = getOrRefreshAdSession;
|
|
exports.clearAdSession = function() {
|
|
env0_4 = null;
|
|
};
|
|
exports.getCurrentAdSession = getCurrentAdSession;
|
|
exports.isAdSessionExpired = isAdSessionExpired2;
|
|
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 = (SessionUtilsModule).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 object3;
|
|
var object;
|
|
const CLIENT_SESSION_STORAGE_VERSION = (SessionUtilsModule).CLIENT_SESSION_STORAGE_VERSION;
|
|
let value = a0;
|
|
let r0 = value !== undefined ? value : false;
|
|
const Date = global.Date;
|
|
value = Date.now();
|
|
if (object3 == null) {
|
|
object = {};
|
|
object.uuid = (require(491) /* metro dependency 491 */).v4();
|
|
object.createdAtTimestamp = value;
|
|
object.lastUsedTimestamp = value;
|
|
object.version = CLIENT_SESSION_STORAGE_VERSION;
|
|
object3 = object;
|
|
value = importDefault(694) /* metro dependency 694: Dispatcher */;
|
|
value.dispatch({type: 'AD_SESSION_RESET'});
|
|
r0 = object3;
|
|
} else if (isAdSessionExpired(object3)) {
|
|
object = {};
|
|
object.uuid = (require(491) /* metro dependency 491 */).v4();
|
|
object.createdAtTimestamp = value;
|
|
object.lastUsedTimestamp = value;
|
|
object.version = CLIENT_SESSION_STORAGE_VERSION;
|
|
object3 = object;
|
|
value = importDefault(694) /* metro dependency 694: Dispatcher */;
|
|
value.dispatch({type: 'AD_SESSION_RESET'});
|
|
r0 = object3;
|
|
} else {
|
|
if (r0) {
|
|
object3.lastUsedTimestamp = value;
|
|
}
|
|
r0 = object3;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function getCurrentAdSession() { // fn#56857, offset: 0x00d16d26, size: 9 bytes, params: 1, frame: 1
|
|
return env0_4;
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun56853, 7113, [672, 491, 4882, 694, 1216,
|
|
2]) /* metro module 7113, dependencies: [672, 491, 4882, 694, 1216, 2] */;
|