338 lines
17 KiB
TypeScript
338 lines
17 KiB
TypeScript
/* Metro module 6607; source: modules/impersonate/ImpersonateActionCreators.tsx; dependencies: [1379, 1935, 1945, 1938, 3784, 1934, 4864, 1937, 661, 1386, 683, 4863, 1943, 694, 1230, 2] */
|
|
import AnalyticsUtils from '../../utils/AnalyticsUtils.tsx'; /* Metro dependency 683 */
|
|
import Dispatcher from '../../Dispatcher.tsx'; /* Metro dependency 694 */
|
|
import ChannelStore from '../../stores/ChannelStore.tsx'; /* Metro dependency 1379 */
|
|
import SelectedChannelStore from '../../stores/SelectedChannelStore.tsx'; /* Metro dependency 1934 */
|
|
import GuildChannelStore from '../../stores/GuildChannelStore.tsx'; /* Metro dependency 1935 */
|
|
import ImpersonateStore from './ImpersonateStore.tsx'; /* Metro dependency 1937 */
|
|
import GuildRoleStore from '../../stores/GuildRoleStore.tsx'; /* Metro dependency 1938 */
|
|
import GuildMemberStore from '../../stores/GuildMemberStore.tsx'; /* Metro dependency 1945 */
|
|
import PermissionStore from '../../stores/PermissionStore.tsx'; /* Metro dependency 3784 */
|
|
import UserGuildSettingsStore from '../../stores/UserGuildSettingsStore.tsx'; /* Metro dependency 4864 */
|
|
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */
|
|
import * as ChannelConstantsModule from '../channel/ChannelConstants.tsx'; /* Metro dependency 1386 */
|
|
import * as ImpersonateTypesModule from './ImpersonateTypes.tsx'; /* Metro dependency 1943 */
|
|
import * as AppAnalyticsUtilsModule from '../app_analytics/AppAnalyticsUtils.tsx'; /* Metro dependency 4863 */
|
|
|
|
function _fun52126(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#52126, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6785:6, offset: 0x0131fa66, size: 388 bytes, params: 8, frame: 21
|
|
const env0_0 = require;
|
|
const _arrayLikeToArray_52129 = function(a0, a1) {
|
|
var r0;
|
|
var r1;
|
|
var r2;
|
|
var value3;
|
|
var length;
|
|
var value5;
|
|
var value = undefined;
|
|
var value2 = value == null;
|
|
reducibleJoin2: while (true) {
|
|
if (value2) {
|
|
r0 = value2;
|
|
break reducibleJoin2;
|
|
}
|
|
value3 = value > a0.length;
|
|
r0 = value3;
|
|
break reducibleJoin2;
|
|
}
|
|
reducibleJoin4: while (true) {
|
|
if (r0) {
|
|
length = a0.length;
|
|
r1 = length;
|
|
break reducibleJoin4;
|
|
}
|
|
r1 = value;
|
|
break reducibleJoin4;
|
|
}
|
|
value = (0, global.Array)(r1);
|
|
var value4 = 0;
|
|
if (value4 < r1) {
|
|
r2 = value4;
|
|
reducibleLoop5: while (true) {
|
|
value[r2] = a0[r2];
|
|
value5 = typeof r2 === 'bigint' ? r2 + 1n : +r2 + 1;
|
|
if (value5 < r1) {
|
|
r2 = value5;
|
|
continue reducibleLoop5;
|
|
}
|
|
break reducibleLoop5;
|
|
}
|
|
}
|
|
return value;
|
|
};
|
|
const updateImpersonating2 = updateImpersonating;
|
|
const updateImpersonatedChannels2 = updateImpersonatedChannels;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
(FileImportTrackerModule).fileFinishedImporting('modules/impersonate/ImpersonateActionCreators.tsx');
|
|
exports.startImpersonating = startImpersonating;
|
|
exports.updateImpersonating = updateImpersonating2;
|
|
exports.stopImpersonating = stopImpersonating;
|
|
exports.updateImpersonatedChannels = updateImpersonatedChannels2;
|
|
exports.updateImpersonatedRoles = updateImpersonatedRoles;
|
|
exports.updateImpersonatedData = function(a0, a1) {
|
|
var updateImpersonatingBinding = updateImpersonating;
|
|
var object = {};
|
|
object.type = require(dependencyMap[12]).ImpersonateType.NEW_MEMBER;
|
|
copyDataProperties(object, a1, require);
|
|
updateImpersonatingBinding(a0, object);
|
|
};
|
|
function _createForOfIteratorHelperLoose_52127(a0, a1) { // fn#52127, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6785:269, offset: 0x0131fbea, size: 370 bytes, params: 3, frame: 20
|
|
var r6;
|
|
var r9;
|
|
var r5;
|
|
var value3;
|
|
var regexp;
|
|
const env0_0 = a0;
|
|
const Symbol = global.Symbol;
|
|
let value = typeof Symbol !== 'undefined';
|
|
let r1 = value && a0[global.Symbol.iterator];
|
|
r1 = !r1 ? a0['@@iterator'] : r1;
|
|
if (r1) {
|
|
value = r1.call(a0);
|
|
return value.next.bind(value);
|
|
}
|
|
const Array = global.Array;
|
|
if (Array.isArray(a0)) {
|
|
if (r1) {
|
|
}
|
|
return _fun52128;
|
|
}
|
|
value = undefined;
|
|
if (a0) {
|
|
if (typeof a0 === 'string') {
|
|
value = _arrayLikeToArray_52129(a0, value);
|
|
r5 = value;
|
|
} else {
|
|
value3 = ({}).toString.call(a0).slice(8, -1);
|
|
r6 = value3 === 'Object' && a0.constructor;
|
|
r9 = r6 ? a0.constructor.name : value3;
|
|
if (r9 === 'Map') {
|
|
r6 = global.Array.from(a0);
|
|
} else if (r9 === 'Set') {
|
|
r6 = global.Array.from(a0);
|
|
} else if (r9 === 'Arguments') {
|
|
value = _arrayLikeToArray_52129(a0, value);
|
|
r6 = value;
|
|
} else {
|
|
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
|
|
if (regexp.test(r9)) {
|
|
value = _arrayLikeToArray_52129(a0, value);
|
|
r6 = value;
|
|
} else {
|
|
r6 = value;
|
|
}
|
|
}
|
|
r5 = r6;
|
|
}
|
|
} else {
|
|
r5 = value;
|
|
}
|
|
if (r5) {
|
|
if (r5) {
|
|
}
|
|
return _fun52128;
|
|
}
|
|
const TypeError = global.TypeError;
|
|
throw new TypeError('Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.');
|
|
function _fun52128() { // fn#52128, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6785:840, offset: 0x00c39d73, size: 69 bytes, params: 1, frame: 5
|
|
return env0_1 >= env0_0.length ? {done: true} : {done: false,
|
|
value: env0_0[typeof env0_1 === 'bigint' ? env0_1 : +env0_1]};
|
|
}
|
|
|
|
}
|
|
|
|
function updateImpersonating(a0, a1) { // fn#52130, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6785:1179, offset: 0x0131fd5c, size: 285 bytes, params: 3, frame: 23
|
|
var defaultImport;
|
|
var track;
|
|
var VIEW_AS_ROLES_SELECTED;
|
|
var object;
|
|
var Object;
|
|
var moduleValue;
|
|
var defaultImport2;
|
|
var dispatch;
|
|
var object2;
|
|
const data = ImpersonateStore.getData(a0);
|
|
if (data != null && data.type === a1.type) {
|
|
defaultImport = importDefault(683) /* metro dependency 683: AnalyticsUtils */;
|
|
track = defaultImport.track;
|
|
VIEW_AS_ROLES_SELECTED = AnalyticEvents.VIEW_AS_ROLES_SELECTED;
|
|
object = {};
|
|
Object = global.Object;
|
|
object.num_roles = Object.keys(data.roles).length;
|
|
moduleValue = require(4863) /* metro dependency 4863: AppAnalyticsUtils */;
|
|
copyDataProperties(object, moduleValue.collectGuildAnalyticsMetadata(a0), require);
|
|
object['is_viewing_as_member'] = data.type === (require(1943) /* metro dependency 1943: ImpersonateTypes */).ImpersonateType.NEW_MEMBER;
|
|
Reflect.apply(track, defaultImport, [VIEW_AS_ROLES_SELECTED, object]);
|
|
defaultImport2 = importDefault(694) /* metro dependency 694: Dispatcher */;
|
|
dispatch = defaultImport2.dispatch;
|
|
object2 = {};
|
|
copyDataProperties(object2, data, require);
|
|
copyDataProperties(object2, a1, require);
|
|
Reflect.apply(dispatch, defaultImport2, [{type: 'IMPERSONATE_UPDATE', guildId: a0, data: object2}]);
|
|
puntFromSelectedChannelIfInaccessible(a0);
|
|
}
|
|
}
|
|
|
|
function puntFromSelectedChannelIfInaccessible(a0) { // fn#52131, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6785:1569, offset: 0x0131fe79, size: 161 bytes, params: 2, frame: 16
|
|
var permissionStoreBinding;
|
|
var defaultChannel;
|
|
var moduleValue;
|
|
const channelId = SelectedChannelStore.getChannelId(a0);
|
|
const channel = ChannelStore.getChannel(channelId);
|
|
if (channelId == null) {
|
|
permissionStoreBinding = PermissionStore;
|
|
if (!permissionStoreBinding.can(Permissions.VIEW_CHANNEL, channel)) {
|
|
defaultChannel = GuildChannelStore.getDefaultChannel(a0);
|
|
if (defaultChannel != null) {
|
|
moduleValue = require(1230) /* metro dependency 1230: router_utils */;
|
|
moduleValue.transitionTo(Routes.CHANNEL(a0, defaultChannel.id));
|
|
}
|
|
}
|
|
} else if (!isStaticChannelRoute(channelId)) {
|
|
permissionStoreBinding = PermissionStore;
|
|
if (!permissionStoreBinding.can(Permissions.VIEW_CHANNEL, channel)) {
|
|
defaultChannel = GuildChannelStore.getDefaultChannel(a0);
|
|
if (defaultChannel != null) {
|
|
moduleValue = require(1230) /* metro dependency 1230: router_utils */;
|
|
moduleValue.transitionTo(Routes.CHANNEL(a0, defaultChannel.id));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
function updateImpersonatedChannels(a0, a1, a2) { // fn#52132, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6785:1789, offset: 0x0131ff1a, size: 148 bytes, params: 4, frame: 17
|
|
const Set = global.Set;
|
|
const set = new Set(UserGuildSettingsStore.getOptedInChannels(a0));
|
|
a1.forEach(_fun52133);
|
|
a2.forEach(_fun52134);
|
|
const updateImpersonatingBinding = updateImpersonating;
|
|
const ImpersonateType = (ImpersonateTypesModule).ImpersonateType;
|
|
const NEW_MEMBER = ImpersonateType.NEW_MEMBER;
|
|
updateImpersonatingBinding(a0, {type: NEW_MEMBER, optInChannels: set});
|
|
function _fun52133(a0) { // fn#52133, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6785:1882, offset: 0x00c37e1f, size: 22 bytes, params: 2, frame: 11
|
|
return env0_0.add(a0);
|
|
}
|
|
|
|
function _fun52134(a0) { // fn#52134, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6785:1907, offset: 0x00ef2891, size: 22 bytes, params: 2, frame: 11
|
|
return env0_0.delete(a0);
|
|
}
|
|
|
|
}
|
|
|
|
function startImpersonating(a0, a1) { // fn#52135, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6785:2114, offset: 0x0131ffae, size: 217 bytes, params: 3, frame: 22
|
|
const defaultImport = AnalyticsUtils;
|
|
const track = defaultImport.track;
|
|
const VIEW_AS_ROLES_SELECTED = AnalyticEvents.VIEW_AS_ROLES_SELECTED;
|
|
const object = {};
|
|
const Object = global.Object;
|
|
object.num_roles = Object.keys(a1.roles).length;
|
|
copyDataProperties(object, AppAnalyticsUtilsModule.collectGuildAnalyticsMetadata(a0), require);
|
|
const type = a1.type;
|
|
const ImpersonateType = (ImpersonateTypesModule).ImpersonateType;
|
|
const NEW_MEMBER = ImpersonateType.NEW_MEMBER;
|
|
object['is_viewing_as_member'] = type === NEW_MEMBER;
|
|
Reflect.apply(track, defaultImport, [VIEW_AS_ROLES_SELECTED, object]);
|
|
(Dispatcher).dispatch({type: 'IMPERSONATE_UPDATE', guildId: a0,
|
|
data: a1});
|
|
puntFromSelectedChannelIfInaccessible(a0);
|
|
}
|
|
|
|
function stopImpersonating(a0) { // fn#52136, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6785:2511, offset: 0x01320087, size: 54 bytes, params: 2, frame: 13
|
|
(Dispatcher).dispatch({type: 'IMPERSONATE_STOP', guildId: a0});
|
|
}
|
|
|
|
function updateImpersonatedRoles(a0, a1) { // fn#52137, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6785:2681, offset: 0x013200bd, size: 147 bytes, params: 3, frame: 17
|
|
var r2;
|
|
var value4;
|
|
var id;
|
|
var value5;
|
|
((a0, a1) => {
|
|
var env0_0 = a0;
|
|
var value2 = GuildChannelStore.getSelectableChannelIds(a0);
|
|
var items = [];
|
|
arraySpread(items, GuildChannelStore.getVocalChannelIds(a0), arraySpread(items, value2, 0, a0), a0);
|
|
var env0_1 = items;
|
|
var Array = global.Array;
|
|
var env0_2 = Array.from(a1);
|
|
GuildChannelStore.addConditionalChangeListener(_fun52139);
|
|
})(a0, a1);
|
|
const object = {};
|
|
const _createForOfIteratorHelperLoose_52127Binding = _createForOfIteratorHelperLoose_52127;
|
|
const guildRoleStoreBinding = GuildRoleStore;
|
|
const getManyRoles = guildRoleStoreBinding.getManyRoles;
|
|
let value2 = _createForOfIteratorHelperLoose_52127Binding(Reflect.apply(getManyRoles, guildRoleStoreBinding, [a0,
|
|
a1]));
|
|
const value3 = value2();
|
|
let done = value3.done;
|
|
if (!done) {
|
|
for (r2 = value3; true; r2 = value5) {
|
|
value4 = r2.value;
|
|
id = value4.id;
|
|
object[id] = value4;
|
|
value5 = value2();
|
|
done = value5.done;
|
|
if (done) {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
const updateImpersonatingBinding = updateImpersonating;
|
|
const ImpersonateType = (ImpersonateTypesModule).ImpersonateType;
|
|
const NEW_MEMBER = ImpersonateType.NEW_MEMBER;
|
|
updateImpersonatingBinding(a0, {type: NEW_MEMBER, roles: object});
|
|
function optIntoPrivateChannelsForGrantedRolesForPreview(a0, a1) { // fn#52138, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6785:2720, owner: updateImpersonatedRoles.optIntoPrivateChannelsForGrantedRolesForPreview, offset: 0x01320150, size: 115 bytes, params: 3, frame: 17
|
|
const env0_0 = a0;
|
|
const selectableChannelIds = GuildChannelStore.getSelectableChannelIds(a0);
|
|
const items2 = [];
|
|
const value3 = arraySpread(items2, selectableChannelIds, 0, a0);
|
|
guildChannelStoreBinding = GuildChannelStore;
|
|
const getVocalChannelIds = guildChannelStoreBinding.getVocalChannelIds;
|
|
arraySpread(items2, Reflect.apply(getVocalChannelIds, guildChannelStoreBinding, [a0]), value3, a0);
|
|
const Array = global.Array;
|
|
const env0_2 = Array.from(a1);
|
|
GuildChannelStore.addConditionalChangeListener(_fun52139);
|
|
function _fun52139() { // fn#52139, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6785:2897, offset: 0x013201c3, size: 176 bytes, params: 1, frame: 19
|
|
const selfMember = GuildMemberStore.getSelfMember(selfMember2);
|
|
var selfMember2 = selfMember;
|
|
if (selfMember != null) {
|
|
var binding = env0_2;
|
|
if (binding.some(_fun52140)) {
|
|
return true;
|
|
}
|
|
var guildChannelStoreBinding = GuildChannelStore;
|
|
var getSelectableChannelIds = guildChannelStoreBinding.getSelectableChannelIds;
|
|
binding = selfMember2;
|
|
var value4 = Reflect.apply(getSelectableChannelIds, guildChannelStoreBinding, [binding]);
|
|
var items2 = [];
|
|
var value5 = arraySpread(items2, value4, 0, binding);
|
|
guildChannelStoreBinding = GuildChannelStore;
|
|
var getVocalChannelIds = guildChannelStoreBinding.getVocalChannelIds;
|
|
arraySpread(items2, Reflect.apply(getVocalChannelIds, guildChannelStoreBinding, [binding]), value5, binding);
|
|
var value6 = items2.filter(_fun52141);
|
|
if (value6.length > 0) {
|
|
updateImpersonatedChannels(selfMember2, value6, []);
|
|
}
|
|
}
|
|
return false;
|
|
function _fun52140(a0) { // fn#52140, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6785:2958, offset: 0x01320273, size: 31 bytes, params: 2, frame: 11
|
|
const roles = env0_0.roles;
|
|
return !roles.includes(a0);
|
|
}
|
|
|
|
function _fun52141(a0) { // fn#52141, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6785:3068, offset: 0x01320292, size: 25 bytes, params: 2, frame: 11
|
|
const binding = env1_1;
|
|
return !binding.includes(a0);
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun52126, 6607, [1379, 1935, 1945, 1938, 3784, 1934, 4864, 1937, 661, 1386, 683, 4863, 1943, 694, 1230,
|
|
2]) /* metro module 6607, dependencies: [1379, 1935, 1945, 1938, 3784, 1934, 4864, 1937, 661, 1386, 683, 4863, 1943, 694, 1230, 2] */;
|