Files
discord-decomp/sources/modules/self_mod/ChannelSafetyWarningsManager.tsx
2026-07-28 01:06:53 +03:00

186 lines
9.8 KiB
TypeScript

/* Metro module 15680; source: modules/self_mod/ChannelSafetyWarningsManager.tsx; dependencies: [7, 6, 15, 17, 18, 1379, 1934, 9702, 9730, 15681, 4860, 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 ChannelStore from '../../stores/ChannelStore.tsx'; /* Metro dependency 1379 */
import SelectedChannelStore from '../../stores/SelectedChannelStore.tsx'; /* Metro dependency 1934 */
import AutomaticLifecycleManager from '../../lib/AutomaticLifecycleManager.tsx'; /* Metro dependency 4860 */
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as SelfModInappropriateConversationExperimentModule from './inappropriate_conversation/SelfModInappropriateConversationExperiment.tsx'; /* Metro dependency 9702 */
function _fun120310(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#120310, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15888:6, offset: 0x0252792c, size: 280 bytes, params: 8, frame: 19
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = AutomaticLifecycleManager;
value = _fun120317(value);
value = new value();
(FileImportTrackerModule).fileFinishedImporting('modules/self_mod/ChannelSafetyWarningsManager.tsx');
exports.default = value;
function _isNativeReflectConstruct_120311() { // fn#120311, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15888:168, offset: 0x02527a44, 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_120311_isNativeReflectConstruct = function() {
return !!result;
})();
}
function handleChannelSelect_120314({channelId}) { // fn#120314, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15888:361, offset: 0x02527aa6, size: 262 bytes, params: 2, frame: 16
var r0;
var moduleValue2;
var channel;
var inappropriateConversationTakeoverForChannel;
var value4;
var showTakeoverModal;
if (channelId != null) {
var value;
var moduleValue = require(9702) /* metro dependency 9702: SelfModInappropriateConversationExperiment */;
var isEligibleForInappropriateConversationWarning = moduleValue.isEligibleForInappropriateConversationWarning;
var object = {location: 'channel_select'};
if (Reflect.apply(isEligibleForInappropriateConversationWarning, moduleValue, [object])) {
moduleValue2 = require(9730) /* metro dependency 9730: InappropriateConversationUtils */;
if (moduleValue2.getSafetyAlertsSettingOrDefault()) {
channel = ChannelStore.getChannel(channelId);
if (channel == null) {
return false;
}
if (channel.isDM()) {
inappropriateConversationTakeoverForChannel = (require(9730) /* metro dependency 9730: InappropriateConversationUtils */).getInappropriateConversationTakeoverForChannel(channelId);
value4 = inappropriateConversationTakeoverForChannel != null;
if (value4) {
value = require(15681) /* metro dependency 15681: showTakeoverModalNative */;
showTakeoverModal = value.showTakeoverModal;
object = {};
object.warningId = inappropriateConversationTakeoverForChannel.id;
object.warningType = inappropriateConversationTakeoverForChannel.type;
object.senderId = channel.getRecipientId();
object.channelId = channelId;
Reflect.apply(showTakeoverModal, value, [object]);
value = true;
r0 = value;
} else {
r0 = value4;
}
return r0;
}
return false;
}
return false;
}
}
return false;
}
function handleChannelUpdates_120315({channels}) { // fn#120315, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15888:817, offset: 0x02527bac, size: 305 bytes, params: 2, frame: 16
var r2;
var r0;
var moduleValue2;
var value3;
var moduleValue3;
var getInappropriateConversationTakeoverForChannel;
var id;
var value4;
var showTakeoverModal;
var value;
const isEligibleForInappropriateConversationWarning = SelfModInappropriateConversationExperimentModule.isEligibleForInappropriateConversationWarning;
let object = {location: 'channel_updates'};
if (Reflect.apply(isEligibleForInappropriateConversationWarning, SelfModInappropriateConversationExperimentModule,
[object])) {
moduleValue2 = require(9730) /* metro dependency 9730: InappropriateConversationUtils */;
if (moduleValue2.getSafetyAlertsSettingOrDefault()) {
if (SelectedChannelStore.getCurrentlySelectedChannelId() == null) {
return false;
}
value3 = channels.find(_fun120316);
if (value3 == null) {
return false;
}
moduleValue3 = require(9730) /* metro dependency 9730: InappropriateConversationUtils */;
getInappropriateConversationTakeoverForChannel = moduleValue3.getInappropriateConversationTakeoverForChannel;
id = value3.id;
value4 = Reflect.apply(getInappropriateConversationTakeoverForChannel, moduleValue3, [id]);
r2 = value4 == null || !value3.isDM();
if (r2) {
r0 = !r2;
} else {
value = require(15681) /* metro dependency 15681: showTakeoverModalNative */;
showTakeoverModal = value.showTakeoverModal;
object = {};
id = value4.id;
object.warningId = id;
object.warningType = value4.type;
object.senderId = value3.getRecipientId();
id = value3.id;
object.channelId = id;
Reflect.apply(showTakeoverModal, value, [object]);
value = true;
r0 = value;
}
return r0;
}
}
return false;
function _fun120316({id}) { // fn#120316, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15888:1087, offset: 0x00db0c48, size: 21 bytes, params: 2, frame: 2
return id === env0_0;
}
}
function _fun120317(a0) { // fn#120317, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15888:1338, offset: 0x02527cdd, size: 42 bytes, params: 2, frame: 14
const ChannelSafetyWarningsManager2 = ChannelSafetyWarningsManager;
Inherits(ChannelSafetyWarningsManager2, a0);
return CreateClass(ChannelSafetyWarningsManager2);
function ChannelSafetyWarningsManager(a0) { // fn#120318, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15888:1350, offset: 0x02527d07, size: 152 bytes, params: 2, frame: 20
var r0;
var Reflect;
let value = copyRestArgs(0, undefined);
let binding = env1_3;
binding(this, ChannelSafetyWarningsManager);
const items2 = [];
arraySpread(items2, value, 0, items2);
value = env1_5(ChannelSafetyWarningsManager);
binding = env1_4;
if (_isNativeReflectConstruct_120311()) {
Reflect = global.Reflect;
value = Reflect.construct(value, items2, env1_5(this).constructor);
r0 = value;
} else {
value = value.apply(this, items2);
r0 = value;
}
value = binding(this, r0);
value.actions = {CHANNEL_SELECT: handleChannelSelect_120314, CHANNEL_UPDATES: handleChannelUpdates_120315};
return value;
}
}
}
global.__d(_fun120310, 15680, [7, 6, 15, 17, 18, 1379, 1934, 9702, 9730, 15681, 4860,
2]) /* metro module 15680, dependencies: [7, 6, 15, 17, 18, 1379, 1934, 9702, 9730, 15681, 4860, 2] */;