308 lines
14 KiB
TypeScript
308 lines
14 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] */
|
|
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 closure = updateImpersonating;
|
|
const closure2 = updateImpersonatedChannels;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const channelStore = importDefault(1379) /* metro dependency 1379: ChannelStore */;
|
|
const guildChannelStore = importDefault(1935) /* metro dependency 1935: GuildChannelStore */;
|
|
const guildMemberStore = importDefault(1945) /* metro dependency 1945: GuildMemberStore */;
|
|
const guildRoleStore = importDefault(1938) /* metro dependency 1938: GuildRoleStore */;
|
|
const permissionStore = importDefault(3784) /* metro dependency 3784: PermissionStore */;
|
|
const selectedChannelStore = importDefault(1934) /* metro dependency 1934: SelectedChannelStore */;
|
|
const userGuildSettingsStore = importDefault(4864) /* metro dependency 4864: UserGuildSettingsStore */;
|
|
const impersonateStore = importDefault(1937) /* metro dependency 1937: ImpersonateStore */;
|
|
const constantsModule = require(661) /* metro dependency 661: Constants */;
|
|
const env0_11 = constantsModule.Permissions;
|
|
const env0_12 = constantsModule.Routes;
|
|
const env0_13 = constantsModule.AnalyticEvents;
|
|
const env0_14 = (require(1386) /* metro dependency 1386: ChannelConstants */).isStaticChannelRoute;
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/impersonate/ImpersonateActionCreators.tsx');
|
|
exports.startImpersonating = startImpersonating;
|
|
exports.updateImpersonating = closure;
|
|
exports.stopImpersonating = stopImpersonating;
|
|
exports.updateImpersonatedChannels = closure2;
|
|
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 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 object3;
|
|
var Object;
|
|
var moduleValue;
|
|
var defaultImport2;
|
|
var dispatch;
|
|
var object4;
|
|
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;
|
|
object3 = {};
|
|
Object = global.Object;
|
|
object3.num_roles = Object.keys(data.roles).length;
|
|
moduleValue = require(4863) /* metro dependency 4863: AppAnalyticsUtils */;
|
|
copyDataProperties(object3, moduleValue.collectGuildAnalyticsMetadata(a0), require);
|
|
object3['is_viewing_as_member'] = data.type === (require(1943) /* metro dependency 1943: ImpersonateTypes */).ImpersonateType.NEW_MEMBER;
|
|
Reflect.apply(track, defaultImport, [VIEW_AS_ROLES_SELECTED, object3]);
|
|
defaultImport2 = importDefault(694) /* metro dependency 694: Dispatcher */;
|
|
dispatch = defaultImport2.dispatch;
|
|
object4 = {};
|
|
copyDataProperties(object4, data, require);
|
|
copyDataProperties(object4, a1, require);
|
|
Reflect.apply(dispatch, defaultImport2, [{type: 'IMPERSONATE_UPDATE', guildId: a0, data: object4}]);
|
|
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 defaultChannel;
|
|
var moduleValue;
|
|
const channelId = SelectedChannelStore.getChannelId(a0);
|
|
const channel = ChannelStore.getChannel(channelId);
|
|
if (channelId == null) {
|
|
if (!PermissionStore.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)) {
|
|
if (!PermissionStore.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 = (require(1943) /* metro dependency 1943: ImpersonateTypes */).ImpersonateType;
|
|
const NEW_MEMBER = ImpersonateType.NEW_MEMBER;
|
|
updateImpersonatingBinding(a0, {type: NEW_MEMBER, optInChannels: set});
|
|
}
|
|
|
|
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 = importDefault(683) /* metro dependency 683: AnalyticsUtils */;
|
|
const track = defaultImport.track;
|
|
const VIEW_AS_ROLES_SELECTED = AnalyticEvents.VIEW_AS_ROLES_SELECTED;
|
|
const object2 = {};
|
|
const Object = global.Object;
|
|
object2.num_roles = Object.keys(a1.roles).length;
|
|
const appAnalyticsUtilsModule = require(4863) /* metro dependency 4863: AppAnalyticsUtils */;
|
|
copyDataProperties(object2, appAnalyticsUtilsModule.collectGuildAnalyticsMetadata(a0), require);
|
|
const type = a1.type;
|
|
const ImpersonateType = (require(1943) /* metro dependency 1943: ImpersonateTypes */).ImpersonateType;
|
|
const NEW_MEMBER = ImpersonateType.NEW_MEMBER;
|
|
object2['is_viewing_as_member'] = type === NEW_MEMBER;
|
|
Reflect.apply(track, defaultImport, [VIEW_AS_ROLES_SELECTED, object2]);
|
|
(importDefault(694) /* metro dependency 694: 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
|
|
(importDefault(694) /* metro dependency 694: 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 object2 = {};
|
|
const _createForOfIteratorHelperLoose_52127Binding = _createForOfIteratorHelperLoose_52127;
|
|
const getManyRoles = GuildRoleStore.getManyRoles;
|
|
let value2 = _createForOfIteratorHelperLoose_52127Binding(Reflect.apply(getManyRoles, GuildRoleStore, [a0, a1]));
|
|
const value3 = value2();
|
|
let done = value3.done;
|
|
if (!done) {
|
|
for (r2 = value3; true; r2 = value5) {
|
|
value4 = r2.value;
|
|
id = value4.id;
|
|
object2[id] = value4;
|
|
value5 = value2();
|
|
done = value5.done;
|
|
if (done) {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
const updateImpersonatingBinding = updateImpersonating;
|
|
const ImpersonateType = (require(1943) /* metro dependency 1943: ImpersonateTypes */).ImpersonateType;
|
|
const NEW_MEMBER = ImpersonateType.NEW_MEMBER;
|
|
updateImpersonatingBinding(a0, {type: NEW_MEMBER, roles: object2});
|
|
}
|
|
|
|
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);
|
|
const getVocalChannelIds = GuildChannelStore.getVocalChannelIds;
|
|
arraySpread(items2, Reflect.apply(getVocalChannelIds, GuildChannelStore, [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(env0_0);
|
|
var env0_0 = selfMember;
|
|
if (selfMember != null) {
|
|
var binding = env0_2;
|
|
if (binding.some(_fun52140)) {
|
|
return true;
|
|
}
|
|
var getSelectableChannelIds = GuildChannelStore.getSelectableChannelIds;
|
|
binding = env0_0;
|
|
var value4 = Reflect.apply(getSelectableChannelIds, GuildChannelStore, [binding]);
|
|
var items2 = [];
|
|
var value5 = arraySpread(items2, value4, 0, binding);
|
|
var getVocalChannelIds = GuildChannelStore.getVocalChannelIds;
|
|
arraySpread(items2, Reflect.apply(getVocalChannelIds, GuildChannelStore, [binding]), value5, binding);
|
|
var value6 = items2.filter(_fun52141);
|
|
if (value6.length > 0) {
|
|
updateImpersonatedChannels(env0_0, 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);
|
|
}
|
|
|