Files
discord-decomp/sources/modules/video_backgrounds/VideoBackgroundStore.tsx
T
2026-07-28 01:06:53 +03:00

188 lines
10 KiB
TypeScript

/* Metro module 8905; source: modules/video_backgrounds/VideoBackgroundStore.tsx; dependencies: [6, 7, 15, 17, 18, 1348, 4259, 1934, 1878, 8906, 4406, 566, 694, 2] */
import ClassCallCheck from '../../by-id/module-00006-ClassCallCheck.js'; /* Metro dependency 6 */
import CreateClass from '../../by-id/module-00007-CreateClass.js'; /* Metro dependency 7 */
import PossibleConstructorReturn from '../../by-id/module-00015-PossibleConstructorReturn.js'; /* Metro dependency 15 */
import Module00017 from '../../by-id/module-00017.js'; /* Metro dependency 17 */
import Inherits from '../../by-id/module-00018-Inherits.js'; /* Metro dependency 18 */
import Flux from '../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
import UserSettingsProtoStore from '../user_settings/UserSettingsProtoStore.tsx'; /* Metro dependency 1348 */
import UserStore from '../../stores/UserStore.tsx'; /* Metro dependency 1878 */
import SelectedChannelStore from '../../stores/SelectedChannelStore.tsx'; /* Metro dependency 1934 */
import MediaEngineStore from '../../stores/MediaEngineStore.tsx'; /* Metro dependency 4259 */
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
function _fun69452(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#69452, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9090:6, offset: 0x01c7415a, size: 469 bytes, params: 8, frame: 19
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let env0_14 = {};
const Store = (Flux).Store;
let value = _fun69458(Store);
value.displayName = 'VideoBackgroundStore';
value = new value(importDefault(694) /* metro dependency 694: Dispatcher */,
{VIDEO_FILTER_ASSETS_FETCH_SUCCESS: function({assets}) {
assets.forEach(_fun69467);
env0_14 = {};
}, VIDEO_FILTER_ASSET_UPLOAD_SUCCESS: VIDEO_FILTER_ASSET_UPLOAD_SUCCESS,
VIDEO_FILTER_ASSET_DELETE_SUCCESS: VIDEO_FILTER_ASSET_DELETE_SUCCESS,
VIDEO_SAVE_LAST_USED_BACKGROUND_OPTION: function({backgroundOption}) {
if (hasVideoBackgroundLive(backgroundOption)) {
env0_13 = true;
}
}, MEDIA_ENGINE_APPLY_MEDIA_FILTER_SETTINGS: function({settings}) {
if (require(dependencyMap[10]).FilterSettingsKey.CAMERA_BACKGROUND_LIVE in settings) {
env0_11 = true;
env0_15 = false;
}
if (require(dependencyMap[10]).FilterSettingsKey.CAMERA_BACKGROUND_PREVIEW in settings) {
env0_16 = false;
}
}, MEDIA_ENGINE_VIDEO_FILTER_ERROR: MEDIA_ENGINE_VIDEO_FILTER_ERROR, LOGOUT: function() {
env0_11 = false;
env0_13 = false;
env0_12 = null;
env0_14 = {};
env0_15 = false;
env0_16 = false;
}});
(FileImportTrackerModule).fileFinishedImporting('modules/video_backgrounds/VideoBackgroundStore.tsx');
exports.default = value;
function _isNativeReflectConstruct_69453() { // fn#69453, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9090:188, offset: 0x01c7432f, size: 98 bytes, params: 1, frame: 18
var Boolean;
var prototype;
var valueOf;
var call;
var Reflect;
var construct;
var closure;
var value;
var error;
try {
Boolean = global.Boolean;
prototype = Boolean.prototype;
valueOf = prototype.valueOf;
call = valueOf.call;
Reflect = global.Reflect;
construct = Reflect.construct;
Boolean = global.Boolean;
closure = function() {
};
value = Reflect.apply(construct, Reflect, [Boolean, [], closure]);
value = Reflect.apply(call, valueOf, [value]);
var result = !value;
} catch (error) {
}
return (_isNativeReflectConstruct_69453_isNativeReflectConstruct = function() {
return !!result;
})();
}
function hasVideoBackgroundLive(a0) { // fn#69456, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9090:417, offset: 0x01c74391, size: 145 bytes, params: 2, frame: 18
var r2;
var moduleValue;
var getVideoBackgroundOptionFromProto;
var voiceAndVideo;
let value = a0;
const currentUser = UserStore.getCurrentUser();
if (currentUser == null) {
return false;
}
if (value != null) {
r2 = value;
} else {
value = undefined;
moduleValue = require(8906) /* metro dependency 8906: VideoBackgroundUtils */;
getVideoBackgroundOptionFromProto = moduleValue.getVideoBackgroundOptionFromProto;
voiceAndVideo = UserSettingsProtoStore.settings.voiceAndVideo;
value = Reflect.apply(getVideoBackgroundOptionFromProto, moduleValue,
[voiceAndVideo == null ? value : voiceAndVideo.videoBackgroundFilterDesktop, currentUser.id]);
r2 = value;
}
const selectedChannelStoreBinding = SelectedChannelStore;
const getVoiceChannelId = selectedChannelStoreBinding.getVoiceChannelId;
return Reflect.apply(getVoiceChannelId, selectedChannelStoreBinding,
[]) != null && MediaEngineStore.isVideoEnabled() && r2 != null;
}
function handleSyncedStoresUpdate() { // fn#69457, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9090:700, offset: 0x01c74422, size: 78 bytes, params: 1, frame: 11
const binding = voiceChannelId;
const selectedChannelStoreBinding = SelectedChannelStore;
const getVoiceChannelId = selectedChannelStoreBinding.getVoiceChannelId;
if (binding === Reflect.apply(getVoiceChannelId, selectedChannelStoreBinding, [])) {
}
if (hasVideoBackgroundLive()) {
}
voiceChannelId = SelectedChannelStore.getVoiceChannelId();
}
function _fun69458(a0) { // fn#69458, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9090:843, offset: 0x01c74470, size: 207 bytes, params: 2, frame: 16
const VideoBackgroundStore2 = VideoBackgroundStore;
Inherits(VideoBackgroundStore2, a0);
return CreateClass(VideoBackgroundStore2, [{key: 'initialize', value: function() {
this.waitFor(MediaEngineStore, SelectedChannelStore, UserSettingsProtoStore, UserStore);
this.syncWith([SelectedChannelStore, MediaEngineStore], handleSyncedStoresUpdate);
}}, {key: 'videoFilterAssets', get: get_69461}, {key: 'hasBeenApplied', get: get_69462},
{key: 'hasUsedBackgroundInCall', get: get_69463}, {key: 'videoBackgroundUnavailable', get: get_69464},
{key: 'videoBackgroundPreviewUnavailable', get: get_69465}]);
function VideoBackgroundStore() { // fn#69459, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9090:855, offset: 0x010992b7, size: 113 bytes, params: 1, frame: 20
const value = environment.__proto__;
env1_2(this, VideoBackgroundStore);
const value3 = env1_5(VideoBackgroundStore);
return env1_4(this, _isNativeReflectConstruct_69453() ? global.Reflect.construct(value3, arguments,
env1_5(this).constructor) : value3.apply(this, arguments));
}
function get_69461() { // fn#69461, offset: 0x00df0f5a, size: 9 bytes, params: 1, frame: 1
return env1_14;
}
function get_69462() { // fn#69462, offset: 0x00ef8482, size: 9 bytes, params: 1, frame: 1
return env1_11;
}
function get_69463() { // fn#69463, offset: 0x00e2f9d5, size: 9 bytes, params: 1, frame: 1
return env1_13;
}
function get_69464() { // fn#69464, offset: 0x00df0e8b, size: 9 bytes, params: 1, frame: 1
return env1_15;
}
function get_69465() { // fn#69465, offset: 0x00df0e94, size: 9 bytes, params: 1, frame: 1
return env1_16;
}
}
function VIDEO_FILTER_ASSETS_FETCH_SUCCESS({assets}) { // fn#69466, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9090:1649, offset: 0x01c7458a, size: 45 bytes, params: 2, frame: 12
const object = {};
assets.forEach(_fun69467);
function _fun69467(a0) { // fn#69467, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9090:1725, offset: 0x01c745b7, size: 21 bytes, params: 2, frame: 3
env0_0[a0.id] = a0;
return a0;
}
}
function VIDEO_FILTER_ASSET_UPLOAD_SUCCESS({videoFilterAsset}) { // fn#69468, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9090:1779, offset: 0x01c745cc, size: 43 bytes, params: 2, frame: 13
const object = {};
copyDataProperties(object, env0_14, videoFilterAsset);
object[videoFilterAsset.id] = videoFilterAsset;
}
function VIDEO_FILTER_ASSET_DELETE_SUCCESS({videoFilterAsset}) { // fn#69469, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9090:1883, offset: 0x01c745f7, size: 42 bytes, params: 2, frame: 13
const object = {};
copyDataProperties(object, env0_14, undefined);
delete object[videoFilterAsset.id];
}
function MEDIA_ENGINE_VIDEO_FILTER_ERROR({target}) { // fn#69472, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9090:2363, offset: 0x01c746b0, size: 41 bytes, params: 2, frame: 2
if (target === 'live') {
}
}
}
global.__d(_fun69452, 8905, [6, 7, 15, 17, 18, 1348, 4259, 1934, 1878, 8906, 4406, 566, 694,
2]) /* metro module 8905, dependencies: [6, 7, 15, 17, 18, 1348, 4259, 1934, 1878, 8906, 4406, 566, 694, 2] */;