266 lines
9.7 KiB
TypeScript
266 lines
9.7 KiB
TypeScript
// Module ID: 15147
|
|
// Function ID: 15148
|
|
// Name: GuildThemeNuxActionSheet
|
|
// Dependencies: [5, 32, 19, 17, 4072, 4141, 1369, 21, 3, 4255, 712, 15148, 4187, 589, 4223, 1236, 5323, 15149, 4251, 7767, 7766, 1297, 4665, 2]
|
|
// Exports: default
|
|
|
|
// Module 15147 (GuildThemeNuxActionSheet)
|
|
import snapshotSelectedGuildId from "snapshotSelectedGuildId";
|
|
import _slicedToArray from "_slicedToArray";
|
|
import context from "context";
|
|
import { View } from "GuildThemeNuxPreviewGraphic";
|
|
import handleConnectionOpen from "handleConnectionOpen";
|
|
import closure_8 from "snapshotSelectedGuildId";
|
|
import { ContentDismissActionType } from "ContentDismissActionType";
|
|
import jsxProd from "Button";
|
|
import createCacheKey from "createCacheKey";
|
|
|
|
let c10;
|
|
let unpackModuleId;
|
|
const require = arg1;
|
|
({ jsx: c10, jsxs: unpackModuleId } = jsxProd);
|
|
const GuildThemeNuxActionSheet = "GuildThemeNuxActionSheet";
|
|
createCacheKey = { container: null, title: null, description: null, options: null, warning: null, footer: null };
|
|
createCacheKey = { padding: require("Themes").space.PX_16, paddingTop: require("Themes").space.PX_8, paddingBottom: 0 };
|
|
createCacheKey[0] = createCacheKey;
|
|
const tmp3 = new require("get ActivityIndicator")("GuildThemeNuxActionSheet");
|
|
createCacheKey[1] = { textAlign: "center", marginBottom: require("Themes").space.PX_8 };
|
|
let obj1 = { textAlign: "center", marginBottom: require("Themes").space.PX_8 };
|
|
createCacheKey[2] = { textAlign: "center", marginBottom: require("Themes").space.PX_24 };
|
|
let obj2 = { textAlign: "center", marginBottom: require("Themes").space.PX_24 };
|
|
createCacheKey[3] = { marginBottom: require("Themes").space.PX_12 };
|
|
let obj3 = { marginBottom: require("Themes").space.PX_12 };
|
|
createCacheKey[4] = { marginBottom: require("Themes").space.PX_12 };
|
|
let obj4 = { marginBottom: require("Themes").space.PX_12 };
|
|
createCacheKey[5] = { gap: require("Themes").space.PX_8 };
|
|
createCacheKey = createCacheKey.createStyles(createCacheKey);
|
|
let obj5 = { gap: require("Themes").space.PX_8 };
|
|
const result = require("noop").fileFinishedImporting("modules/guild_themes/native/GuildThemeNuxActionSheet.tsx");
|
|
|
|
export default function GuildThemeNuxActionSheet(guildId) {
|
|
let c2;
|
|
let c3;
|
|
let c4;
|
|
let tmp5;
|
|
let tmp7;
|
|
let tmp9;
|
|
guildId = guildId.guildId;
|
|
const markAsDismissed = guildId.markAsDismissed;
|
|
let dependencyMap;
|
|
let callback;
|
|
let callback2;
|
|
let React;
|
|
let c6;
|
|
let stateFromStores;
|
|
let callback1;
|
|
const tmp = createCacheKey();
|
|
[tmp5, c2] = callback2(React.useState(guildId(15148).getInitialGuildThemeNuxSelection), 2);
|
|
const tmp4 = callback2(React.useState(guildId(15148).getInitialGuildThemeNuxSelection), 2);
|
|
[tmp7, c3] = callback2(React.useState(null), 2);
|
|
const tmp6 = callback2(React.useState(null), 2);
|
|
[tmp9, c4] = callback2(React.useState(false), 2);
|
|
React = React.useRef(false);
|
|
const tmp10 = tmp5 === guildId(4187).GuildThemeSourcePreference.PERSONAL;
|
|
c6 = tmp10;
|
|
let obj = guildId(589);
|
|
const items = [stateFromStores];
|
|
stateFromStores = obj.useStateFromStores(items, () => stateFromStores.getGuildId());
|
|
let obj1 = guildId(589);
|
|
const items1 = [callback1];
|
|
const items2 = [guildId];
|
|
const items3 = [guildId, stateFromStores];
|
|
const stateFromStores1 = obj1.useStateFromStores(items1, () => {
|
|
const guildThemeSnapshot = callback1.getGuildThemeSnapshot(guildId);
|
|
let tmp2 = null;
|
|
if (null != guildThemeSnapshot) {
|
|
tmp2 = null;
|
|
if (guildThemeSnapshot.enabled) {
|
|
let themeSettings = guildThemeSnapshot.themeSettings;
|
|
if (themeSettings == null) {
|
|
themeSettings = null;
|
|
}
|
|
tmp2 = themeSettings;
|
|
}
|
|
}
|
|
return tmp2;
|
|
}, items2);
|
|
const effect = React.useEffect(() => {
|
|
if (stateFromStores !== guildId) {
|
|
markAsDismissed(_undefined[14]).hideActionSheet(outer1_12);
|
|
const obj = markAsDismissed(_undefined[14]);
|
|
}
|
|
}, items3);
|
|
const items4 = [markAsDismissed];
|
|
callback = React.useCallback((arg0) => {
|
|
_undefined2(null);
|
|
_undefined(arg0);
|
|
}, []);
|
|
callback1 = React.useCallback((arg0) => {
|
|
if (!ref.current) {
|
|
tmp.current = true;
|
|
markAsDismissed(arg0);
|
|
}
|
|
}, items4);
|
|
const items5 = [guildId, tmp10, markAsDismissed, stateFromStores];
|
|
const items6 = [callback1];
|
|
callback2 = React.useCallback(callback(function*() {
|
|
if (c5 === 2) {
|
|
c5 = 3;
|
|
HermesBuiltin.throwTypeError();
|
|
} else if (tmp6 === 3) {
|
|
if (arg0 === 1) {
|
|
throw arg1;
|
|
} else if (arg0 === 2) {
|
|
let obj = { value: null, done: true };
|
|
obj[0] = arg1;
|
|
return obj;
|
|
} else {
|
|
return { value: "T", done: null };
|
|
}
|
|
} else {
|
|
try {
|
|
c5 = 2;
|
|
if (0 === v02) {
|
|
if (arg0 === 1) {
|
|
c5 = 3;
|
|
throw arg1;
|
|
} else if (arg0 === 2) {
|
|
c5 = 3;
|
|
obj = { value: null, done: true };
|
|
obj[0] = arg1;
|
|
return obj;
|
|
} else {
|
|
const callback = tmp3;
|
|
let closure_0 = tmp7;
|
|
if (outer1_7 === outer1_0) {
|
|
v02(true);
|
|
v0(null);
|
|
v0 = 1;
|
|
let obj3 = outer1_0(outer1_2[11]);
|
|
v02 = 2;
|
|
c5 = 1;
|
|
const obj1 = { value: null, done: false };
|
|
obj1[0] = obj3.saveGuildThemeNuxPreference(tmp49, outer1_6);
|
|
return obj1;
|
|
} else {
|
|
c5 = 3;
|
|
}
|
|
}
|
|
} else if (1 === tmp7) {
|
|
v0 = 0;
|
|
closure_0 = closure_2;
|
|
outer1_13.error("Failed to save guild theme NUX preference", closure_0);
|
|
const intl = outer1_0(outer1_2[15]).intl;
|
|
v0(intl.string(outer1_0(outer1_2[15]).t.fEptJP));
|
|
v02(false);
|
|
c5 = 3;
|
|
const obj2 = { value: null, done: true };
|
|
obj2[0] = undefined;
|
|
return obj2;
|
|
} else if (arg0 === 1) {
|
|
c5 = 3;
|
|
throw arg1;
|
|
} else if (arg0 !== 2) {
|
|
v0 = 0;
|
|
c5.current = true;
|
|
callback(outer1_9.TAKE_ACTION);
|
|
obj = outer1_1(outer1_2[14]);
|
|
obj.hideActionSheet(outer1_12);
|
|
}
|
|
v0 = 0;
|
|
c5 = 3;
|
|
obj3 = { value: null, done: true };
|
|
obj3[0] = arg1;
|
|
return obj3;
|
|
} catch (tmp39) {
|
|
closure_2 = tmp39;
|
|
if (tmp4 === v0) {
|
|
c5 = tmp2;
|
|
throw tmp39;
|
|
} else {
|
|
v02 = tmp;
|
|
}
|
|
}
|
|
}
|
|
}), items5);
|
|
const callback3 = React.useCallback(() => {
|
|
callback1(outer1_9.USER_DISMISS);
|
|
}, items6);
|
|
let intl = guildId(1236).intl;
|
|
const string = intl.string;
|
|
const t = guildId(1236).t;
|
|
if (tmp10) {
|
|
let stringResult = string(t.cvoikF);
|
|
} else {
|
|
stringResult = string(t["cY+Oob"]);
|
|
}
|
|
obj = { startExpanded: true, dismissAccessibilityLabel: null, onDismiss: null, contentStyles: null, children: null };
|
|
const intl2 = tmp2(1236).intl;
|
|
obj[1] = intl2.string(guildId(1236).t.cpT0Cq);
|
|
obj[2] = callback3;
|
|
obj[3] = tmp.container;
|
|
const items7 = [callback3(markAsDismissed(15149), { themeSettings: stateFromStores1, isPersonal: tmp10 }), , , , , , ];
|
|
obj = { accessibilityRole: "header", variant: "heading-xl/semibold", color: "mobile-text-heading-primary", style: tmp.title, children: null };
|
|
const intl3 = tmp2(1236).intl;
|
|
obj[4] = intl3.string(guildId(1236).t.Q9zFy9);
|
|
items7[1] = callback3(guildId(4251).Text, obj);
|
|
obj1 = { variant: "text-md/normal", color: "text-default", style: tmp.description, children: null };
|
|
const intl4 = tmp2(1236).intl;
|
|
obj1[3] = intl4.string(guildId(1236).t.XLpBLj);
|
|
items7[2] = callback3(guildId(4251).Text, obj1);
|
|
let obj2 = { style: tmp.options, children: null };
|
|
let obj3 = { hasIcons: false, value: tmp5, onChange: callback, children: null };
|
|
const obj4 = { label: null, value: null };
|
|
const intl5 = tmp2(1236).intl;
|
|
obj4[0] = intl5.string(guildId(1236).t.aN3RNQ);
|
|
obj4[1] = guildId(4187).GuildThemeSourcePreference.GUILD;
|
|
const items8 = [callback3(guildId(7766).TableRadioRow, obj4), ];
|
|
const obj5 = { label: null, value: null };
|
|
const intl6 = tmp2(1236).intl;
|
|
obj5[0] = intl6.string(guildId(1236).t.js8y7t);
|
|
obj5[1] = guildId(4187).GuildThemeSourcePreference.PERSONAL;
|
|
items8[1] = callback3(guildId(7766).TableRadioRow, obj5);
|
|
obj3[3] = items8;
|
|
obj2[1] = callback4(guildId(7767).TableRadioGroup, obj3);
|
|
items7[3] = callback3(c6, obj2);
|
|
let tmp20Result = null;
|
|
if (tmp10) {
|
|
const obj6 = { style: null, children: null };
|
|
obj6[0] = tmp.warning;
|
|
const obj7 = { messageType: null, borderRadius: null, children: null };
|
|
obj7[0] = tmp2(1297).HelpMessageTypes.WARNING;
|
|
obj7[1] = tmp21(712).radii.md;
|
|
const intl7 = tmp2(1236).intl;
|
|
obj7[2] = intl7.string(tmp2(1236).t.tTHQAy);
|
|
obj6[1] = tmp20(tmp2(1297).HelpMessage, obj7);
|
|
tmp20Result = tmp20(tmp22, obj6);
|
|
}
|
|
items7[4] = tmp20Result;
|
|
tmp20Result = null;
|
|
if (null != tmp7) {
|
|
const obj8 = { style: null, children: null };
|
|
obj8[0] = tmp.warning;
|
|
const obj9 = { messageType: null, borderRadius: null, children: null };
|
|
obj9[0] = tmp2(1297).HelpMessageTypes.ERROR;
|
|
obj9[1] = tmp21(712).radii.md;
|
|
obj9[2] = tmp7;
|
|
obj8[1] = tmp20(tmp2(1297).HelpMessage, obj9);
|
|
tmp20Result = tmp20(tmp22, obj8);
|
|
}
|
|
items7[5] = tmp20Result;
|
|
const obj10 = { style: tmp.footer, children: null };
|
|
const obj11 = { text: stringResult, variant: null, loading: null, disabled: null, onPress: null };
|
|
let str = "primary";
|
|
if (tmp10) {
|
|
str = "secondary";
|
|
}
|
|
obj11[1] = str;
|
|
obj11[2] = tmp9;
|
|
obj11[3] = tmp9;
|
|
obj11[4] = callback2;
|
|
obj10[1] = callback3(guildId(4665).Button, obj11);
|
|
items7[6] = callback3(c6, obj10);
|
|
obj[4] = items7;
|
|
return callback4(guildId(5323).BottomSheet, obj);
|
|
};
|
|
export const GUILD_THEME_NUX_ACTION_SHEET_KEY = "GuildThemeNuxActionSheet";
|