This commit is contained in:
janisslsm committed 2026-11-01 12:12:55 +02:00
1 parent 1781d25a15
commit 732c0ad767
33051 files changed
+2591613 -3019689

No files matched your search

+31
View File
@@ -0,0 +1,31 @@
// Metro module 9508 (f9509).
const r11 = {
SOURCE_0: 0,
0: "SOURCE_0",
SOURCE_1: 1,
1: "SOURCE_1"
};
const r14 = {
UNSET: 0,
0: "UNSET",
SOURCE_1: 1,
1: "SOURCE_1",
SOURCE_2: 2,
2: "SOURCE_2"
};
export { r11 as SummarySources };
export { r14 as SummaryType };
export function createSummaryFromServer(a0, a1) {
return {
id: a0.id,
topic: a0.topic,
summShort: a0.summ_short,
people: Array.from(new Set(a0.people)),
startId: a0.start_id,
endId: a0.end_id,
count: a0.count,
channelId: a1,
source: a0.source,
type: a0.type
};
}
+728
View File
@@ -0,0 +1,728 @@
// Metro module 9548 (f9549).
import { useMemo, useEffect } from "react";
import GatewayConnectionStore from "../gateway/GatewayConnectionStore";
import ChannelStore from "../../stores/ChannelStore";
import SummaryStore from "./SummaryStore";
import { Routes } from "../../Constants";
import Durations from "../../utils/Durations";
import Dispatcher from "../../Dispatcher";
import { HTTP } from "../../_bundle/sendRequest";
import { APIError } from "../../errors/index";
import Module12 from "../../_bundle/Module12";
import { canSeeChannelSummaries } from "../../experiments/ChannelSummariesExperiment";
import { useStateFromStores, useStateFromStoresArray } from "../../_bundle/defaultAreStatesEqual";
import { HermesBuiltin, $createGenerator } from "../../_hermes/prelude";
function $mk82716($env) {
return () => $env[0].join(",");
}
function $mk82717($env) {
return () => {
let env26472 = {
$parent: $env
};
env26472[0] = function _fetch() {
const r9 = (0, env26472.$parent.$parent[3])(function() {
let c31504_0, c31504_2;
let c31504_1 = 0;
let c31504_4 = 0;
let c31504_3 = 0;
return $createGenerator(function() {
let value2, value3;
const r0 = c31504_4;
if (r0 === 2) {
c31504_4 = 3;
HermesBuiltin.throwTypeError("Generator functions may not be called on executing generators");
throw new Error("unreachable");
}
const value = arguments[1];
const r3 = arguments[0];
const r11 = env26472;
const r10 = env26472.$parent.$parent;
if (r0 === 3) {
if (r3 === 1) {
throw value;
}
if (r3 === 2) {
return {
value,
done: true
};
}
return {
value: void 0,
done: true
};
}
while (true) {
L26: {
L24: {
L20: {
L16: {
L14: {
L9: {
try {
c31504_4 = 2;
const r19 = c31504_1;
if (r19 === 0) {
if (r3 === 1) {
c31504_4 = 3;
throw value;
}
if (r3 === 2) {
c31504_4 = 3;
break L26;
}
c31504_0 = r11;
c31504_3 = 1;
value3 = (0, r10[15])();
c31504_1 = 3;
c31504_4 = 1;
break L24;
}
if (r19 === 1) {
c31504_3 = 0;
} else {
if (r19 === 2) {
if (r3 === 1) {
c31504_4 = 3;
throw value;
}
if (r3 === 2) {
c31504_4 = 3;
break L16;
}
c31504_4 = 3;
break L14;
}
if (r3 === 1) {
c31504_4 = 3;
throw value;
}
if (r3 === 2) {
c31504_3 = 0;
c31504_4 = 3;
break L9;
}
c31504_3 = 0;
}
const r28 = c31504_0;
value2 = (0, r28.$parent.$parent[17])(r28.$parent[2].split(","));
c31504_1 = 2;
c31504_4 = 1;
break L20;
} catch (r43) {
c31504_2 = r43;
if (c31504_3 === 0) {
c31504_4 = 3;
throw r43;
}
c31504_1 = 1;
continue;
}
}
return {
value,
done: true
};
}
return {
value: void 0,
done: true
};
}
return {
value,
done: true
};
}
return {
value: value2,
done: false
};
}
return {
value: value3,
done: false
};
}
return {
value,
done: true
};
}
});
});
env26472[0] = r9;
return r9.apply(this, arguments);
};
if ($env[1]) {
(function() {
return env26472[0].apply(this, arguments);
})();
}
};
}
function $mk115491($env) {
return (a0) => canSeeChannelSummaries(ChannelStore.getChannel(a0), false, true);
}
function $mk115492($env) {
return (a0) => {
const r8 = Date.now();
const r10 = SummaryStore.status(a0);
if (r10?.fetching) {
return false;
}
const lastReceivedAt = r10?.lastReceivedAt;
return lastReceivedAt == null || r8 - lastReceivedAt > c6295_9;
};
}
let fetchChannelAffinities, fetchSummariesBulk, c6295_9, c6295_10, c6295_11;
let $mk82715 = function() {
return () => GatewayConnectionStore.isConnected();
};
let env6295 = {};
export async function fetchSummary(channelId, summaryId) {
let c26468_4;
let c26468_5 = 0;
let c30108_0, c30108_1, c30108_2, c30108_3, c30108_4, c30108_5;
L16: {
try {
c30108_0 = channelId;
c30108_1 = void 0;
c30108_2 = void 0;
c30108_3 = void 0;
c30108_4 = void 0;
if (SummaryStore.shouldFetch(channelId, summaryId)) {
const requestedAt = Date.now();
c30108_1 = requestedAt;
Dispatcher.dispatch({
type: "REQUEST_CHANNEL_SUMMARY",
channelId,
summaryId,
requestedAt
});
c30108_2 = void 0;
c30108_3 = void 0;
c26468_5 = 1;
c30108_4 = await HTTP.get({
url: Routes.CHANNEL_SUMMARY(channelId, summaryId),
rejectWithError: false
});
c30108_3 = c30108_4?.body;
c26468_5 = 0;
Dispatcher.dispatch({
type: "RECEIVE_CHANNEL_SUMMARY",
channelId: c30108_0,
summary: c30108_3,
error: c30108_2,
requestedAt: c30108_1,
receivedAt: Date.now()
});
break L16;
}
} catch ($e) {
const r30 = $e;
let r8 = r30;
c26468_4 = r30;
if (c26468_5 !== 0) {
while (true) {
try {
const r100 = c26468_4;
c26468_5 = 0;
c30108_5 = r100;
c30108_2 = new APIError(c30108_5);
Dispatcher.dispatch({
type: "RECEIVE_CHANNEL_SUMMARY",
channelId: c30108_0,
summary: c30108_3,
error: c30108_2,
requestedAt: c30108_1,
receivedAt: Date.now()
});
break L16;
} catch (r96) {
r8 = r96;
c26468_4 = r96;
if (c26468_5 === 0) {
break;
}
}
}
}
throw r8;
}
return void 0;
}
}
export async function fetchSummaries(channelId2) {
let summaries, summaries2;
let body, error, c26469_5;
let c26469_6 = 0;
let c30109_0, c30109_1, c30109_2, c30109_3, c30109_4, c30109_5;
L26: {
try {
c30109_0 = channelId2;
c30109_1 = void 0;
c30109_2 = void 0;
c30109_3 = void 0;
c30109_4 = void 0;
if (SummaryStore.shouldFetch(channelId2)) {
const requestedAt = Date.now();
c30109_1 = requestedAt;
Dispatcher.dispatch({
type: "REQUEST_CHANNEL_SUMMARIES",
channelId: channelId2,
requestedAt
});
c30109_2 = void 0;
c30109_3 = void 0;
c26469_6 = 1;
c30109_3 = await HTTP.get({
url: Routes.CHANNEL_SUMMARIES(channelId2),
rejectWithError: false
});
c26469_6 = 0;
const r74 = c30109_3;
const r78 = (r74 == null ? void 0 : r74.body?.summaries) instanceof Array;
const r80 = c30109_3;
if (r78) {
summaries = r80.body.summaries;
} else {
const body2 = r80?.body;
body = body2;
if (body2 == null) {
body = [];
}
summaries = body;
}
c30109_4 = summaries;
c30109_4 = Module12.takeRight(c30109_4, 75);
error = c30109_2;
if (error == null) {
error = void 0;
}
Dispatcher.dispatch({
type: "RECEIVE_CHANNEL_SUMMARIES",
channelId: c30109_0,
summaries: c30109_4,
error,
requestedAt: c30109_1,
receivedAt: Date.now()
});
break L26;
}
} catch ($e) {
const r30 = $e;
let r8 = r30;
c26469_5 = r30;
if (c26469_6 !== 0) {
while (true) {
try {
const r121 = c26469_5;
c26469_6 = 0;
c30109_5 = r121;
c30109_2 = new APIError(c30109_5);
const r132 = c30109_3;
const r136 = (r132 == null ? void 0 : r132.body?.summaries) instanceof Array;
const r138 = c30109_3;
if (r136) {
summaries2 = r138.body.summaries;
} else {
const body3 = r138?.body;
body = body3;
if (body3 == null) {
body = [];
}
summaries2 = body;
}
c30109_4 = summaries2;
c30109_4 = Module12.takeRight(c30109_4, 75);
error = c30109_2;
if (error == null) {
error = void 0;
}
Dispatcher.dispatch({
type: "RECEIVE_CHANNEL_SUMMARIES",
channelId: c30109_0,
summaries: c30109_4,
error,
requestedAt: c30109_1,
receivedAt: Date.now()
});
break L26;
} catch (r117) {
r8 = r117;
c26469_5 = r117;
if (c26469_6 === 0) {
break;
}
}
}
}
throw r8;
}
return void 0;
}
}
export function setHighlightedSummary(a0, a1) {
Dispatcher.dispatch({
type: "SET_HIGHLIGHTED_SUMMARY",
channelId: a0,
summaryId: a1 == null ? null : a1
});
}
export function setSelectedSummary(a0, a1) {
let summaryId2 = a1;
if (a0 != null && a1 != null) {
fetchSummary(a0, a1);
}
if (a1 == null) {
summaryId2 = null;
}
Dispatcher.dispatch({
type: "SET_SELECTED_SUMMARY",
channelId: a0,
summaryId: summaryId2
});
}
export function updateVisibleMessages(a0, a1) {
Dispatcher.dispatch({
type: "UPDATE_VISIBLE_MESSAGES",
topVisibleMessage: a0 == null ? null : a0,
bottomVisibleMessage: a1 == null ? null : a1
});
}
export function setSummaryFeedback(a0, a1) {
Dispatcher.dispatch({
type: "SET_SUMMARY_FEEDBACK",
summary: a0,
rating: a1
});
}
fetchChannelAffinities = async function fetchChannelAffinities() {
let r50;
let error2, c26470_3;
let c26470_4 = 0;
let c30110_0, c30110_1, c30110_2, c30110_3, c30110_4;
L18: {
try {
c30110_0 = void 0;
c30110_1 = void 0;
c30110_2 = void 0;
c30110_3 = void 0;
if (SummaryStore.shouldFetchChannelAffinities()) {
const requestedAt = Date.now();
c30110_0 = requestedAt;
Dispatcher.dispatch({
type: "REQUEST_CHANNEL_AFFINITIES",
requestedAt
});
c30110_1 = void 0;
c30110_2 = void 0;
c26470_4 = 1;
c30110_2 = await HTTP.get({
url: "/users/@me/affinities/channels",
rejectWithError: false
});
c26470_4 = 0;
const r70 = c30110_2;
c30110_3 = r70 == null ? void 0 : r70.body?.channel_affinities;
error2 = c30110_1;
if (error2 == null) {
error2 = void 0;
}
Dispatcher.dispatch({
type: "RECEIVE_CHANNEL_AFFINITIES",
affinities: c30110_3,
error: error2,
requestedAt: c30110_0,
receivedAt: Date.now()
});
break L18;
}
r50 = Promise.resolve(null);
} catch ($e) {
const r27 = $e;
let r8 = r27;
c26470_3 = r27;
if (c26470_4 !== 0) {
while (true) {
try {
const r100 = c26470_3;
c26470_4 = 0;
c30110_4 = r100;
c30110_1 = new APIError(c30110_4);
const r111 = c30110_2;
c30110_3 = r111 == null ? void 0 : r111.body?.channel_affinities;
error2 = c30110_1;
if (error2 == null) {
error2 = void 0;
}
Dispatcher.dispatch({
type: "RECEIVE_CHANNEL_AFFINITIES",
affinities: c30110_3,
error: error2,
requestedAt: c30110_0,
receivedAt: Date.now()
});
break L18;
} catch (r96) {
r8 = r96;
c26470_3 = r96;
if (c26470_4 === 0) {
break;
}
}
}
}
throw r8;
}
return r50;
}
};
fetchSummariesBulk = async function fetchSummariesBulk(c26471_0, c26471_1) {
let r86, useChannelAffinities;
let c26471_2, c26471_3, c26471_4, c26471_5;
let c26471_6 = 0;
const r13 = env6295;
L27: {
L26: {
try {
let env30111;
c26471_4 = r13;
const r36 = env30111 = {
$parent: r13
};
c26471_3 = r36;
env30111[1] = void 0;
env30111[2] = void 0;
env30111[0] = c26471_0;
let r37 = c26471_1;
if (r37 === void 0) {
r37 = {};
}
L15: {
L12: {
const useQuickSwitcher = r37.useQuickSwitcher;
if (useQuickSwitcher !== void 0) {
env30111[1] = useQuickSwitcher;
useChannelAffinities = r37.useChannelAffinities;
if (useChannelAffinities !== void 0) {
break L12;
}
} else {
env30111[1] = true;
useChannelAffinities = r37.useChannelAffinities;
if (useChannelAffinities !== void 0) {
break L12;
}
}
env30111[2] = true;
env30111[3] = void 0;
env30111[4] = void 0;
env30111[5] = void 0;
env30111[6] = void 0;
break L15;
}
env30111[2] = useChannelAffinities;
env30111[3] = void 0;
env30111[4] = void 0;
env30111[5] = void 0;
env30111[6] = void 0;
}
await void 0;
const r61 = env30111[0];
c26471_2 = r61;
if (r61 == null) {
c26471_2 = [];
}
env30111[0] = c26471_2;
env30111[3] = Date.now();
const r72 = env30111[0].concat(SummaryStore.defaultChannelIds({
withQuickSwitcher: env30111[1],
withChannelAffinities: env30111[2]
}));
const r74 = env6295;
const r81 = r72.filter($mk115491(r74)).filter($mk115492(r74)).slice(0, 50);
env30111[0] = r81;
if (r81.length === 0) {
r86 = Promise.resolve(null);
break L27;
}
Dispatcher.dispatch({
type: "REQUEST_CHANNEL_SUMMARIES_BULK",
channelIds: env30111[0],
requestedAt: env30111[3]
});
env30111[4] = void 0;
env30111[5] = void 0;
c26471_6 = 1;
env30111[5] = await HTTP.post({
url: Routes.USER_SUMMARIES,
body: {
channel_ids: env30111[0]
},
rejectWithError: false
});
c26471_6 = 0;
const r133 = env30111[5];
env30111[6] = r133 == null ? void 0 : r133.body.summaries;
Dispatcher.dispatch({
type: "RECEIVE_CHANNEL_SUMMARIES_BULK",
requestedAt: env30111[3],
receivedAt: Date.now(),
summaries: env30111[6],
requestArgs: {
channelIds: env30111[0]
},
error: env30111[4]
});
} catch ($e) {
const r34 = $e;
let r8 = r34;
c26471_5 = r34;
if (c26471_6 !== 0) {
while (true) {
try {
const r162 = c26471_5;
c26471_6 = 0;
env30111[7] = r162;
env30111[4] = new APIError(env30111[7]);
const r173 = env30111[5];
env30111[6] = r173 == null ? void 0 : r173.body.summaries;
Dispatcher.dispatch({
type: "RECEIVE_CHANNEL_SUMMARIES_BULK",
requestedAt: env30111[3],
receivedAt: Date.now(),
summaries: env30111[6],
requestArgs: {
channelIds: env30111[0]
},
error: env30111[4]
});
break L26;
} catch (r158) {
r8 = r158;
c26471_5 = r158;
if (c26471_6 === 0) {
break;
}
}
}
}
throw r8;
}
}
return void 0;
}
return r86;
};
export function useChannelSummaries({ channelIds }) {
if (channelIds === void 0) {
channelIds = [];
}
if (channelIds === void 0) {
channelIds = [];
}
let env17285;
const r4 = env17285 = {
$parent: env6295
};
env17285[0] = channelIds;
env17285[1] = void 0;
env17285[2] = void 0;
const stateFromStores = useStateFromStores([GatewayConnectionStore], $mk82715());
env17285[1] = stateFromStores;
const memo = useMemo($mk82716(r4), [channelIds]);
env17285[2] = memo;
useEffect($mk82717(r4), [memo, stateFromStores]);
return useStateFromStoresArray([SummaryStore], () => SummaryStore.topSummaries(), []);
}
export async function deleteSummary(c26473_0) {
let c26473_3;
let c26473_4 = 0;
let c30112_0, c30112_1;
try {
c30112_0 = c26473_0;
c26473_4 = 1;
await HTTP.del({
url: Routes.CHANNEL_SUMMARY(c26473_0.channelId, c26473_0.id),
rejectWithError: false
});
Dispatcher.dispatch({
type: "DELETE_SUMMARY",
summary: c30112_0
});
c26473_4 = 0;
} catch ($e) {
const r28 = $e;
let r8 = r28;
c26473_3 = r28;
if (c26473_4 !== 0) {
while (true) {
try {
const r72 = c26473_3;
c26473_4 = 0;
c30112_1 = r72;
throw new APIError(c30112_1);
} catch (r68) {
r8 = r68;
c26473_3 = r68;
if (c26473_4 === 0) {
break;
}
}
}
}
throw r8;
}
}
c6295_9 = 30 * Durations.Millis.SECOND;
c6295_10 = {};
c6295_11 = {};
const r49 = {
setSummaryFeedback,
updateVisibleMessages,
setSelectedSummary,
setHighlightedSummary,
fetchSummaries,
fetchSummariesBulk,
useChannelSummaries,
deleteSummary
};
export default r49;
export function toggleTopicsBar() {
Dispatcher.dispatch({
type: "TOGGLE_TOPICS_BAR"
});
}
export function stopPolling(a0) {
if (c6295_10[a0] == null) {
c6295_10[a0] = 0;
}
c6295_10[a0] = c6295_10[a0] + -1;
if (c6295_10[a0] <= 0) {
if (c6295_10[a0] == null) {
c6295_10[a0] = 0;
}
c6295_10[a0] = c6295_10[a0] + 0;
c6295_10[a0];
clearInterval(c6295_11[a0]);
}
}
export { fetchChannelAffinities };
export { fetchSummariesBulk };
export function useMaybeFetchChannelAffinitiesAndSummaries(r2 = []) {
let env17284;
const r1 = env17284 = {
$parent: env6295
};
env17284[0] = r2;
env17284[1] = void 0;
env17284[2] = void 0;
const stateFromStores = useStateFromStores([GatewayConnectionStore], $mk82715());
env17284[1] = stateFromStores;
const memo = useMemo($mk82716(r1), [r2]);
env17284[2] = memo;
useEffect($mk82717(r1), [memo, stateFromStores]);
}
+48
View File
@@ -0,0 +1,48 @@
// Metro module 9506 (f9507).
import Durations from "../../utils/Durations";
import * as _index_native from "../../intl/index.native";
import { intl } from "../../intl/index.native";
const r17 = 5 * Durations.Millis.SECOND;
const r18 = {
TOOLBAR_BUTTON: "toolbar button",
PILL: "pill"
};
const r21 = {
SIDEBAR: "sidebar",
PILL_DROPDOWN: "pill dropdown",
PILL_NEXT_ARROW: "pill next arrow",
PILL_PREVIOUS_ARROW: "pill previous arrow"
};
let c6270_2 = {
DUPLICATED: "DUPLICATED",
TOO_GENERIC: "TOO_GENERIC",
TOO_MANY: "TOO_MANY",
INACCURATE: "INACCURATE",
NOT_USEFUL: "NOT_USEFUL",
OTHER: "OTHER"
};
export { r17 as SUMMARY_POLL_INTERVAL };
export { r18 as SummariesSidebarToggledSource };
export { r21 as SummariesTopicClickedSource };
export { c6270_2 as SummaryFeedbackReasons };
export function getSummaryFeedbackReasons() {
return [{
value: c6270_2.DUPLICATED,
label: intl.string(_index_native.t.wwXl5h)
}, {
value: c6270_2.TOO_GENERIC,
label: intl.string(_index_native.t["t+6knu"])
}, {
value: c6270_2.TOO_MANY,
label: intl.string(_index_native.t.xnKDnv)
}, {
value: c6270_2.INACCURATE,
label: intl.string(_index_native.t.JW5VFj)
}, {
value: c6270_2.NOT_USEFUL,
label: intl.string(_index_native.t.ZtCNiY)
}, {
value: c6270_2.OTHER,
label: intl.string(_index_native.t.BufsKk)
}];
}
+436
View File
@@ -0,0 +1,436 @@
// Metro module 9505 (f9506).
import _slicedToArray from "../../_bundle/_slicedToArray";
import ExperimentStore from "../experiments/ExperimentStore";
import QuickSwitcherStore from "../quickswitcher/QuickSwitcherStore";
import ChannelStore from "../../stores/ChannelStore";
import GuildStore from "../../stores/GuildStore";
import ReadStateStore from "../../stores/ReadStateStore";
import SelectedChannelStore from "../../stores/SelectedChannelStore";
import UserGuildSettingsStore from "../../stores/UserGuildSettingsStore";
import UserStore from "../../stores/UserStore";
import { SUMMARY_POLL_INTERVAL } from "./SummaryConstants";
import { AutocompleterResultTypes } from "../autocompleter/index";
import Module589 from "../../_bundle/Module589";
import SnowflakeUtils from "../../utils/SnowflakeUtils";
import Durations from "../../utils/Durations";
import { canSeeChannelSummaries } from "../../experiments/ChannelSummariesExperiment";
import Dispatcher from "../../Dispatcher";
import { createSummaryFromServer } from "./Summary";
import Module12, { sortBy } from "../../_bundle/Module12";
let shouldShowTopicsBar2, c6269_4, c6269_5, c6269_6, c6269_17, c6269_18, c6269_19, c6269_20, c6269_21, c6269_22, c6269_23, c6269_24, c6269_25;
const handleQuickSwitcherUpdate = function handleQuickSwitcherUpdate() {
c6269_24 = QuickSwitcherStore.getProps().results.filter((result) => result.type === AutocompleterResultTypes.TEXT_CHANNEL && result.record.type === 0).map((item) => item.record.id);
};
c6269_17 = {
FETCHING: "fetching",
OK: "ok",
ERROR: "error"
};
c6269_18 = {};
c6269_19 = {};
c6269_20 = {};
c6269_21 = [];
c6269_22 = {};
c6269_23 = {
status: c6269_17.OK,
lastRequest: null,
lastResponse: null
};
c6269_24 = [];
c6269_25 = [];
class SummaryStore extends Module589.PersistedStore {
static persistKey = "SummaryStore";
getState() {
return {
shouldShowTopicsBar: shouldShowTopicsBar2
};
}
initialize(a0) {
let r4 = a0?.shouldShowTopicsBar;
if (r4 == null) {
r4 = true;
}
shouldShowTopicsBar2 = r4;
this.waitFor(ChannelStore, ExperimentStore, GuildStore, QuickSwitcherStore, ReadStateStore, SelectedChannelStore, UserGuildSettingsStore, UserStore);
this.syncWith([QuickSwitcherStore], handleQuickSwitcherUpdate);
}
allSummaries() {
return c6269_18;
}
topSummaries() {
return Object.values(c6269_18).flat().filter((item) => item.people.length > 1 && SnowflakeUtils.extractTimestamp(item.endId) > new Date().getTime() - 5 * Durations.Millis.HOUR).sort((a, b) => SnowflakeUtils.extractTimestamp(b.endId) - SnowflakeUtils.extractTimestamp(a.endId));
}
summaries(a0) {
let r4 = c6269_18[a0];
if (r4 == null) {
r4 = c6269_25;
}
return r4;
}
shouldShowTopicsBar() {
return shouldShowTopicsBar2;
}
findSummary(a0, c17258_0) {
let r9 = this.summaries(a0).find((item) => item.id === c17258_0);
if (r9 == null) {
r9 = null;
}
return r9;
}
selectedSummary(a0) {
const r1 = c6269_6 != null;
const r8 = r1 ? c6269_6.channelId === a0 ? c6269_6.summaryId != null ? this.findSummary(a0, c6269_6?.summaryId) : null : null : null;
return r8;
}
summaryFeedback(a0) {
return a0 != null ? c6269_20[a0.id] : null;
}
isFetching(a0, a1) {
return a1 != null ? c6269_19[a0]?.summaryId === a1 : c6269_19[a0]?.fetching === true;
}
status(a0) {
return c6269_19[a0];
}
shouldFetch(a0, a1) {
const r9 = c6269_19[a0];
if (canSeeChannelSummaries(ChannelStore.getChannel(a0))) {
if (a1 != null) {
let r28 = r9?.summaryIdLastRequestedAt;
if (r28 == null) {
r28 = 0;
}
const r33 = Date.now() - r28;
return a1 !== r9?.summaryId || r33 > SUMMARY_POLL_INTERVAL;
}
let r21 = r9?.lastReceivedAt;
if (r21 == null) {
r21 = 0;
}
const r25 = Boolean(r9?.fetching);
return r25 ? !r25 : r21 === 0;
}
return false;
}
channelAffinities() {
return c6269_21;
}
channelAffinitiesById() {
return c6269_22;
}
channelAffinitiesStatus() {
return c6269_23;
}
shouldFetchChannelAffinities() {
return c6269_23.status !== c6269_17.FETCHING && !(c6269_23.lastResponse != null && Date.now() - c6269_23.lastResponse < 30 * Durations.Millis.SECOND);
}
defaultChannelIds({ withQuickSwitcher, withChannelAffinities, withUnreads, numChannels = 25 }) {
const r9 = [];
const r8 = withQuickSwitcher ? r9.concat(c6269_24) : r9;
const r13 = withChannelAffinities ? r8.concat(c6269_21.map((item) => item.channel_id)) : r8;
return (withUnreads ? r13.filter((item) => {
const channel = ChannelStore.getChannel(item);
return channel != null && !UserGuildSettingsStore.isChannelMuted(channel.guild_id, item) && ReadStateStore.hasUnread(item);
}) : r13).filter((item) => canSeeChannelSummaries(ChannelStore.getChannel(item), false, false)).slice(0, numChannels);
}
visibleSummaryIndex() {
return c6269_5;
}
}
const summaryStore = new SummaryStore(Dispatcher, {
CONNECTION_OPEN: () => false,
CHANNEL_SELECT: (a0) => {
if (c6269_6?.channelId !== a0.channelId) {
c6269_6 = null;
}
},
TOGGLE_TOPICS_BAR: () => {
shouldShowTopicsBar2 = !shouldShowTopicsBar2;
},
RECEIVE_CHANNEL_SUMMARY: ({ summary, channelId: channelId2, error: error2, receivedAt: receivedAt2 }) => {
let summaryFromServer;
summaryFromServer = void 0;
if (summary != null && Object.keys(summary).length > 0) {
summaryFromServer = createSummaryFromServer(summary, channelId2);
let r25 = c6269_18[channelId2];
if (r25 == null) {
r25 = [];
}
const r26 = [...r25];
const r30 = r26.findIndex((item) => item.id === summaryFromServer?.id);
if (r30 > -1) {
r26[r30] = summaryFromServer;
} else {
r26.push(summaryFromServer);
}
c6269_18[channelId2] = r26;
}
let r36 = c6269_19[channelId2];
if (r36 == null) {
r36 = {
fetching: false
};
}
c6269_19[channelId2] = {
...r36,
summaryId: void 0,
summaryIdLastReceivedAt: receivedAt2,
summaryIdError: error2
};
},
REQUEST_CHANNEL_SUMMARY: ({ channelId: channelId2, summaryId, requestedAt: requestedAt2 }) => {
let r6 = c6269_19[channelId2];
if (r6 == null) {
r6 = {
fetching: false
};
}
c6269_19[channelId2] = {
...r6,
summaryId,
summaryIdLastRequestedAt: requestedAt2
};
},
RECEIVE_CHANNEL_SUMMARIES: ({ summaries: summaries2, channelId, error: error2, receivedAt: receivedAt2 }) => {
const r11 = summaries2.filter((item) => Object.keys(item).length > 0).map((item) => createSummaryFromServer(item, channelId));
if (c6269_6 != null && c6269_6.channelId === channelId && !r11.some((item) => item.id === c6269_6?.summaryId)) {
let r25 = c6269_18[channelId];
if (r25 == null) {
r25 = [];
}
const r28 = r25.find((item) => item.id === c6269_6?.summaryId);
if (r28 != null) {
r11.push(r28);
}
}
c6269_18[channelId] = sortBy(r11, (a0) => SnowflakeUtils.extractTimestamp(a0.startId)).reverse();
const r41 = {
...c6269_19[channelId],
fetching: false,
error: void 0,
lastReceivedAt: receivedAt2
};
if (error2 != null) {
r41.error = error2;
}
c6269_19[channelId] = r41;
},
REQUEST_CHANNEL_SUMMARIES: (a0) => {
const channelId2 = a0.channelId;
let r9 = c6269_19[a0.channelId];
if (r9 == null) {
r9 = {};
}
c6269_19[channelId2] = {
...r9,
fetching: true,
lastRequestedAt: a0.requestedAt
};
},
SET_HIGHLIGHTED_SUMMARY: (a0) => {
if (c6269_4 == null && a0.channelId == null) {
return false;
}
if (a0.channelId === c6269_4?.channelId) {
if (a0.summaryId === c6269_4?.summaryId) {
return false;
}
}
const r15 = a0.channelId != null;
let r16 = null;
if (r15) {
let summaryId = a0.summaryId;
if (summaryId == null) {
summaryId = null;
}
r16 = {
channelId: a0.channelId,
summaryId
};
}
c6269_4 = r16;
if (r16 != null && c6269_4.channelId === a0.channelId && c6269_4.summaryId != null) {
const r28 = c6269_18[c6269_4.channelId];
c6269_5 = r28 == null ? void 0 : r28.findIndex((item) => item.id === c6269_4?.summaryId);
}
},
UPDATE_VISIBLE_MESSAGES: (a0) => {
let c17261_0;
L10: {
c17261_0 = a0;
const channelId2 = SelectedChannelStore.getChannelId();
if (channelId2 != null) {
if (c6269_4 != null && c6269_4.channelId === channelId2 && c6269_4.summaryId != null) {
const r21 = c6269_18[c6269_4.channelId];
c6269_5 = r21 == null ? void 0 : r21.findIndex((item) => item.id === c6269_4?.summaryId);
break L10;
}
const r6 = c6269_18[channelId2];
c6269_5 = r6 == null ? void 0 : r6.findIndex((item) => {
const { topVisibleMessage, bottomVisibleMessage } = c17261_0;
const { startId, endId } = item;
return !(topVisibleMessage == null || topVisibleMessage > endId || bottomVisibleMessage == null || bottomVisibleMessage < startId);
});
}
}
},
SET_SELECTED_SUMMARY: (a0) => {
const channelId2 = a0.channelId;
const r0 = channelId2 == null;
let r1 = null;
if (!r0) {
let r11 = channelId2 !== c6269_6?.channelId || a0.summaryId !== c6269_6?.summaryId;
if (r11) {
let summaryId = a0.summaryId;
if (summaryId == null) {
summaryId = null;
}
c6269_6 = {
channelId: channelId2,
summaryId
};
r11 = void 0;
}
r1 = r11;
}
return r1;
},
SET_SUMMARY_FEEDBACK: ({ summary, rating }) => {
if (rating != null) {
c6269_20[summary.id] = rating;
} else {
delete c6269_20[summary.id];
}
},
REQUEST_CHANNEL_AFFINITIES: () => {
c6269_23 = {
...c6269_23,
status: c6269_17.FETCHING,
lastRequest: Date.now()
};
},
RECEIVE_CHANNEL_AFFINITIES: (a0) => {
const affinities = a0.affinities;
if (a0.error != null) {
c6269_21 = [];
c6269_22 = {};
c6269_23 = {
...c6269_23,
status: c6269_17.ERROR,
lastResponse: Date.now()
};
return void 0;
}
let r12 = affinities;
if (r12 == null) {
r12 = [];
}
c6269_21 = r12;
let r13 = affinities == null ? void 0 : affinities.reduce((acc, affinity) => {
acc[affinity.channel_id] = affinity.affinity;
return acc;
}, {});
if (r13 == null) {
r13 = {};
}
c6269_22 = r13;
c6269_23 = {
...c6269_23,
status: c6269_17.OK,
lastResponse: Date.now()
};
},
REQUEST_CHANNEL_SUMMARIES_BULK: ({ channelIds, requestedAt }) => {
c6269_19 = {
...c6269_19,
...channelIds.reduce((acc, channelId) => {
let r5 = c6269_19[channelId];
if (r5 == null) {
r5 = {};
}
acc[channelId] = {
...r5,
fetching: true,
lastRequestedAt: requestedAt,
error: void 0
};
return acc;
}, {})
};
},
RECEIVE_CHANNEL_SUMMARIES_BULK: (a0) => {
const { summaries: summaries2, receivedAt, error } = a0;
const channelIds = a0.requestArgs.channelIds;
let c17263_2 = Module12.toPairs(summaries2).reduce((acc, a1) => {
const r10 = _slicedToArray(a1, 2);
const r11 = r10[0];
let c26462_0 = r11;
acc[r11] = Module12.chain(r10[1].map((item) => createSummaryFromServer(item, c26462_0))).sortBy((item) => SnowflakeUtils.extractTimestamp(item.startId)).takeRight(75).reverse().filter((item) => Object.keys(item).length > 0).value();
return acc;
}, {});
const r26 = channelIds.reduce((acc, channelId) => {
let r6 = c6269_19[channelId];
if (r6 == null) {
r6 = {};
}
const r3 = c17263_2[channelId];
if (r3 != null) {
acc.summariesByChannel[channelId] = r3;
}
acc.summaryFetchStatusByChannel[channelId] = {
...r6,
fetching: false,
error,
lastReceivedAt: receivedAt
};
return acc;
}, {
summariesByChannel: {},
summaryFetchStatusByChannel: {}
});
c6269_18 = {
...c6269_18,
...r26.summariesByChannel
};
c6269_19 = {
...c6269_19,
...r26.summaryFetchStatusByChannel
};
},
CONVERSATION_SUMMARY_UPDATE: (a0) => {
const { channel_id, summaries: summaries2 } = a0;
a0.guild_id;
const lastReceivedAt = Date.now();
const r34 = Module12.chain(summaries2).sortBy((item) => SnowflakeUtils.extractTimestamp(item.start_id)).filter((item) => Object.keys(item).length > 0).map((item) => createSummaryFromServer(item, channel_id)).reverse().value();
let r36 = c6269_18[channel_id];
if (r36 == null) {
r36 = [];
}
c6269_18[channel_id] = Module12.chain(r34).concat(r36).sortBy((item) => SnowflakeUtils.extractTimestamp(item.startId)).takeRight(75).uniqBy("id").reverse().value();
let fetching = c6269_19[channel_id]?.fetching;
if (fetching == null) {
fetching = false;
}
c6269_19[channel_id] = {
...c6269_19[channel_id],
error: void 0,
fetching,
lastReceivedAt
};
},
CLEAR_CONVERSATION_SUMMARIES: () => {
c6269_18 = {};
c6269_19 = {};
},
DELETE_SUMMARY: (a0) => {
const channelId2 = a0.summary.channelId;
let r6 = c6269_18[channelId2];
if (r6 == null) {
r6 = [];
}
const r10 = r6.indexOf(a0.summary);
if (r10 !== -1) {
c6269_18[channelId2].splice(r10, 1);
}
}
});
export default summaryStore;
@@ -0,0 +1,150 @@
// Metro module 10932 (f10933).
import { useRef, useCallback } from "react";
import { View } from "react-native";
import ChannelStore from "../../../stores/ChannelStore";
import MessageStore from "../../../stores/MessageStore";
import SummaryStore from "../SummaryStore";
import { AnalyticsSections, MessageFlags } from "../../../Constants";
import ActionSheetActionCreators from "../../action_sheet/native/ActionSheetActionCreators";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { computeCanStartPublicThread } from "../../threads/ThreadHooks";
import { presentFailedToast, presentError } from "../../toast/native/ToastUtils";
import { intl, t } from "../../../intl/index.native";
import { getChannelPermalink } from "../../../utils/ChannelUtils";
import { showShareActionSheet } from "../../action_sheet/native/showShareActionSheet";
import ThreadActionCreators from "../../threads/ThreadActionCreators";
import DraftActionCreators from "../../../actions/DraftActionCreators";
import { navigateToCreateThread } from "../../main_tabs_v2/helpers/NavigationRouteUtils.native";
import SnowflakeUtils from "../../../utils/SnowflakeUtils";
import { transitionToGuild } from "../../routing/router_utils";
import { BottomSheet } from "../../../design/components/Sheet/native/BottomSheet.native";
import { SafeAreaPaddingView } from "../../../components_native/common/SafeAreaView";
import { TopicsIcon } from "../../../design/components/Icon/native/redesign/generated/TopicsIcon";
import { Text } from "../../../design/components/Text/native/Text";
import { SummaryActionSheetButton } from "./SummaryActionSheetButton";
import Share from "../../icons/native/Share";
import Module10122 from "../../../_bundle/Module10122";
import Module7732 from "../../../_bundle/Module7732";
const useStyles = createStyles({
summaryContainer: {
padding: 16,
margin: 16,
marginBottom: 24,
justifyContent: "center",
alignItems: "center"
},
summaryContent: {
textAlign: "center"
},
summaryIconContainer: {
marginBottom: 8,
borderRadius: Module712.radii.round,
border: 1,
overflow: "hidden",
alignItems: "center",
justifyContent: "center",
backgroundColor: Module712.colors.BACKGROUND_BRAND
},
summaryIcon: {
margin: 8,
width: 20,
height: 20,
tintColor: Module712.colors.WHITE
},
summaryTopic: {
marginBottom: 4
},
divider: {
height: 1,
backgroundColor: Module712.colors.BORDER_SUBTLE
},
actionsContainer: {
flexDirection: "row",
justifyContent: "space-evenly",
marginBottom: 16
}
});
export default function SummaryActionSheet(props) {
const summary = props.summary;
const styles = useStyles();
const ref = useRef(null);
const channel = ChannelStore.getChannel(summary.channelId);
const message = MessageStore.getMessage(summary.channelId, summary.startId);
let r13 = message != null && message.hasFlag(MessageFlags.HAS_THREAD);
let r36 = channel != null && message != null && !message.hasFlag(MessageFlags.HAS_THREAD) && computeCanStartPublicThread(channel, message);
const callback = useCallback(() => {
ActionSheetActionCreators.hideActionSheet();
if (channel?.guild_id != null) {
ActionSheetActionCreators.openLazy(import("../../notifications/native/GuildHighlightsNotificationsActionSheet"), "GuildHighlightsNotifications", {
guildId: channel?.guild_id
});
}
}, [channel?.guild_id]);
const callback3 = useCallback(() => {
ActionSheetActionCreators.hideActionSheet();
if (channel != null) {
showShareActionSheet({
message: intl.formatToPlainString(t.I3yTDn, {
topic: summary.topic,
url: getChannelPermalink(channel.guild_id, channel.id, summary.startId, summary.id)
}),
subject: summary.topic
}, AnalyticsSections.SUMMARY_ACTION_SHEET);
} else {
presentFailedToast(intl.string(t.gvkcQl));
}
}, [summary, channel]);
const callback4 = useCallback(() => {
L5: {
ActionSheetActionCreators.hideActionSheet();
if (channel != null && message != null) {
ThreadActionCreators.openThreadCreationForMobile(channel, summary.startId, AnalyticsSections.SUMMARY_ACTION_SHEET);
DraftActionCreators.changeThreadSettings(channel.id, {
name: summary.topic
});
if (navigateToCreateThread(channel.guild_id, SnowflakeUtils.castMessageIdAsChannelId(message.id))) {
break L5;
}
transitionToGuild(channel.guild_id, SnowflakeUtils.castMessageIdAsChannelId(message.id));
} else {
presentError(intl.string(t["/+DWeQ"]));
}
}
}, [summary, channel, message]);
const callback2 = useCallback(() => {
ActionSheetActionCreators.hideActionSheet();
if (channel != null && message != null) {
transitionToGuild(channel.guild_id, SnowflakeUtils.castMessageIdAsChannelId(message.id));
}
}, [channel, message]);
const r95 = [<View style={styles.summaryContainer}>
<View style={styles.summaryIconContainer}>
<TopicsIcon style={styles.summaryIcon} size="custom" />
</View>
<Text style={[styles.summaryContent, styles.summaryTopic]} variant="heading-md/extrabold" color="mobile-text-heading-primary">{summary.topic}</Text>
<Text style={[styles.summaryContent]} variant="heading-md/medium" color="text-default">{summary.summShort}</Text>
</View>, <View style={styles.divider} />, ,];
const r118 = [<SummaryActionSheetButton label={intl.string(t["NY/nlb"])} iconSource={Share} onPress={callback3} />, , , ,];
if (r36) {
r36 = <SummaryActionSheetButton label={intl.string(t.rBIGBL)} iconSource={Module10122} onPress={callback4} />;
}
r118[1] = r36;
if (r13) {
r13 = <SummaryActionSheetButton label={intl.string(t["39d0Wj"])} iconSource={Module10122} onPress={callback2} />;
}
r118[2] = r13;
r118[3] = <SummaryActionSheetButton label={intl.string(t.QLkZ39)} iconSource={Module7732} onPress={callback} />;
r95[2] = <View style={styles.actionsContainer}>{r118}</View>;
return <BottomSheet ref={ref}>
<SafeAreaPaddingView bottom>{r95}</SafeAreaPaddingView>
</BottomSheet>;
};
export function openSummaryDividerActionSheet(a0, a1) {
const summary2 = SummaryStore.findSummary(a0, a1);
if (summary2 != null) {
ActionSheetActionCreators.openLazy(import("./SummaryActionSheet"), `SummaryDivider${a1}`, {
summary: summary2
});
}
}
@@ -0,0 +1,43 @@
// Metro module 10935 (f10936).
import { View } from "react-native";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { PressableOpacity } from "../../../design/void/Pressables/native/Pressables";
import { Icon } from "../../../design/void/native";
import { Text } from "../../../design/components/Text/native/Text";
const useStyles = createStyles({
container: {
flexDirection: "column",
justifyContent: "center",
alignItems: "center",
paddingVertical: 8,
width: 78
},
iconBox: {
borderRadius: Module712.radii.round,
border: 1,
overflow: "hidden",
alignItems: "center",
justifyContent: "center",
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW,
...Module712.shadows.SHADOW_LOW
},
icon: {
margin: 12,
tintColor: Module712.colors.INTERACTIVE_TEXT_DEFAULT
},
name: {
textAlign: "center",
marginTop: 8
}
});
export function SummaryActionSheetButton(props) {
const { label, iconSource, onPress } = props;
const styles = useStyles();
return <PressableOpacity style={styles.container} onPress={onPress} accessibilityRole="button" accessibilityLabel={label}>
<View style={[styles.iconBox]}>
<Icon style={styles.icon} source={iconSource} />
</View>
<Text style={styles.name} variant="text-xs/medium" color="interactive-text-default" lineClamp={1}>{label}</Text>
</PressableOpacity>;
}