Files
discord-decomp/sources/stores/StreamerModeStore.tsx
T
2026-07-28 01:06:53 +03:00

303 lines
17 KiB
TypeScript

/* Metro module 3996; source: stores/StreamerModeStore.tsx; dependencies: [6, 7, 15, 17, 18, 1226, 661, 683, 3997, 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 AuthenticationStore from './AuthenticationStore.tsx'; /* Metro dependency 1226 */
import * as FileImportTrackerModule from '../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ConstantsModule from '../Constants.tsx'; /* Metro dependency 661 */
import * as OverlayV3ExperimentModule from '../modules/overlay/OverlayV3Experiment.tsx'; /* Metro dependency 3997 */
function _fun32826(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#32826, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4154:6, offset: 0x0101f518, size: 425 bytes, params: 8, frame: 19
const env0_0 = require;
const trackToggle = function(a0, a1) {
var defaultImport = importDefault(dependencyMap[7]);
var STREAMER_MODE_TOGGLE = AnalyticEvents.STREAMER_MODE_TOGGLE;
defaultImport.track(STREAMER_MODE_TOGGLE, {enabled: a0, automatic: a1});
};
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_11 = {};
copyDataProperties({}, {'enabled': false, 'autoToggle': true, 'hideInstantInvites': true,
'hidePersonalInformation': true, 'disableSounds': true, 'disableNotifications': true,
'disabledOverlayWidgets': null, 'enableContentProtection': false, disabledOverlayWidgets: []}, undefined);
const PersistedStore = (Flux).PersistedStore;
let value = _fun32831(PersistedStore);
value.displayName = 'StreamerModeStore';
value.persistKey = 'StreamerModeStore';
value.migrations = [_fun32845];
value = new value(importDefault(694) /* metro dependency 694: Dispatcher */, {LOGOUT: LOGOUT_32846,
MULTI_ACCOUNT_REMOVE_ACCOUNT: MULTI_ACCOUNT_REMOVE_ACCOUNT_32847, STREAMER_MODE_UPDATE: STREAMER_MODE_UPDATE,
RUNNING_STREAMER_TOOLS_CHANGE: RUNNING_STREAMER_TOOLS_CHANGE});
(FileImportTrackerModule).fileFinishedImporting('stores/StreamerModeStore.tsx');
exports.default = value;
function _isNativeReflectConstruct_32827() { // fn#32827, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4154:183, offset: 0x0101f6c1, size: 94 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_32827_isNativeReflectConstruct = function() {
return !!result;
})();
}
function _fun32831(a0) { // fn#32831, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4154:660, offset: 0x0101f760, size: 300 bytes, params: 2, frame: 16
const StreamerModeStore2 = StreamerModeStore;
Inherits(StreamerModeStore2, a0);
return CreateClass(StreamerModeStore2, [{key: 'initialize', value: value_32833}, {key: 'getState', value: value_32835},
{key: 'getSettings', value: value_32836}, {key: 'enabled', get: get_32837}, {key: 'autoToggle', get: get_32838},
{key: 'hideInstantInvites', get: get_32839}, {key: 'hidePersonalInformation', get: get_32840},
{key: 'disableSounds', get: get_32841}, {key: 'disableNotifications', get: get_32842},
{key: 'enableContentProtection', get: get_32843}, {key: 'isOverlayWidgetDisabled', value: value_32844}]);
function StreamerModeStore() { // fn#32832, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4154:672, offset: 0x00ef83e3, size: 113 bytes, params: 1, frame: 20
const value = environment.__proto__;
env1_3(this, StreamerModeStore);
const value3 = env1_6(StreamerModeStore);
return env1_5(this, _isNativeReflectConstruct_32827() ? global.Reflect.construct(value3, arguments,
env1_6(this).constructor) : value3.apply(this, arguments));
}
function value_32833(a0) { // fn#32833, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4154:975, offset: 0x0101f88c, size: 67 bytes, params: 2, frame: 15
const Object = global.Object;
Object.assign(env1_11, a0);
this.syncWith([AuthenticationStore], _fun32834);
function _fun32834() { // fn#32834, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4154:1025, offset: 0x0101f8cf, size: 85 bytes, params: 1, frame: 16
var object;
var binding;
const id = AuthenticationStore.getId();
if (id != null) {
if (env2_11[id] == null) {
binding = env2_11;
object = {};
copyDataProperties(object, env2_10, undefined);
binding[id] = object;
}
} else {
copyDataProperties({}, env2_10, undefined);
}
}
}
function value_32835() { // fn#32835, offset: 0x00ef8482, size: 9 bytes, params: 1, frame: 1
return env1_11;
}
function value_32836() { // fn#32836, offset: 0x00e2f9de, size: 9 bytes, params: 1, frame: 1
return env1_12;
}
function get_32837() { // fn#32837, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4154:1252, offset: 0x0101f924, size: 14 bytes, params: 1, frame: 1
return env1_12.enabled;
}
function get_32838() { // fn#32838, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4154:1304, offset: 0x0101f932, size: 15 bytes, params: 1, frame: 1
return env1_12.autoToggle;
}
function get_32839() { // fn#32839, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4154:1367, offset: 0x0101f941, size: 26 bytes, params: 1, frame: 2
return this.enabled && env1_12.hideInstantInvites;
}
function get_32840() { // fn#32840, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4154:1457, offset: 0x0101f95b, size: 26 bytes, params: 1, frame: 2
return this.enabled && env1_12.hidePersonalInformation;
}
function get_32841() { // fn#32841, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4154:1542, offset: 0x0101f975, size: 26 bytes, params: 1, frame: 2
return this.enabled && env1_12.disableSounds;
}
function get_32842() { // fn#32842, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4154:1624, offset: 0x0101f98f, size: 26 bytes, params: 1, frame: 2
return this.enabled && env1_12.disableNotifications;
}
function get_32843() { // fn#32843, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4154:1716, offset: 0x0101f9a9, size: 26 bytes, params: 1, frame: 2
return this.enabled && env1_12.enableContentProtection;
}
function value_32844(a0) { // fn#32844, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4154:1813, offset: 0x0101f9c3, size: 112 bytes, params: 2, frame: 14
const value = environment.__proto__;
const value2 = undefined;
const getOverlayStreamerModeConfig = OverlayV3ExperimentModule.getOverlayStreamerModeConfig;
const enabled = Reflect.apply(getOverlayStreamerModeConfig, OverlayV3ExperimentModule,
['StreamerModeStore']).enabled;
return enabled ? this.enabled && (env1_12.disabledOverlayWidgets == null ? value2 : env1_12.disabledOverlayWidgets.includes(a0)) === true : !!enabled;
}
}
function _fun32845(a0) { // fn#32845, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4154:2095, offset: 0x0101fa33, size: 55 bytes, params: 2, frame: 13
var object2;
var object4;
const id = AuthenticationStore.getId();
if (a0 == null) {
object2 = {};
} else if (id == null) {
object2 = {};
} else {
object4 = {};
copyDataProperties(object4, a0, a0);
object2 = {[id]: object4};
}
return object2;
}
function LOGOUT_32846(a0) { // fn#32846, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4154:2186, offset: 0x0101fa6a, size: 25 bytes, params: 2, frame: 2
if (!a0.isSwitchingAccount) {
env0_11 = {};
}
}
function MULTI_ACCOUNT_REMOVE_ACCOUNT_32847(a0) { // fn#32847, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4154:2270, offset: 0x0101fa83, size: 39 bytes, params: 2, frame: 4
const userId = a0.userId;
if (userId in env0_11) {
delete env0_11[a0.userId];
}
}
function STREAMER_MODE_UPDATE(a0) { // fn#32848, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4154:2363, offset: 0x0101faaa, size: 469 bytes, params: 2, frame: 22
var r11;
var value4;
var defaultImport;
var track;
var UPDATE_STREAMER_MODE_SETTINGS;
var object;
var enabled;
var autoToggle;
var disableNotifications;
var disableSounds;
var hideInstantInvites;
var hidePersonalInformation;
var enableContentProtection;
var disabledOverlayWidgets;
const object3 = {};
var value;
copyDataProperties(object3, env0_12, undefined);
const Object = global.Object;
Object.assign(env0_12, {[a0.key]: a0.value});
if (a0.key !== 'enabled') {
value4 = undefined;
defaultImport = importDefault(683) /* metro dependency 683: AnalyticsUtils */;
track = defaultImport.track;
UPDATE_STREAMER_MODE_SETTINGS = AnalyticEvents.UPDATE_STREAMER_MODE_SETTINGS;
object = {};
enabled = env0_12.enabled;
object.enabled = enabled;
autoToggle = env0_12.autoToggle;
object.automatic = autoToggle;
disableNotifications = env0_12.disableNotifications;
object.disable_notifications = disableNotifications;
disableSounds = env0_12.disableSounds;
object.disable_sounds = disableSounds;
hideInstantInvites = env0_12.hideInstantInvites;
object.hide_instant_invites = hideInstantInvites;
hidePersonalInformation = env0_12.hidePersonalInformation;
object.hide_personal_info = hidePersonalInformation;
enableContentProtection = env0_12.enableContentProtection;
object.enable_content_protection = enableContentProtection;
disabledOverlayWidgets = env0_12.disabledOverlayWidgets;
r11 = disabledOverlayWidgets == null ? value4 : disabledOverlayWidgets.join(',');
value = '';
object.disabled_overlay_widgets = r11 ?? value;
enabled = object3.enabled;
object.old_enabled = enabled;
autoToggle = object3.autoToggle;
object.old_automatic = autoToggle;
disableNotifications = object3.disableNotifications;
object.old_disable_notifications = disableNotifications;
disableSounds = object3.disableSounds;
object.old_disable_sounds = disableSounds;
hideInstantInvites = object3.hideInstantInvites;
object.old_hide_instant_invites = hideInstantInvites;
hidePersonalInformation = object3.hidePersonalInformation;
object.old_hide_personal_info = hidePersonalInformation;
enableContentProtection = object3.enableContentProtection;
object.old_enable_content_protection = enableContentProtection;
disabledOverlayWidgets = object3.disabledOverlayWidgets;
object.old_disabled_overlay_widgets = (disabledOverlayWidgets == null ? value4 : disabledOverlayWidgets.join(',')) ?? value;
Reflect.apply(track, defaultImport, [UPDATE_STREAMER_MODE_SETTINGS, object]);
} else if (typeof a0.value === 'boolean') {
trackToggle(a0.value, false);
} else {
value4 = undefined;
defaultImport = importDefault(683) /* metro dependency 683: AnalyticsUtils */;
track = defaultImport.track;
UPDATE_STREAMER_MODE_SETTINGS = AnalyticEvents.UPDATE_STREAMER_MODE_SETTINGS;
object = {};
enabled = env0_12.enabled;
object.enabled = enabled;
autoToggle = env0_12.autoToggle;
object.automatic = autoToggle;
disableNotifications = env0_12.disableNotifications;
object.disable_notifications = disableNotifications;
disableSounds = env0_12.disableSounds;
object.disable_sounds = disableSounds;
hideInstantInvites = env0_12.hideInstantInvites;
object.hide_instant_invites = hideInstantInvites;
hidePersonalInformation = env0_12.hidePersonalInformation;
object.hide_personal_info = hidePersonalInformation;
enableContentProtection = env0_12.enableContentProtection;
object.enable_content_protection = enableContentProtection;
disabledOverlayWidgets = env0_12.disabledOverlayWidgets;
r11 = disabledOverlayWidgets == null ? value4 : disabledOverlayWidgets.join(',');
value = '';
object.disabled_overlay_widgets = r11 ?? value;
enabled = object3.enabled;
object.old_enabled = enabled;
autoToggle = object3.autoToggle;
object.old_automatic = autoToggle;
disableNotifications = object3.disableNotifications;
object.old_disable_notifications = disableNotifications;
disableSounds = object3.disableSounds;
object.old_disable_sounds = disableSounds;
hideInstantInvites = object3.hideInstantInvites;
object.old_hide_instant_invites = hideInstantInvites;
hidePersonalInformation = object3.hidePersonalInformation;
object.old_hide_personal_info = hidePersonalInformation;
enableContentProtection = object3.enableContentProtection;
object.old_enable_content_protection = enableContentProtection;
disabledOverlayWidgets = object3.disabledOverlayWidgets;
object.old_disabled_overlay_widgets = (disabledOverlayWidgets == null ? value4 : disabledOverlayWidgets.join(',')) ?? value;
Reflect.apply(track, defaultImport, [UPDATE_STREAMER_MODE_SETTINGS, object]);
}
return true;
}
function RUNNING_STREAMER_TOOLS_CHANGE(a0) { // fn#32849, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4154:3347, offset: 0x0101fc7f, size: 60 bytes, params: 2, frame: 13
var value2;
if (env0_12.autoToggle) {
value2 = a0.count > 0;
env0_12.enabled = value2;
trackToggle(value2, true);
return true;
}
return false;
}
}
global.__d(_fun32826, 3996, [6, 7, 15, 17, 18, 1226, 661, 683, 3997, 566, 694,
2]) /* metro module 3996, dependencies: [6, 7, 15, 17, 18, 1226, 661, 683, 3997, 566, 694, 2] */;