251 lines
16 KiB
TypeScript
251 lines
16 KiB
TypeScript
/* Metro module 12057; source: modules/threads/ThreadBrowserHooks.tsx; dependencies: [57, 31, 12058, 1379, 3784, 4605, 4790, 7154, 3786, 482, 7169, 566, 22, 1360, 21, 7153, 9621, 2] */
|
|
import Module00022 from '../../by-id/module-00022.js'; /* Metro dependency 22 */
|
|
import Module00057 from '../../by-id/module-00057.js'; /* Metro dependency 57 */
|
|
import ChannelStore from '../../stores/ChannelStore.tsx'; /* Metro dependency 1379 */
|
|
import PermissionStore from '../../stores/PermissionStore.tsx'; /* Metro dependency 3784 */
|
|
import JoinedThreadsStore from './JoinedThreadsStore.tsx'; /* Metro dependency 3786 */
|
|
import ReadStateStore from '../../stores/ReadStateStore.tsx'; /* Metro dependency 4605 */
|
|
import ActiveThreadsStore from './ActiveThreadsStore.tsx'; /* Metro dependency 4790 */
|
|
import ArchivedThreadsStore from './ArchivedThreadsStore.tsx'; /* Metro dependency 7154 */
|
|
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as ReactModule from '../../by-id/module-00031-React.js'; /* Metro dependency 31 */
|
|
import * as ConstantsModule from '../../external/discord_common/js/shared/Constants.tsx'; /* Metro dependency 482 */
|
|
import * as FluxModule from '../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
|
|
import * as ThreadUtilsModule from './ThreadUtils.tsx'; /* Metro dependency 7169 */
|
|
import * as ReportToModChannelStoreModule from '../report_to_mod/ReportToModChannelStore.tsx'; /* Metro dependency 12058 */
|
|
|
|
function _fun92636(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#92636, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12243:6, offset: 0x02093496, size: 339 bytes, params: 8, frame: 20
|
|
const env0_0 = require;
|
|
const useActiveThreadIds2 = useActiveThreadIds;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
(FileImportTrackerModule).fileFinishedImporting('modules/threads/ThreadBrowserHooks.tsx');
|
|
exports.useTrackThreadBrowserTab = useTrackThreadBrowserTab;
|
|
exports.useActiveThreadIds = useActiveThreadIds2;
|
|
exports.useActiveThreads = useActiveThreads;
|
|
exports.useActiveGuildThreads = useActiveGuildThreads;
|
|
exports.useArchivedThreads = useArchivedThreads;
|
|
function useActiveThreadIds(a0) { // fn#92637, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12243:247, offset: 0x020935e9, size: 140 bytes, params: 2, frame: 18
|
|
const env0_0 = a0;
|
|
return ReactModule.useMemo(_fun92642,
|
|
[(FluxModule).useStateFromStoresArray([PermissionStore, ActiveThreadsStore,
|
|
ChannelStore], _fun92638, [a0.guild_id, a0.id])]);
|
|
function _fun92638() { // fn#92638, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12243:326, offset: 0x02093675, size: 168 bytes, params: 1, frame: 18
|
|
var environment;
|
|
let value = environment.__proto__;
|
|
const defaultImport = Module00022;
|
|
const activeThreadsStoreBinding = ActiveThreadsStore;
|
|
const getThreadsForParent = activeThreadsStoreBinding.getThreadsForParent;
|
|
const binding = env0_0;
|
|
const value5 = defaultImport(Reflect.apply(getThreadsForParent, activeThreadsStoreBinding, [binding.guild_id,
|
|
binding.id])).values().map(function({id}) {
|
|
return ChannelStore.getChannel(id);
|
|
});
|
|
value = value5.filter((require(1360) /* metro dependency 1360: GlobalUtils */).isNotNullish);
|
|
value = value.filter(function(a0) {
|
|
return PermissionStore.can(Permissions.VIEW_CHANNEL, a0);
|
|
});
|
|
value = value.map(function(a0) {
|
|
return a0.id;
|
|
});
|
|
return value.value();
|
|
}
|
|
|
|
function _fun92642() { // fn#92642, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12243:549, offset: 0x0209375a, size: 78 bytes, params: 1, frame: 11
|
|
var environment;
|
|
let value = environment.__proto__;
|
|
value = importDefault(22) /* metro dependency 22 */;
|
|
value = value(env0_1);
|
|
value = value.sort(function(a0, a1) {
|
|
return importDefault(dependencyMap[14]).compare(ReadStateStore.lastMessageId(a0),
|
|
ReadStateStore.lastMessageId(a1));
|
|
});
|
|
value = value.reverse();
|
|
return value.value();
|
|
}
|
|
|
|
}
|
|
|
|
function useTrackThreadBrowserTab() { // fn#92644, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12243:760, offset: 0x020937f3, size: 35 bytes, params: 1, frame: 13
|
|
ReactModule.useEffect(_fun92645, []);
|
|
function _fun92645() { // fn#92645, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12243:809, offset: 0x02093816, size: 37 bytes, params: 1, frame: 11
|
|
const value = environment.__proto__;
|
|
(ThreadUtilsModule).trackThreadBrowserTab();
|
|
}
|
|
|
|
}
|
|
|
|
function useActiveThreads(a0) { // fn#92646, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12243:913, offset: 0x0209383b, size: 143 bytes, params: 2, frame: 22
|
|
const value2 = useActiveThreadIds(a0);
|
|
const useStateFromStores = FluxModule.useStateFromStores;
|
|
const value = Module00057(Reflect.apply(useStateFromStores, FluxModule, [[JoinedThreadsStore], _fun92647, [value2],
|
|
FluxModule.statesWillNeverBeEqual]), 2);
|
|
return {joinedThreadIds: value[0], unjoinedThreadIds: value[1]};
|
|
function _fun92647() { // fn#92647, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12243:1005, offset: 0x020938ca, size: 55 bytes, params: 1, frame: 13
|
|
var environment;
|
|
let value = environment.__proto__;
|
|
value = importDefault(22) /* metro dependency 22 */;
|
|
return value.partition(env0_0, function(a0) {
|
|
return JoinedThreadsStore.hasJoined(a0);
|
|
});
|
|
}
|
|
|
|
}
|
|
|
|
function useActiveGuildThreads(a0) { // fn#92649, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12243:1175, offset: 0x02093918, size: 126 bytes, params: 2, frame: 17
|
|
const env0_0 = a0;
|
|
return ReactModule.useMemo(_fun92655,
|
|
[(FluxModule).useStateFromStoresArray([PermissionStore, ActiveThreadsStore,
|
|
ChannelStore], _fun92650, [a0])]);
|
|
function _fun92650() { // fn#92650, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12243:1257, offset: 0x02093996, size: 184 bytes, params: 1, frame: 16
|
|
var environment;
|
|
let value = environment.__proto__;
|
|
const defaultImport = Module00022;
|
|
const activeThreadsStoreBinding = ActiveThreadsStore;
|
|
const getThreadsForGuild = activeThreadsStoreBinding.getThreadsForGuild;
|
|
const value7 = defaultImport(Reflect.apply(getThreadsForGuild, activeThreadsStoreBinding,
|
|
[env0_0])).values().map(_fun92651).flatten().map(function({id}) {
|
|
return ChannelStore.getChannel(id);
|
|
});
|
|
value = value7.filter((require(1360) /* metro dependency 1360: GlobalUtils */).isNotNullish);
|
|
value = value.filter(function(a0) {
|
|
return PermissionStore.can(Permissions.VIEW_CHANNEL, a0);
|
|
});
|
|
value = value.map(function(a0) {
|
|
return a0.id;
|
|
});
|
|
return value.value();
|
|
function _fun92651(a0) { // fn#92651, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12243:1309, offset: 0x02093a4e, size: 40 bytes, params: 2, frame: 11
|
|
const value = environment.__proto__.__proto__;
|
|
return (Module00022).values(a0);
|
|
}
|
|
|
|
}
|
|
|
|
function _fun92655() { // fn#92655, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12243:1490, offset: 0x02093a76, size: 78 bytes, params: 1, frame: 11
|
|
var environment;
|
|
let value = environment.__proto__;
|
|
value = importDefault(22) /* metro dependency 22 */;
|
|
value = value(env0_1);
|
|
value = value.sort(function(a0, a1) {
|
|
return importDefault(dependencyMap[14]).compare(ReadStateStore.lastMessageId(a0),
|
|
ReadStateStore.lastMessageId(a1));
|
|
});
|
|
value = value.reverse();
|
|
return value.value();
|
|
}
|
|
|
|
}
|
|
|
|
function useArchivedThreads(a0, a1, a2, a3) { // fn#92657, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12243:1623, offset: 0x02093ac4, size: 460 bytes, params: 5, frame: 30
|
|
const env0_0 = a0;
|
|
const env0_1 = a1;
|
|
const env0_2 = a2;
|
|
const env0_3 = a3;
|
|
let value = a0.isModeratorReportChannel();
|
|
const env0_4 = value;
|
|
const showResolvedFlags = useShouldShowResolvedFlagsForChannel(a0.id).showResolvedFlags;
|
|
const useStateFromStoresObject = FluxModule.useStateFromStoresObject;
|
|
const archivedThreadsStoreBinding = ArchivedThreadsStore;
|
|
const {canLoadMore, loading, nextOffset, isInitialLoad} = Reflect.apply(useStateFromStoresObject, FluxModule,
|
|
[[archivedThreadsStoreBinding], _fun92658]);
|
|
value = env0_4.useCallback(_fun92659, [a0, a1, a2, a3, nextOffset, showResolvedFlags, value]);
|
|
const env0_9 = env0_4.useRef(value);
|
|
env0_4.useEffect(_fun92660);
|
|
env0_4.useEffect(_fun92661, [a0.id, a1, a2, isInitialLoad, showResolvedFlags]);
|
|
env0_4.useEffect(_fun92662, [a0.id, showResolvedFlags]);
|
|
object = {};
|
|
object.threadIds = FluxModule.useStateFromStoresArray([archivedThreadsStoreBinding, ChannelStore, PermissionStore],
|
|
_fun92663);
|
|
object.canLoadMore = canLoadMore;
|
|
object.loading = (loading || isInitialLoad) && showResolvedFlags && PermissionStore.can(Permissions.READ_MESSAGE_HISTORY,
|
|
a0);
|
|
object.loadMore = value;
|
|
return object;
|
|
function _fun92658() { // fn#92658, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12243:1764, offset: 0x02093c90, size: 164 bytes, params: 1, frame: 19
|
|
const archivedThreadsStoreBinding = ArchivedThreadsStore;
|
|
const isLoading = archivedThreadsStoreBinding.isLoading;
|
|
const binding = env0_0;
|
|
const getIsInitialLoad = archivedThreadsStoreBinding.getIsInitialLoad;
|
|
const getCanLoadMore = archivedThreadsStoreBinding.getCanLoadMore;
|
|
const getNextOffset = archivedThreadsStoreBinding.getNextOffset;
|
|
return {loading: Reflect.apply(isLoading, archivedThreadsStoreBinding, [binding.id, require, importDefault,
|
|
importAll]), isInitialLoad: Reflect.apply(getIsInitialLoad, archivedThreadsStoreBinding, [binding.id, require,
|
|
importDefault, importAll]), canLoadMore: Reflect.apply(getCanLoadMore, archivedThreadsStoreBinding, [binding.id,
|
|
require, importDefault, importAll]), nextOffset: Reflect.apply(getNextOffset, archivedThreadsStoreBinding,
|
|
[binding.id, require, importDefault, importAll])};
|
|
}
|
|
|
|
function _fun92659() { // fn#92659, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12243:2009, offset: 0x02093d34, size: 159 bytes, params: 1, frame: 15
|
|
var binding;
|
|
var loadArchivedThreads;
|
|
let value = environment.__proto__;
|
|
const permissionStoreBinding = PermissionStore;
|
|
const can = permissionStoreBinding.can;
|
|
const READ_MESSAGE_HISTORY = Permissions.READ_MESSAGE_HISTORY;
|
|
const value3 = Reflect.apply(can, permissionStoreBinding, [READ_MESSAGE_HISTORY, env0_0]);
|
|
if (!(value3 ? env0_4 && !showResolvedFlags : !value3)) {
|
|
value = importDefault(7153) /* metro dependency 7153: ThreadActionCreators */;
|
|
loadArchivedThreads = value.loadArchivedThreads;
|
|
binding = env0_0;
|
|
Reflect.apply(loadArchivedThreads, value, [{guildId: binding.guild_id, channelId: binding.id,
|
|
sortOrder: require,
|
|
tagFilter: importDefault, tagSetting: importAll, offset: nextOffset}]);
|
|
}
|
|
}
|
|
|
|
function _fun92660() { // fn#92660, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12243:2220, offset: 0x01f55925, size: 21 bytes, params: 1, frame: 2
|
|
env0_9.current = env0_8;
|
|
}
|
|
|
|
function _fun92661() { // fn#92661, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12243:2253, offset: 0x02093dd3, size: 27 bytes, params: 1, frame: 9
|
|
if (isInitialLoad) {
|
|
env0_9.current();
|
|
}
|
|
}
|
|
|
|
function _fun92662() { // fn#92662, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12243:2304, offset: 0x02093dee, size: 50 bytes, params: 1, frame: 12
|
|
let value = environment.__proto__;
|
|
value = importDefault(9621) /* metro dependency 9621: ForumActionCreators */;
|
|
value.resort(env0_0.id);
|
|
}
|
|
|
|
function _fun92663() { // fn#92663, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12243:2396, offset: 0x02093e20, size: 103 bytes, params: 1, frame: 19
|
|
var environment;
|
|
let value = environment.__proto__;
|
|
const defaultImport = Module00022;
|
|
const archivedThreadsStoreBinding = ArchivedThreadsStore;
|
|
const getThreads = archivedThreadsStoreBinding.getThreads;
|
|
value = defaultImport(Reflect.apply(getThreads, archivedThreadsStoreBinding, [env0_0.id, require, importDefault,
|
|
importAll]));
|
|
value = value.filter(_fun92664);
|
|
return value.value();
|
|
function _fun92664(a0) { // fn#92664, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12243:2443, offset: 0x02093e87, size: 94 bytes, params: 2, frame: 14
|
|
var r0;
|
|
var channel;
|
|
let value = environment.__proto__;
|
|
if (env1_4) {
|
|
if (showResolvedFlags) {
|
|
value = environment.__proto__.__proto__;
|
|
channel = ChannelStore.getChannel(a0);
|
|
r0 = channel != null && PermissionStore.can(Permissions.VIEW_CHANNEL, channel);
|
|
r0 = r0 && !channel.isMediaThread();
|
|
return r0;
|
|
}
|
|
return false;
|
|
}
|
|
value = environment.__proto__.__proto__;
|
|
channel = ChannelStore.getChannel(a0);
|
|
return channel != null && PermissionStore.can(Permissions.VIEW_CHANNEL, channel) && !channel.isMediaThread();
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun92636, 12057, [57, 31, 12058, 1379, 3784, 4605, 4790, 7154, 3786, 482, 7169, 566, 22, 1360, 21, 7153,
|
|
9621,
|
|
2]) /* metro module 12057, dependencies: [57, 31, 12058, 1379, 3784, 4605, 4790, 7154, 3786, 482, 7169, 566, 22, 1360, 21, 7153, 9621, 2] */;
|