169 lines
5.4 KiB
TypeScript
169 lines
5.4 KiB
TypeScript
// Module ID: 9699
|
|
// Function ID: 9700
|
|
// Name: handleSyncedStoresUpdate
|
|
// Dependencies: [1340, 4501, 1980, 1922, 9700, 4574, 589, 709, 2]
|
|
|
|
// Module 9699 (handleSyncedStoresUpdate)
|
|
import initializeDefault from "initialize" /* 589 */;
|
|
import dispatcherDefault from "dispatcher" /* 709 */;
|
|
import BaseConnectionEvent from "BaseConnectionEvent" /* 4574 */;
|
|
import isAnimatedBackgroundOption from "isAnimatedBackgroundOption" /* 9700 */;
|
|
import closure_2 from "handleConnectionClosedOrResumed" /* 1340 */;
|
|
import closure_3 from "_detectH265HardwareDecode" /* 4501 */;
|
|
import closure_4 from "handleConnectionOpen" /* 1980 */;
|
|
import closure_5 from "mergeGuildAvatar" /* 1922 */;
|
|
|
|
require = arg1;
|
|
function handleSyncedStoresUpdate() {
|
|
if (voiceChannelId !== store.getVoiceChannelId()) {
|
|
c8 = false;
|
|
c10 = false;
|
|
c11 = false;
|
|
}
|
|
const currentUser = authStore.getCurrentUser();
|
|
let flag2 = false;
|
|
if (null != currentUser) {
|
|
const voiceAndVideo = closure_2.settings.voiceAndVideo;
|
|
let prop;
|
|
if (voiceAndVideo != null) {
|
|
prop = voiceAndVideo.videoBackgroundFilterDesktop;
|
|
}
|
|
const videoBackgroundOptionFromProto = isAnimatedBackgroundOption.getVideoBackgroundOptionFromProto(prop, currentUser.id);
|
|
let isVideoEnabledResult = null != obj.getVoiceChannelId();
|
|
if (isVideoEnabledResult) {
|
|
isVideoEnabledResult = closure_3.isVideoEnabled();
|
|
}
|
|
if (isVideoEnabledResult) {
|
|
isVideoEnabledResult = null != videoBackgroundOptionFromProto;
|
|
}
|
|
flag2 = isVideoEnabledResult;
|
|
const obj2 = isAnimatedBackgroundOption;
|
|
}
|
|
if (flag2) {
|
|
c8 = true;
|
|
}
|
|
voiceChannelId = obj.getVoiceChannelId();
|
|
}
|
|
let c6 = false;
|
|
let c7 = null;
|
|
let c8 = false;
|
|
let closure_9 = {};
|
|
let c10 = false;
|
|
let c11 = false;
|
|
const Store = initializeDefault.Store;
|
|
class VideoBackgroundStore extends Store {
|
|
}
|
|
const prototype = VideoBackgroundStore.prototype;
|
|
prototype["initialize"] = function initialize() {
|
|
this.waitFor(closure_3, closure_4, closure_2, closure_5);
|
|
const items = [closure_4, closure_3];
|
|
this.syncWith(items, handleSyncedStoresUpdate);
|
|
};
|
|
Object.defineProperty(prototype, "videoFilterAssets", {
|
|
get: function videoFilterAssets() {
|
|
return closure_9;
|
|
},
|
|
set: undefined
|
|
});
|
|
Object.defineProperty(prototype, "hasBeenApplied", {
|
|
get: function hasBeenApplied() {
|
|
return c6;
|
|
},
|
|
set: undefined
|
|
});
|
|
Object.defineProperty(prototype, "hasUsedBackgroundInCall", {
|
|
get: function hasUsedBackgroundInCall() {
|
|
return c8;
|
|
},
|
|
set: undefined
|
|
});
|
|
Object.defineProperty(prototype, "videoBackgroundUnavailable", {
|
|
get: function videoBackgroundUnavailable() {
|
|
return c10;
|
|
},
|
|
set: undefined
|
|
});
|
|
Object.defineProperty(prototype, "videoBackgroundPreviewUnavailable", {
|
|
get: function videoBackgroundPreviewUnavailable() {
|
|
return c11;
|
|
},
|
|
set: undefined
|
|
});
|
|
VideoBackgroundStore.displayName = "VideoBackgroundStore";
|
|
const videoBackgroundStore = new VideoBackgroundStore(dispatcherDefault, {
|
|
VIDEO_FILTER_ASSETS_FETCH_SUCCESS: function handleVideoFilterAssetFetchSuccess(assets) {
|
|
assets = assets.assets;
|
|
const obj = {};
|
|
const item = assets.forEach((id) => {
|
|
obj[id.id] = id;
|
|
return id;
|
|
});
|
|
},
|
|
VIDEO_FILTER_ASSET_UPLOAD_SUCCESS: function handleAddBackground(videoFilterAsset) {
|
|
videoFilterAsset = videoFilterAsset.videoFilterAsset;
|
|
const obj = {};
|
|
const merged = Object.assign(obj);
|
|
obj[videoFilterAsset.id] = videoFilterAsset;
|
|
},
|
|
VIDEO_FILTER_ASSET_DELETE_SUCCESS: function handleRemoveBackground(videoFilterAsset) {
|
|
const obj = {};
|
|
videoFilterAsset = videoFilterAsset.videoFilterAsset;
|
|
const merged = Object.assign(obj);
|
|
delete tmp2[tmp];
|
|
},
|
|
VIDEO_SAVE_LAST_USED_BACKGROUND_OPTION: function handleSaveLastUsedBackgroundOption(backgroundOption) {
|
|
backgroundOption = backgroundOption.backgroundOption;
|
|
const currentUser = authStore.getCurrentUser();
|
|
let flag = false;
|
|
if (null != currentUser) {
|
|
if (backgroundOption == null) {
|
|
const voiceAndVideo = closure_2.settings.voiceAndVideo;
|
|
let prop;
|
|
if (voiceAndVideo != null) {
|
|
prop = voiceAndVideo.videoBackgroundFilterDesktop;
|
|
}
|
|
backgroundOption = isAnimatedBackgroundOption.getVideoBackgroundOptionFromProto(prop, currentUser.id);
|
|
const obj = isAnimatedBackgroundOption;
|
|
}
|
|
let isVideoEnabledResult = null != store.getVoiceChannelId();
|
|
if (isVideoEnabledResult) {
|
|
isVideoEnabledResult = closure_3.isVideoEnabled();
|
|
}
|
|
if (isVideoEnabledResult) {
|
|
isVideoEnabledResult = null != backgroundOption;
|
|
}
|
|
flag = isVideoEnabledResult;
|
|
}
|
|
if (flag) {
|
|
c8 = true;
|
|
}
|
|
},
|
|
MEDIA_ENGINE_APPLY_MEDIA_FILTER_SETTINGS: function handleApplyMediaFilterSettings(settings) {
|
|
settings = settings.settings;
|
|
if (BaseConnectionEvent.FilterSettingsKey.CAMERA_BACKGROUND_LIVE in settings) {
|
|
c6 = true;
|
|
c10 = false;
|
|
}
|
|
if (BaseConnectionEvent.FilterSettingsKey.CAMERA_BACKGROUND_PREVIEW in settings) {
|
|
c11 = false;
|
|
}
|
|
},
|
|
MEDIA_ENGINE_VIDEO_FILTER_ERROR: function handleVideoFilterError(target) {
|
|
if ("live" === target.target) {
|
|
c10 = true;
|
|
} else {
|
|
c11 = true;
|
|
}
|
|
},
|
|
LOGOUT: function handleLogout() {
|
|
c6 = false;
|
|
c8 = false;
|
|
c7 = null;
|
|
closure_9 = {};
|
|
c10 = false;
|
|
c11 = false;
|
|
}
|
|
});
|
|
const result = require("set").fileFinishedImporting("modules/video_backgrounds/VideoBackgroundStore.tsx");
|
|
|
|
export default videoBackgroundStore;
|