579 lines
15 KiB
TypeScript
579 lines
15 KiB
TypeScript
// Metro module 8185 (f8186).
|
|
import { Endpoints } from "../../Constants";
|
|
import { HTTP } from "../../_bundle/sendRequest";
|
|
import Dispatcher from "../../Dispatcher";
|
|
import SentryUtils_native from "../../utils/SentryUtils.native";
|
|
import { icymiEnabled, generateHydrationId } from "./ICYMIUtils";
|
|
import { CustomStatusSetting } from "../user_settings/UserSettings";
|
|
const r18 = {
|
|
fetchPopularGuildsFromCategories: async (category_ids, offset) => {
|
|
let c26126_2;
|
|
let c26126_3 = 0;
|
|
let c29896_0, c29896_1;
|
|
try {
|
|
c29896_0 = void 0;
|
|
c26126_3 = 1;
|
|
c29896_0 = (await HTTP.post({
|
|
url: Endpoints.GRAVITY_TOPIC_GUILDS,
|
|
body: {
|
|
category_ids,
|
|
offset
|
|
},
|
|
rejectWithError: false
|
|
})).body.guilds;
|
|
Dispatcher.dispatch({
|
|
type: "LOAD_ICYMI_POPULAR_GUILDS",
|
|
categoryIds: category_ids,
|
|
guilds: c29896_0,
|
|
offset
|
|
});
|
|
c26126_3 = 0;
|
|
} catch ($e) {
|
|
const r26 = $e;
|
|
let r8 = r26;
|
|
c26126_2 = r26;
|
|
if (c26126_3 !== 0) {
|
|
while (true) {
|
|
try {
|
|
const r76 = c26126_2;
|
|
c26126_3 = 0;
|
|
c29896_1 = r76;
|
|
SentryUtils_native.captureException(c29896_1);
|
|
} catch (r72) {
|
|
r8 = r72;
|
|
c26126_2 = r72;
|
|
if (c26126_3 === 0) {
|
|
break;
|
|
}
|
|
continue;
|
|
}
|
|
return false;
|
|
}
|
|
}
|
|
throw r8;
|
|
}
|
|
return true;
|
|
},
|
|
fetchDehydrated: async function fetchDehydrated(r3 = {}) {
|
|
const { isInitialLoad, isReloading, forceRefresh } = r3;
|
|
let c26127_2;
|
|
let c26127_3 = 0;
|
|
let c29897_0, c29897_1, c29897_2;
|
|
L17: {
|
|
try {
|
|
c29897_0 = void 0;
|
|
c29897_1 = void 0;
|
|
if (icymiEnabled("fetchDehydrated")) {
|
|
if (isReloading) {
|
|
Dispatcher.dispatch({
|
|
type: "ICYMI_SET_REFRESHING",
|
|
refreshing: true
|
|
});
|
|
}
|
|
c26127_3 = 1;
|
|
c29897_0 = Date.now();
|
|
c29897_1 = await HTTP.get({
|
|
url: Endpoints.GRAVITY_ITEMS_DEHYDRATED,
|
|
query: {
|
|
refresh: forceRefresh
|
|
},
|
|
rejectWithError: false
|
|
});
|
|
await Dispatcher.dispatch({
|
|
type: "LOAD_ICYMI_DEHYDRATED",
|
|
items: c29897_1.body.items,
|
|
loadId: c29897_1.body.load_id,
|
|
startTime: c29897_0,
|
|
isReloading,
|
|
isInitialLoad
|
|
});
|
|
c26127_3 = 0;
|
|
break L17;
|
|
}
|
|
} catch ($e) {
|
|
const r33 = $e;
|
|
let r11 = r33;
|
|
c26127_2 = r33;
|
|
if (c26127_3 !== 0) {
|
|
while (true) {
|
|
try {
|
|
const r123 = c26127_2;
|
|
c26127_3 = 0;
|
|
c29897_2 = r123;
|
|
SentryUtils_native.captureException(c29897_2);
|
|
break L17;
|
|
} catch (r119) {
|
|
r11 = r119;
|
|
c26127_2 = r119;
|
|
if (c26127_3 === 0) {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
throw r11;
|
|
}
|
|
return void 0;
|
|
}
|
|
},
|
|
gravityJoinGuild: async (guild_ids, location2) => {
|
|
let c26128_2;
|
|
let c26128_3 = 0;
|
|
let c29898_0;
|
|
L13: {
|
|
L12: {
|
|
try {
|
|
if (!icymiEnabled("gravityJoinGuild")) {
|
|
break L13;
|
|
}
|
|
if (guild_ids.length !== 0) {
|
|
c26128_3 = 1;
|
|
await HTTP.post({
|
|
url: Endpoints.GRAVITY_JOIN_GUILD,
|
|
body: {
|
|
guild_ids,
|
|
location: location2
|
|
},
|
|
rejectWithError: false
|
|
});
|
|
c26128_3 = 0;
|
|
break L12;
|
|
}
|
|
break L13;
|
|
} catch ($e) {
|
|
const r26 = $e;
|
|
let r8 = r26;
|
|
c26128_2 = r26;
|
|
if (c26128_3 !== 0) {
|
|
while (true) {
|
|
try {
|
|
const r70 = c26128_2;
|
|
c26128_3 = 0;
|
|
c29898_0 = r70;
|
|
SentryUtils_native.captureException(c29898_0);
|
|
} catch (r66) {
|
|
r8 = r66;
|
|
c26128_2 = r66;
|
|
if (c26128_3 === 0) {
|
|
break;
|
|
}
|
|
continue;
|
|
}
|
|
return false;
|
|
}
|
|
}
|
|
throw r8;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
},
|
|
fetchForNotification: async (channel_id, message_id) => {
|
|
let c26129_2;
|
|
let c26129_3 = 0;
|
|
let c29899_0, c29899_1;
|
|
L16: {
|
|
L15: {
|
|
try {
|
|
c29899_0 = void 0;
|
|
if (icymiEnabled("fetchInitial")) {
|
|
c26129_3 = 1;
|
|
c29899_0 = await HTTP.post({
|
|
url: Endpoints.GRAVITY_ITEMS_HYDRATE,
|
|
body: {
|
|
message_items: [{
|
|
channel_id,
|
|
message_id
|
|
}],
|
|
activity_items: []
|
|
},
|
|
rejectWithError: false
|
|
});
|
|
if (c29899_0.body.message_items.length === 0) {
|
|
c26129_3 = 0;
|
|
break L16;
|
|
}
|
|
Dispatcher.dispatch({
|
|
type: "LOAD_ICYMI_FROM_NOTIFICATION",
|
|
messageItem: c29899_0.body.message_items[0]
|
|
});
|
|
c26129_3 = 0;
|
|
break L15;
|
|
}
|
|
} catch ($e) {
|
|
const r27 = $e;
|
|
let r8 = r27;
|
|
c26129_2 = r27;
|
|
if (c26129_3 !== 0) {
|
|
while (true) {
|
|
try {
|
|
const r92 = c26129_2;
|
|
c26129_3 = 0;
|
|
c29899_1 = r92;
|
|
SentryUtils_native.captureException(c29899_1);
|
|
break L15;
|
|
} catch (r88) {
|
|
r8 = r88;
|
|
c26129_2 = r88;
|
|
if (c26129_3 === 0) {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
throw r8;
|
|
}
|
|
return void 0;
|
|
}
|
|
return void 0;
|
|
}
|
|
},
|
|
fetchForStatusNotification: (a0) => {
|
|
if (icymiEnabled("fetchInitialStatus")) {
|
|
Dispatcher.dispatch({
|
|
type: "LOAD_ICYMI_FROM_NOTIFICATION",
|
|
customStatusItem: a0
|
|
});
|
|
}
|
|
},
|
|
fetchHydrated: async (startingIndex, endingIndex, c16339_2) => {
|
|
let c26130_2;
|
|
let c26130_3 = 0;
|
|
let c29900_0, c29900_1, c29900_2, c29900_3, c29900_4;
|
|
L16: {
|
|
L15: {
|
|
try {
|
|
c29900_0 = void 0;
|
|
c29900_1 = void 0;
|
|
c29900_2 = void 0;
|
|
c29900_3 = void 0;
|
|
if (!icymiEnabled("fetchHydrated")) {
|
|
break L16;
|
|
}
|
|
const messageItems = c16339_2.messageItems;
|
|
c29900_0 = messageItems;
|
|
const activityItems = c16339_2.activityItems;
|
|
c29900_1 = activityItems;
|
|
if (messageItems.length === 0 && activityItems.length === 0) {
|
|
Dispatcher.dispatch({
|
|
type: "LOAD_ICYMI_HYDRATED",
|
|
requestMessageItems: [],
|
|
requestActivityItems: [],
|
|
messageItems: [],
|
|
activityItems: [],
|
|
startingIndex,
|
|
endingIndex
|
|
});
|
|
break L16;
|
|
}
|
|
c26130_3 = 1;
|
|
c29900_2 = await HTTP.post({
|
|
url: Endpoints.GRAVITY_ITEMS_HYDRATE,
|
|
body: {
|
|
message_items: messageItems,
|
|
activity_items: activityItems
|
|
},
|
|
rejectWithError: false
|
|
});
|
|
Dispatcher.dispatch({
|
|
type: "LOAD_ICYMI_HYDRATED",
|
|
requestMessageItems: c29900_0,
|
|
requestActivityItems: c29900_1,
|
|
messageItems: c29900_2.body.message_items,
|
|
activityItems: c29900_2.body.activity_items,
|
|
startingIndex,
|
|
endingIndex
|
|
});
|
|
c26130_3 = 0;
|
|
} catch ($e) {
|
|
const r28 = $e;
|
|
let r8 = r28;
|
|
c26130_2 = r28;
|
|
if (c26130_3 !== 0) {
|
|
while (true) {
|
|
try {
|
|
const r107 = c26130_2;
|
|
c26130_3 = 0;
|
|
c29900_4 = r107;
|
|
SentryUtils_native.captureException(c29900_4);
|
|
c29900_3 = generateHydrationId(startingIndex, endingIndex);
|
|
Dispatcher.dispatch({
|
|
type: "LOAD_ICYMI_HYDRATED_FAILED",
|
|
hydrationId: c29900_3
|
|
});
|
|
break L15;
|
|
} catch (r103) {
|
|
r8 = r103;
|
|
c26130_2 = r103;
|
|
if (c26130_3 === 0) {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
throw r8;
|
|
}
|
|
}
|
|
return void 0;
|
|
}
|
|
},
|
|
getGuildChannelScores: async () => {
|
|
let c26131_2;
|
|
let c26131_3 = 0;
|
|
let c29901_0, c29901_1;
|
|
L13: {
|
|
try {
|
|
c29901_0 = void 0;
|
|
if (icymiEnabled("guildChannelScores")) {
|
|
c26131_3 = 1;
|
|
c29901_0 = await HTTP.get({
|
|
url: Endpoints.GRAVITY_CUSTOM_SCORES,
|
|
rejectWithError: false
|
|
});
|
|
Dispatcher.dispatch({
|
|
type: "LOAD_ICYMI_CUSTOM_SCORES",
|
|
scores: c29901_0.body
|
|
});
|
|
c26131_3 = 0;
|
|
break L13;
|
|
}
|
|
} catch ($e) {
|
|
const r24 = $e;
|
|
let r8 = r24;
|
|
c26131_2 = r24;
|
|
if (c26131_3 !== 0) {
|
|
while (true) {
|
|
try {
|
|
const r75 = c26131_2;
|
|
c26131_3 = 0;
|
|
c29901_1 = r75;
|
|
SentryUtils_native.captureException(c29901_1);
|
|
break L13;
|
|
} catch (r71) {
|
|
r8 = r71;
|
|
c26131_2 = r71;
|
|
if (c26131_3 === 0) {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
throw r8;
|
|
}
|
|
return void 0;
|
|
}
|
|
},
|
|
getRecommendedGuilds: async () => {
|
|
let c26132_2;
|
|
let c26132_3 = 0;
|
|
let c29902_0, c29902_1;
|
|
L13: {
|
|
try {
|
|
c29902_0 = void 0;
|
|
if (icymiEnabled("recommendedGuilds")) {
|
|
c26132_3 = 1;
|
|
c29902_0 = await HTTP.get({
|
|
url: Endpoints.GRAVITY_RECOMMENDED_GUILDS,
|
|
rejectWithError: false
|
|
});
|
|
Dispatcher.dispatch({
|
|
type: "LOAD_ICYMI_RECOMMENDED_GUILDS",
|
|
guilds: c29902_0.body.guilds
|
|
});
|
|
c26132_3 = 0;
|
|
break L13;
|
|
}
|
|
} catch ($e) {
|
|
const r24 = $e;
|
|
let r8 = r24;
|
|
c26132_2 = r24;
|
|
if (c26132_3 !== 0) {
|
|
while (true) {
|
|
try {
|
|
const r76 = c26132_2;
|
|
c26132_3 = 0;
|
|
c29902_1 = r76;
|
|
SentryUtils_native.captureException(c29902_1);
|
|
break L13;
|
|
} catch (r72) {
|
|
r8 = r72;
|
|
c26132_2 = r72;
|
|
if (c26132_3 === 0) {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
throw r8;
|
|
}
|
|
return void 0;
|
|
}
|
|
},
|
|
getMediaForCurrentStatus: async () => {
|
|
let c26133_2;
|
|
let c26133_3 = 0;
|
|
let c29903_0, c29903_1, c29903_2;
|
|
L15: {
|
|
L14: {
|
|
try {
|
|
c29903_0 = void 0;
|
|
c29903_1 = void 0;
|
|
if (!icymiEnabled("mediaForCurrentStatus")) {
|
|
break L15;
|
|
}
|
|
const setting = CustomStatusSetting.getSetting();
|
|
c29903_0 = setting;
|
|
if (setting == null) {
|
|
break L15;
|
|
}
|
|
if (setting.createdAtMs != null) {
|
|
c26133_3 = 1;
|
|
c29903_1 = await HTTP.get({
|
|
url: Endpoints.GRAVITY_ATTACHMENTS,
|
|
rejectWithError: false
|
|
});
|
|
Dispatcher.dispatch({
|
|
type: "LOAD_ICYMI_CURRENT_STATUS_MEDIA",
|
|
attachments: c29903_1.body.attachments,
|
|
createdAtMs: Number(c29903_0.createdAtMs)
|
|
});
|
|
c26133_3 = 0;
|
|
break L14;
|
|
}
|
|
break L15;
|
|
} catch ($e) {
|
|
const r27 = $e;
|
|
let r8 = r27;
|
|
c26133_2 = r27;
|
|
if (c26133_3 !== 0) {
|
|
while (true) {
|
|
try {
|
|
const r91 = c26133_2;
|
|
c26133_3 = 0;
|
|
c29903_2 = r91;
|
|
SentryUtils_native.captureException(c29903_2);
|
|
break L14;
|
|
} catch (r87) {
|
|
r8 = r87;
|
|
c26133_2 = r87;
|
|
if (c26133_3 === 0) {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
throw r8;
|
|
}
|
|
}
|
|
return void 0;
|
|
}
|
|
},
|
|
reloadICYMITab: () => {
|
|
Dispatcher.dispatch({
|
|
type: "RELOAD_ICYMI"
|
|
});
|
|
},
|
|
loadHydratedAttempt: (a0) => {
|
|
Dispatcher.dispatch({
|
|
type: "LOAD_ICYMI_HYDRATED_ATTEMPT",
|
|
hydrationId: a0
|
|
});
|
|
},
|
|
openICYMITab: () => {
|
|
Dispatcher.dispatch({
|
|
type: "ICYMI_TAB_OPENED"
|
|
});
|
|
},
|
|
closeICYMITab: () => {
|
|
Dispatcher.dispatch({
|
|
type: "ICYMI_TAB_CLOSED"
|
|
});
|
|
},
|
|
startItemsDwell: (a0) => {
|
|
Dispatcher.dispatch({
|
|
type: "ICYMI_ITEMS_DWELL_START",
|
|
items: a0
|
|
});
|
|
},
|
|
triggerItemsLongImpression: (a0) => {
|
|
Dispatcher.dispatch({
|
|
type: "ICYMI_ITEMS_LONG_IMPRESSION",
|
|
items: a0
|
|
});
|
|
},
|
|
ackGravityItems: (a0, a1) => Dispatcher.dispatch({
|
|
type: "ICYMI_ACK_ITEMS",
|
|
items: a0,
|
|
override: a1
|
|
}),
|
|
gravityScrollEvent: (a0) => Dispatcher.dispatch({
|
|
type: "ICYMI_SCROLL_EVENT",
|
|
timestamp: a0
|
|
}),
|
|
setFilters: (a0) => Dispatcher.dispatch({
|
|
type: "SET_ICYMI_FILTERS",
|
|
filters: a0
|
|
}),
|
|
giveFeedback: () => Dispatcher.dispatch({
|
|
type: "ICYMI_FEEDBACK_GIVEN"
|
|
}),
|
|
clearReadStates: () => Dispatcher.dispatch({
|
|
type: "CLEAR_ICYMI_READ_STATES"
|
|
}),
|
|
addedRecommendedGuild: () => Dispatcher.dispatch({
|
|
type: "ICYMI_JOINED_RECOMMENDED_GUILD"
|
|
}),
|
|
setVideosMuted: (a0) => {
|
|
Dispatcher.dispatch({
|
|
type: "ICYMI_SET_VIDEOS_MUTED",
|
|
muted: a0
|
|
});
|
|
},
|
|
setTabFocused: (a0) => {
|
|
Dispatcher.dispatch({
|
|
type: "ICYMI_SET_FOCUSED_TAB",
|
|
focused: a0
|
|
});
|
|
},
|
|
setCardHeight: (a0, a1) => {
|
|
Dispatcher.dispatch({
|
|
type: "ICYMI_SET_CARD_HEIGHT",
|
|
itemId: a0,
|
|
height: a1
|
|
});
|
|
},
|
|
takeSurvey: function takeSurvey(takenAt = Date.now()) {
|
|
Dispatcher.dispatch({
|
|
type: "ICYMI_TAKE_SURVEY",
|
|
takenAt
|
|
});
|
|
},
|
|
itemInteracted: (a0, a1, a2) => {
|
|
Dispatcher.dispatch({
|
|
type: "ICYMI_ITEM_INTERACTED",
|
|
itemId: a0,
|
|
itemType: a1,
|
|
actionType: a2
|
|
});
|
|
},
|
|
feedItemActioned: (a0) => {
|
|
Dispatcher.dispatch({
|
|
type: "ICYMI_FEED_ITEM_ACTIONED",
|
|
...a0
|
|
});
|
|
},
|
|
feedFilterActioned: (a0) => {
|
|
Dispatcher.dispatch({
|
|
type: "ICYMI_FEED_FILTER_ACTIONED",
|
|
...a0
|
|
});
|
|
},
|
|
feedPageActioned: (a0) => {
|
|
Dispatcher.dispatch({
|
|
type: "ICYMI_FEED_PAGE_ACTIONED",
|
|
...a0
|
|
});
|
|
}
|
|
};
|
|
export default r18;
|