Files
discord-decomp/modules/ads/native/AdUserActionCreators.android.tsx
T
2026-11-01 12:12:55 +02:00

97 lines
3.3 KiB
TypeScript

// Metro module 6017 (f6018).
import AdUserStore from "./AdUserStore";
import { AnalyticEvents, Platforms } from "../../../Constants";
import AnalyticsUtils from "../../../utils/AnalyticsUtils";
import Dispatcher from "../../../Dispatcher";
import Module6018 from "../../../_bundle/Module6018";
export async function fetchAdUser(location2) {
let c25679_3;
let c25679_4 = 0;
let c29650_0, c29650_1, c29650_2, c29650_3, c29650_4, c29650_5;
L17: {
L11: {
try {
c29650_0 = location2;
c29650_1 = void 0;
c29650_2 = void 0;
c29650_3 = void 0;
c29650_4 = void 0;
if (AdUserStore.adUser != null && AdUserStore.adUser.advertisingId != null) {
AnalyticsUtils.track(AnalyticEvents.AD_IDENTIFIER_FETCHED, {
has_advertising_id: true,
android_advertising_id: AdUserStore.adUser.advertisingId,
location: location2,
success: true,
last_fetched_timestamp: AdUserStore.lastFetchedAt
});
break L11;
}
c29650_1 = performance.now();
c25679_4 = 1;
Dispatcher.dispatch({
type: "FETCH_AD_USER_START"
});
c29650_2 = await Module6018.getGoogleAdvertisingId();
c29650_3 = performance.now() - c29650_1;
AnalyticsUtils.track(AnalyticEvents.AD_USER_FETCH_DURATION, {
platform: Platforms.ANDROID,
success: true,
duration_ms: c29650_3,
has_advertising_id: c29650_2.googleAdvertisingId != null,
is_limit_ad_tracking_enabled: c29650_2.isLimitAdTrackingEnabled
});
AnalyticsUtils.track(AnalyticEvents.AD_IDENTIFIER_FETCHED, {
has_advertising_id: c29650_2.googleAdvertisingId != null,
android_advertising_id: c29650_2.googleAdvertisingId != null ? c29650_2.googleAdvertisingId : null,
location: c29650_0,
success: true
});
Dispatcher.dispatch({
type: "FETCH_AD_USER_SUCCESS",
advertisingId: c29650_2.googleAdvertisingId,
isLimitAdTrackingEnabled: c29650_2.isLimitAdTrackingEnabled
});
c25679_4 = 0;
break L17;
} catch ($e) {
const r30 = $e;
let r8 = r30;
c25679_3 = r30;
if (c25679_4 !== 0) {
while (true) {
try {
const r141 = c25679_3;
c25679_4 = 0;
c29650_5 = r141;
c29650_4 = performance.now() - c29650_1;
AnalyticsUtils.track(AnalyticEvents.AD_USER_FETCH_DURATION, {
platform: Platforms.ANDROID,
success: false,
duration_ms: c29650_4,
error_message: c29650_5 instanceof Error ? c29650_5.message : String(c29650_5)
});
AnalyticsUtils.track(AnalyticEvents.AD_IDENTIFIER_FETCHED, {
has_advertising_id: false,
location: c29650_0,
success: false
});
Dispatcher.dispatch({
type: "FETCH_AD_USER_FAILURE"
});
break L17;
} catch (r137) {
r8 = r137;
c25679_3 = r137;
if (c25679_4 === 0) {
break;
}
}
}
}
throw r8;
}
}
return void 0;
}
}