Files
2026-07-28 01:06:53 +03:00

157 lines
9.1 KiB
TypeScript

/* Metro module 8906; source: modules/video_backgrounds/VideoBackgroundUtils.tsx; dependencies: [1379, 4294, 7617, 661, 1423, 4863, 683, 2] */
import AnalyticsUtils from '../../utils/AnalyticsUtils.tsx'; /* Metro dependency 683 */
import ChannelStore from '../../stores/ChannelStore.tsx'; /* Metro dependency 1379 */
import RTCConnectionStore from '../../stores/RTCConnectionStore.tsx'; /* Metro dependency 4294 */
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */
import * as AppAnalyticsUtilsModule from '../app_analytics/AppAnalyticsUtils.tsx'; /* Metro dependency 4863 */
import * as VideoBackgroundConstantsModule from './VideoBackgroundConstants.tsx'; /* Metro dependency 7617 */
function _fun69474(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#69474, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9091:6, offset: 0x01c746fe, size: 341 bytes, params: 8, frame: 24
const env0_0 = require;
const isCustomBackgroundOption2 = isCustomBackgroundOption;
const isDefaultBackgroundOption2 = isDefaultBackgroundOption;
const isAnimatedBackgroundOption2 = isAnimatedBackgroundOption;
const closure4 = function(a0) {
return a0 != null ? 'Video Background' : 'None';
};
const getEffectDetailAnalyticsName2 = getEffectDetailAnalyticsName;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
(FileImportTrackerModule).fileFinishedImporting('modules/video_backgrounds/VideoBackgroundUtils.tsx');
exports.isCustomBackgroundOption = isCustomBackgroundOption2;
exports.isDefaultBackgroundOption = isDefaultBackgroundOption2;
exports.isAnimatedBackgroundOption = isAnimatedBackgroundOption2;
exports.getEffectAnalyticsType = closure4;
exports.getEffectDetailAnalyticsName = getEffectDetailAnalyticsName2;
exports.trackBackgroundOptionUpdated = trackBackgroundOptionUpdated;
exports.trackBackgroundOptionAdded = function(a0, a1, a2) {
var defaultImport = importDefault(dependencyMap[6]);
var VIDEO_BACKGROUND_ADDED = AnalyticEvents.VIDEO_BACKGROUND_ADDED;
var object = {};
object.is_animated = isAnimatedBackgroundOption(a0);
object.is_video = a1;
object.is_from_tenor = a2;
defaultImport.track(VIDEO_BACKGROUND_ADDED, object);
};
exports.trackBackgroundOptionDeleted = function(a0) {
var defaultImport = importDefault(dependencyMap[6]);
var VIDEO_BACKGROUND_DELETED = AnalyticEvents.VIDEO_BACKGROUND_DELETED;
var object = {};
object.is_animated = isAnimatedBackgroundOption(a0);
defaultImport.track(VIDEO_BACKGROUND_DELETED, object);
};
exports.getVideoBackgroundProtoFromOption = getVideoBackgroundProtoFromOption;
exports.getVideoBackgroundOptionFromProto = getVideoBackgroundOptionFromProto;
function isCustomBackgroundOption(a0) { // fn#69475, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9091:237, offset: 0x01c74853, size: 61 bytes, params: 2, frame: 4
return a0 != null && typeof a0 === 'object' && 'id' in a0 && a0.type === VideoFilterType.BACKGROUND;
}
function isDefaultBackgroundOption(a0) { // fn#69476, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9091:342, offset: 0x01c74890, size: 30 bytes, params: 2, frame: 3
return typeof a0 === 'number' && a0 in DefaultVideoBackground;
}
function isAnimatedBackgroundOption(a0) { // fn#69477, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9091:413, offset: 0x01c748ae, size: 133 bytes, params: 2, frame: 16
var r2;
var r0;
var isCustomBackgroundOption2;
var moduleValue;
var isAnimatedIconHash2;
var value;
if (isDefaultBackgroundOption(a0)) {
r0 = ANIMATED_DEFAULT_VIDEO_BACKGROUNDS.includes(a0);
} else {
isCustomBackgroundOption2 = isCustomBackgroundOption(a0);
if (isCustomBackgroundOption2) {
moduleValue = require(1423) /* metro dependency 1423: AvatarUtils */;
isAnimatedIconHash2 = moduleValue.isAnimatedIconHash(a0.asset);
if (isAnimatedIconHash2) {
r2 = isAnimatedIconHash2;
} else {
value = require(1423) /* metro dependency 1423: AvatarUtils */;
value = value.isVideoAssetHash(a0.asset);
r2 = value;
}
r0 = r2;
} else {
r0 = !!isCustomBackgroundOption2;
}
}
return r0;
}
function getEffectDetailAnalyticsName(a0) { // fn#69479, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9091:682, offset: 0x01c7494b, size: 260 bytes, params: 2, frame: 17
return a0 == null ? 'None' : isCustomBackgroundOption(a0) ? 'Custom' : a0 === 'blur' ? 'Blur' : 'Preset - ' + (DefaultVideoBackground.OPTION_1 === a0 ? 'Cybercity' : DefaultVideoBackground.OPTION_2 === a0 ? 'Discord the Movie' : DefaultVideoBackground.OPTION_3 === a0 ? 'Wumpus Vacation' : DefaultVideoBackground.OPTION_4 === a0 ? 'Vaporwave' : DefaultVideoBackground.OPTION_7 === a0 ? 'Capernite Day' : DefaultVideoBackground.OPTION_8 === a0 ? 'Capernite Night' : DefaultVideoBackground.OPTION_9 === a0 ? 'Hacker Den' : DefaultVideoBackground.OPTION_10 !== a0 ? undefined : 'Wumpice');
}
function trackBackgroundOptionUpdated(a0, a1, a2) { // fn#69480, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9091:1556, offset: 0x01c74a4f, size: 270 bytes, params: 4, frame: 22
let rtcConnectionStoreBinding = RTCConnectionStore;
const guildId = rtcConnectionStoreBinding.getGuildId();
const channelId = rtcConnectionStoreBinding.getChannelId();
const channel = ChannelStore.getChannel(channelId);
const value5 = undefined;
const voiceStateMetadata = (AppAnalyticsUtilsModule).getVoiceStateMetadata(guildId,
channelId, true);
const defaultImport = AnalyticsUtils;
const track = defaultImport.track;
const VIDEO_EFFECT_UPDATED = AnalyticEvents.VIDEO_EFFECT_UPDATED;
const object = {location: a1};
object.effect_type = getEffectAnalyticsType(a0);
object.effect_detail = getEffectDetailAnalyticsName(a0);
object.effect_state = a2;
object.channel_id = channelId;
object.channel_type = channel == null ? value5 : channel.type;
object.guild_id = guildId;
object.voice_state_count = voiceStateMetadata.voice_state_count;
object.video_stream_count = voiceStateMetadata.video_stream_count;
rtcConnectionStoreBinding = RTCConnectionStore;
object.media_session_id = rtcConnectionStoreBinding.getMediaSessionId();
object.rtc_connection_id = rtcConnectionStoreBinding.getRTCConnectionId();
object.is_animated = isAnimatedBackgroundOption(a0);
Reflect.apply(track, defaultImport, [VIDEO_EFFECT_UPDATED, object]);
return value5;
}
function getVideoBackgroundProtoFromOption(a0) { // fn#69483, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9091:2488, offset: 0x01c74bf7, size: 135 bytes, params: 2, frame: 13
return a0 == null ? {oneofKind: undefined} : isCustomBackgroundOption(a0) ? {oneofKind: 'customAsset',
customAsset: {id: a0.id, assetHash: a0.asset}} : a0 === 'blur' ? {oneofKind: 'blur',
blur: {useBlur: true}} : {oneofKind: 'presetOption', presetOption: a0};
}
function getVideoBackgroundOptionFromProto(a0, a1) { // fn#69484, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9091:2789, offset: 0x01c74c7e, size: 152 bytes, params: 3, frame: 6
var object;
var customAsset;
let value = null;
if (value == a0) {
return value;
}
let oneofKind = a0.oneofKind;
if (oneofKind === undefined) {
return value;
}
oneofKind = a0.oneofKind;
if (oneofKind === 'customAsset') {
object = {};
value = environment;
object.type = VideoFilterType.BACKGROUND;
customAsset = a0.customAsset;
object.id = customAsset.id;
object.user_id = a1;
customAsset = a0.customAsset;
object.asset = customAsset.assetHash;
return object;
}
const value2 = 'blur';
if (value2 === oneofKind) {
return a0.blur.useBlur ? value2 : value;
}
if (oneofKind === 'presetOption') {
return a0.presetOption;
}
}
}
global.__d(_fun69474, 8906, [1379, 4294, 7617, 661, 1423, 4863, 683,
2]) /* metro module 8906, dependencies: [1379, 4294, 7617, 661, 1423, 4863, 683, 2] */;