Files
discord-decomp/sources/stores/StreamerModeStore.tsx
T
2026-07-27 16:20:00 +03:00

282 lines
14 KiB
TypeScript

/* Metro module 3996; source: stores/StreamerModeStore.tsx; dependencies: [6, 7, 15, 17, 18, 1226, 661, 683, 3997, 566, 694, 2] */
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_3 = importDefault(6) /* metro dependency 6 */;
const env0_4 = importDefault(7) /* metro dependency 7 */;
const env0_5 = importDefault(15) /* metro dependency 15 */;
const env0_6 = importDefault(17) /* metro dependency 17 */;
const env0_7 = importDefault(18) /* metro dependency 18 */;
const authenticationStore = importDefault(1226) /* metro dependency 1226: AuthenticationStore */;
const env0_9 = (require(661) /* metro dependency 661: Constants */).AnalyticEvents;
const env0_11 = {};
copyDataProperties({}, {'enabled': false, 'autoToggle': true, 'hideInstantInvites': true,
'hidePersonalInformation': true, 'disableSounds': true, 'disableNotifications': true,
'disabledOverlayWidgets': null, 'enableContentProtection': false, disabledOverlayWidgets: []}, undefined);
const PersistedStore = (importDefault(566) /* metro dependency 566: 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});
(require(2) /* metro dependency 2 */).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 closure = StreamerModeStore;
env0_7(closure, a0);
return env0_4(closure, [{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 _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 object;
var object3;
const id = AuthenticationStore.getId();
if (a0 == null) {
object = {};
} else if (id == null) {
object = {};
} else {
object3 = {};
copyDataProperties(object3, a0, a0);
object = {[id]: object3};
}
return object;
}
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 object2;
var enabled;
var autoToggle;
var disableNotifications;
var disableSounds;
var hideInstantInvites;
var hidePersonalInformation;
var enableContentProtection;
var disabledOverlayWidgets;
const object4 = {};
var value;
copyDataProperties(object4, 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;
object2 = {};
enabled = env0_12.enabled;
object2.enabled = enabled;
autoToggle = env0_12.autoToggle;
object2.automatic = autoToggle;
disableNotifications = env0_12.disableNotifications;
object2.disable_notifications = disableNotifications;
disableSounds = env0_12.disableSounds;
object2.disable_sounds = disableSounds;
hideInstantInvites = env0_12.hideInstantInvites;
object2.hide_instant_invites = hideInstantInvites;
hidePersonalInformation = env0_12.hidePersonalInformation;
object2.hide_personal_info = hidePersonalInformation;
enableContentProtection = env0_12.enableContentProtection;
object2.enable_content_protection = enableContentProtection;
disabledOverlayWidgets = env0_12.disabledOverlayWidgets;
r11 = disabledOverlayWidgets == null ? value4 : disabledOverlayWidgets.join(',');
value = '';
object2.disabled_overlay_widgets = r11 ?? value;
enabled = object4.enabled;
object2.old_enabled = enabled;
autoToggle = object4.autoToggle;
object2.old_automatic = autoToggle;
disableNotifications = object4.disableNotifications;
object2.old_disable_notifications = disableNotifications;
disableSounds = object4.disableSounds;
object2.old_disable_sounds = disableSounds;
hideInstantInvites = object4.hideInstantInvites;
object2.old_hide_instant_invites = hideInstantInvites;
hidePersonalInformation = object4.hidePersonalInformation;
object2.old_hide_personal_info = hidePersonalInformation;
enableContentProtection = object4.enableContentProtection;
object2.old_enable_content_protection = enableContentProtection;
disabledOverlayWidgets = object4.disabledOverlayWidgets;
object2.old_disabled_overlay_widgets = (disabledOverlayWidgets == null ? value4 : disabledOverlayWidgets.join(',')) ?? value;
Reflect.apply(track, defaultImport, [UPDATE_STREAMER_MODE_SETTINGS, object2]);
} 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;
object2 = {};
enabled = env0_12.enabled;
object2.enabled = enabled;
autoToggle = env0_12.autoToggle;
object2.automatic = autoToggle;
disableNotifications = env0_12.disableNotifications;
object2.disable_notifications = disableNotifications;
disableSounds = env0_12.disableSounds;
object2.disable_sounds = disableSounds;
hideInstantInvites = env0_12.hideInstantInvites;
object2.hide_instant_invites = hideInstantInvites;
hidePersonalInformation = env0_12.hidePersonalInformation;
object2.hide_personal_info = hidePersonalInformation;
enableContentProtection = env0_12.enableContentProtection;
object2.enable_content_protection = enableContentProtection;
disabledOverlayWidgets = env0_12.disabledOverlayWidgets;
r11 = disabledOverlayWidgets == null ? value4 : disabledOverlayWidgets.join(',');
value = '';
object2.disabled_overlay_widgets = r11 ?? value;
enabled = object4.enabled;
object2.old_enabled = enabled;
autoToggle = object4.autoToggle;
object2.old_automatic = autoToggle;
disableNotifications = object4.disableNotifications;
object2.old_disable_notifications = disableNotifications;
disableSounds = object4.disableSounds;
object2.old_disable_sounds = disableSounds;
hideInstantInvites = object4.hideInstantInvites;
object2.old_hide_instant_invites = hideInstantInvites;
hidePersonalInformation = object4.hidePersonalInformation;
object2.old_hide_personal_info = hidePersonalInformation;
enableContentProtection = object4.enableContentProtection;
object2.old_enable_content_protection = enableContentProtection;
disabledOverlayWidgets = object4.disabledOverlayWidgets;
object2.old_disabled_overlay_widgets = (disabledOverlayWidgets == null ? value4 : disabledOverlayWidgets.join(',')) ?? value;
Reflect.apply(track, defaultImport, [UPDATE_STREAMER_MODE_SETTINGS, object2]);
}
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;
}
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 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 overlayV3ExperimentModule = require(3997) /* metro dependency 3997: OverlayV3Experiment */;
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 _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 object2;
var binding;
const id = AuthenticationStore.getId();
if (id != null) {
if (env2_11[id] == null) {
binding = env2_11;
object2 = {};
copyDataProperties(object2, env2_10, undefined);
binding[id] = object2;
}
} else {
copyDataProperties({}, env2_10, undefined);
}
}