172 lines
5.1 KiB
TypeScript
172 lines
5.1 KiB
TypeScript
// Metro module 4029 (f4030).
|
|
import AuthenticationStore from "./AuthenticationStore";
|
|
import { AnalyticEvents } from "../Constants";
|
|
import AnalyticsUtils from "../utils/AnalyticsUtils";
|
|
import Module589 from "../_bundle/Module589";
|
|
import { getOverlayStreamerModeConfig } from "../modules/overlay/OverlayV3Experiment";
|
|
import Dispatcher from "../Dispatcher";
|
|
let c2307_5 = {
|
|
enabled: false,
|
|
autoToggle: true,
|
|
hideInstantInvites: true,
|
|
hidePersonalInformation: true,
|
|
disableSounds: true,
|
|
disableNotifications: true,
|
|
disabledOverlayWidgets: [],
|
|
enableContentProtection: false
|
|
};
|
|
let c2307_6 = {};
|
|
let c2307_7 = {
|
|
...c2307_5
|
|
};
|
|
class StreamerModeStore extends Module589.PersistedStore {
|
|
static displayName = "StreamerModeStore";
|
|
static persistKey = "StreamerModeStore";
|
|
static migrations = [(a0) => {
|
|
let r8;
|
|
const id = AuthenticationStore.getId();
|
|
if (a0 != null && id != null) {
|
|
r8 = {};
|
|
r8[id] = {
|
|
...a0
|
|
};
|
|
} else {
|
|
r8 = {};
|
|
}
|
|
return r8;
|
|
}];
|
|
initialize(a0) {
|
|
Object.assign(c2307_6, a0);
|
|
this.syncWith([AuthenticationStore], () => {
|
|
let r10;
|
|
const id = AuthenticationStore.getId();
|
|
if (id != null) {
|
|
let r13 = c2307_6[id];
|
|
if (r13 == null) {
|
|
const r4 = {
|
|
...c2307_5
|
|
};
|
|
c2307_6[id] = r4;
|
|
r13 = r4;
|
|
}
|
|
r10 = r13;
|
|
} else {
|
|
r10 = {
|
|
...c2307_5
|
|
};
|
|
}
|
|
c2307_7 = r10;
|
|
});
|
|
}
|
|
getState() {
|
|
return c2307_6;
|
|
}
|
|
getSettings() {
|
|
return c2307_7;
|
|
}
|
|
get enabled() {
|
|
return c2307_7.enabled;
|
|
}
|
|
get autoToggle() {
|
|
return c2307_7.autoToggle;
|
|
}
|
|
get hideInstantInvites() {
|
|
return this.enabled && c2307_7.hideInstantInvites;
|
|
}
|
|
get hidePersonalInformation() {
|
|
return this.enabled && c2307_7.hidePersonalInformation;
|
|
}
|
|
get disableSounds() {
|
|
return this.enabled && c2307_7.disableSounds;
|
|
}
|
|
get disableNotifications() {
|
|
return this.enabled && c2307_7.disableNotifications;
|
|
}
|
|
get enableContentProtection() {
|
|
return this.enabled && c2307_7.enableContentProtection;
|
|
}
|
|
isOverlayWidgetDisabled(a0) {
|
|
let r13 = !!getOverlayStreamerModeConfig("StreamerModeStore").enabled;
|
|
if (r13) {
|
|
let enabled2 = this.enabled;
|
|
if (enabled2) {
|
|
const disabledOverlayWidgets = c2307_7.disabledOverlayWidgets;
|
|
enabled2 = (disabledOverlayWidgets == null ? void 0 : disabledOverlayWidgets.includes(a0)) === true;
|
|
}
|
|
r13 = enabled2;
|
|
}
|
|
return r13;
|
|
}
|
|
}
|
|
const streamerModeStore = new StreamerModeStore(Dispatcher, {
|
|
LOGOUT: function handleLogout(a0) {
|
|
if (!a0.isSwitchingAccount) {
|
|
c2307_6 = {};
|
|
}
|
|
},
|
|
MULTI_ACCOUNT_REMOVE_ACCOUNT: function handleMultiAccountRemove(a0) {
|
|
if (a0.userId in c2307_6) {
|
|
delete c2307_6[a0.userId];
|
|
}
|
|
},
|
|
STREAMER_MODE_UPDATE: function handleStreamerModeUpdate(a0) {
|
|
const r9 = {
|
|
...c2307_7
|
|
};
|
|
const r8 = Object;
|
|
const r17 = {};
|
|
r17[a0.key] = a0.value;
|
|
r8.assign(c2307_7, r17);
|
|
if (a0.key === "enabled" && typeof a0.value === "boolean") {
|
|
AnalyticsUtils.track(AnalyticEvents.STREAMER_MODE_TOGGLE, {
|
|
enabled: a0.value,
|
|
automatic: false
|
|
});
|
|
} else {
|
|
const UPDATE_STREAMER_MODE_SETTINGS = AnalyticEvents.UPDATE_STREAMER_MODE_SETTINGS;
|
|
const disabledOverlayWidgets = c2307_7.disabledOverlayWidgets;
|
|
let disabled_overlay_widgets = disabledOverlayWidgets == null ? void 0 : disabledOverlayWidgets.join(",");
|
|
if (disabled_overlay_widgets == null) {
|
|
disabled_overlay_widgets = "";
|
|
}
|
|
const disabledOverlayWidgets2 = r9.disabledOverlayWidgets;
|
|
let old_disabled_overlay_widgets = disabledOverlayWidgets2 == null ? void 0 : disabledOverlayWidgets2.join(",");
|
|
if (old_disabled_overlay_widgets == null) {
|
|
old_disabled_overlay_widgets = "";
|
|
}
|
|
AnalyticsUtils.track(UPDATE_STREAMER_MODE_SETTINGS, {
|
|
enabled: c2307_7.enabled,
|
|
automatic: c2307_7.autoToggle,
|
|
disable_notifications: c2307_7.disableNotifications,
|
|
disable_sounds: c2307_7.disableSounds,
|
|
hide_instant_invites: c2307_7.hideInstantInvites,
|
|
hide_personal_info: c2307_7.hidePersonalInformation,
|
|
enable_content_protection: c2307_7.enableContentProtection,
|
|
disabled_overlay_widgets,
|
|
old_enabled: r9.enabled,
|
|
old_automatic: r9.autoToggle,
|
|
old_disable_notifications: r9.disableNotifications,
|
|
old_disable_sounds: r9.disableSounds,
|
|
old_hide_instant_invites: r9.hideInstantInvites,
|
|
old_hide_personal_info: r9.hidePersonalInformation,
|
|
old_enable_content_protection: r9.enableContentProtection,
|
|
old_disabled_overlay_widgets
|
|
});
|
|
}
|
|
return true;
|
|
},
|
|
RUNNING_STREAMER_TOOLS_CHANGE: function handleRunningStreamerToolsChange(a0) {
|
|
if (c2307_7.autoToggle) {
|
|
const enabled2 = a0.count > 0;
|
|
c2307_7.enabled = enabled2;
|
|
AnalyticsUtils.track(AnalyticEvents.STREAMER_MODE_TOGGLE, {
|
|
enabled: enabled2,
|
|
automatic: true
|
|
});
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
});
|
|
export default streamerModeStore;
|