235 lines
13 KiB
TypeScript
235 lines
13 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] */
|
|
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 closure = useActiveThreadIds;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_3 = importDefault(57) /* metro dependency 57 */;
|
|
const env0_4 = importAll(31) /* metro dependency 31 */;
|
|
const env0_5 = (require(12058) /* metro dependency 12058: ReportToModChannelStore */).useShouldShowResolvedFlagsForChannel;
|
|
const channelStore = importDefault(1379) /* metro dependency 1379: ChannelStore */;
|
|
const permissionStore = importDefault(3784) /* metro dependency 3784: PermissionStore */;
|
|
const readStateStore = importDefault(4605) /* metro dependency 4605: ReadStateStore */;
|
|
const activeThreadsStore = importDefault(4790) /* metro dependency 4790: ActiveThreadsStore */;
|
|
const archivedThreadsStore = importDefault(7154) /* metro dependency 7154: ArchivedThreadsStore */;
|
|
const joinedThreadsStore = importDefault(3786) /* metro dependency 3786: JoinedThreadsStore */;
|
|
const env0_12 = (require(482) /* metro dependency 482: Constants */).Permissions;
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/threads/ThreadBrowserHooks.tsx');
|
|
exports.useTrackThreadBrowserTab = useTrackThreadBrowserTab;
|
|
exports.useActiveThreadIds = closure;
|
|
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 env0_4.useMemo(_fun92642,
|
|
[(require(566) /* metro dependency 566: flux */).useStateFromStoresArray([PermissionStore, ActiveThreadsStore,
|
|
ChannelStore], _fun92638, [a0.guild_id, a0.id])]);
|
|
}
|
|
|
|
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
|
|
env0_4.useEffect(_fun92645, []);
|
|
}
|
|
|
|
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 fluxModule = require(566) /* metro dependency 566: flux */;
|
|
const useStateFromStores = fluxModule.useStateFromStores;
|
|
const value = env0_3(Reflect.apply(useStateFromStores, fluxModule, [[JoinedThreadsStore], _fun92647, [value2],
|
|
fluxModule.statesWillNeverBeEqual]), 2);
|
|
return {joinedThreadIds: value[0], unjoinedThreadIds: value[1]};
|
|
}
|
|
|
|
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 env0_4.useMemo(_fun92655,
|
|
[(require(566) /* metro dependency 566: flux */).useStateFromStoresArray([PermissionStore, ActiveThreadsStore,
|
|
ChannelStore], _fun92650, [a0])]);
|
|
}
|
|
|
|
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
|
|
var object2;
|
|
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 {canLoadMore, loading, nextOffset,
|
|
isInitialLoad} = (require(566) /* metro dependency 566: flux */).useStateFromStoresObject([ArchivedThreadsStore],
|
|
_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]);
|
|
object2 = {};
|
|
object2.threadIds = (require(566) /* metro dependency 566: flux */).useStateFromStoresArray([ArchivedThreadsStore,
|
|
ChannelStore, PermissionStore], _fun92663);
|
|
object2.canLoadMore = canLoadMore;
|
|
object2.loading = (loading || isInitialLoad) && showResolvedFlags && PermissionStore.can(Permissions.READ_MESSAGE_HISTORY,
|
|
a0);
|
|
object2.loadMore = value;
|
|
return object2;
|
|
}
|
|
|
|
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 = importDefault(22) /* metro dependency 22 */;
|
|
const getThreadsForParent = ActiveThreadsStore.getThreadsForParent;
|
|
const binding = env0_0;
|
|
const value5 = defaultImport(Reflect.apply(getThreadsForParent, ActiveThreadsStore, [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 _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__;
|
|
(require(7169) /* metro dependency 7169: ThreadUtils */).trackThreadBrowserTab();
|
|
}
|
|
|
|
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 _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 = importDefault(22) /* metro dependency 22 */;
|
|
const getThreadsForGuild = ActiveThreadsStore.getThreadsForGuild;
|
|
const value7 = defaultImport(Reflect.apply(getThreadsForGuild, ActiveThreadsStore,
|
|
[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 _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 _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 isLoading = ArchivedThreadsStore.isLoading;
|
|
const binding = env0_0;
|
|
const getIsInitialLoad = ArchivedThreadsStore.getIsInitialLoad;
|
|
const getCanLoadMore = ArchivedThreadsStore.getCanLoadMore;
|
|
const getNextOffset = ArchivedThreadsStore.getNextOffset;
|
|
return {loading: Reflect.apply(isLoading, ArchivedThreadsStore, [binding.id, require, importDefault, importAll]),
|
|
isInitialLoad: Reflect.apply(getIsInitialLoad, ArchivedThreadsStore, [binding.id, require, importDefault,
|
|
importAll]), canLoadMore: Reflect.apply(getCanLoadMore, ArchivedThreadsStore, [binding.id, require,
|
|
importDefault, importAll]), nextOffset: Reflect.apply(getNextOffset, ArchivedThreadsStore, [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 can = PermissionStore.can;
|
|
const READ_MESSAGE_HISTORY = Permissions.READ_MESSAGE_HISTORY;
|
|
const value3 = Reflect.apply(can, PermissionStore, [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 _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 = importDefault(22) /* metro dependency 22 */;
|
|
const getThreads = ArchivedThreadsStore.getThreads;
|
|
value = defaultImport(Reflect.apply(getThreads, ArchivedThreadsStore, [env0_0.id, require, importDefault,
|
|
importAll]));
|
|
value = value.filter(_fun92664);
|
|
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 (importDefault(22) /* metro dependency 22 */).values(a0);
|
|
}
|
|
|
|
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();
|
|
}
|
|
|