Files
discord-decomp/sources/modules/notifications/native/GuildHighlightsNotificationsActionSheet.tsx
T
2026-07-27 16:20:00 +03:00

250 lines
14 KiB
TypeScript

/* Metro module 9905; source: modules/notifications/native/GuildHighlightsNotificationsActionSheet.tsx; dependencies: [57, 31, 27, 1867, 4864, 661, 9906, 33, 4501, 697, 6819, 4573, 9907, 632, 1244, 9908, 1585, 6275, 6277, 6766, 1948, 4017, 6239, 7972, 6613, 6610, 4080, 2] */
function _fun77624(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#77624, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10091:6, offset: 0x01e0469b, size: 616 bytes, params: 8, frame: 23
const env0_0 = require;
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(27) /* metro dependency 27 */).View;
const guildStore = importDefault(1867) /* metro dependency 1867: GuildStore */;
const userGuildSettingsStore = importDefault(4864) /* metro dependency 4864: UserGuildSettingsStore */;
let value = require(661) /* metro dependency 661: Constants */;
const env0_8 = value.HelpdeskArticles;
const env0_9 = value.HighlightSettings;
const env0_10 = (require(9906) /* metro dependency 9906: Constants */).FeedbackRating;
value = require(33) /* metro dependency 33 */;
const env0_11 = value.jsx;
const env0_12 = value.jsxs;
value = require(4501) /* metro dependency 4501: createStyles */;
let createStyles = value.createStyles;
const BACKGROUND_SURFACE_HIGH = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_SURFACE_HIGH;
const env0_13 = Reflect.apply(createStyles, value, [{contentContainer: {'padding': 24, 'alignItems': 'center',
'justifyContent': 'center'}, header: {'alignItems': 'center', 'paddingBottom': 24},
headerTitle: {marginBottom: 4}, centerText: {textAlign: 'center'}, feedback: {'marginTop': 16,
'alignItems': 'stretch', 'alignSelf': 'stretch', 'paddingBottom': 16}, thanks: {'height': 40,
'textAlign': 'center', 'textAlignVertical': 'center'}, settings: {'flex': 1, 'backgroundColor': null,
'marginVertical': 8, 'padding': 0, backgroundColor: BACKGROUND_SURFACE_HIGH}}]);
value = require(4501) /* metro dependency 4501: createStyles */;
createStyles = value.createStyles;
const object = {'flexDirection': 'row', 'padding': 8, 'marginBottom': 16, 'backgroundColor': null,
'alignItems': 'center', 'justifyContent': 'center'};
const GUILD_NOTIFICATIONS_BOTTOM_SHEET_PILL_BACKGROUND = (importDefault(697) /* metro dependency 697: native */).colors.GUILD_NOTIFICATIONS_BOTTOM_SHEET_PILL_BACKGROUND;
object.backgroundColor = GUILD_NOTIFICATIONS_BOTTOM_SHEET_PILL_BACKGROUND;
object.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.round;
const SHADOW_LOW = (importDefault(697) /* metro dependency 697: native */).shadows.SHADOW_LOW;
copyDataProperties(object, SHADOW_LOW, undefined);
const env0_14 = Reflect.apply(createStyles, value, [{guildPill: object, guildName: {paddingHorizontal: 8}}]);
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/notifications/native/GuildHighlightsNotificationsActionSheet.tsx');
exports.default = SummaryFeedbackActionSheet;
}
function GuildPill({guild}) { // fn#77625, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10091:1013, offset: 0x01e04903, size: 210 bytes, params: 2, frame: 22
const styles = useStyles();
const GuildIcon = importDefault(6819) /* metro dependency 6819: GuildIcon */;
const GuildIconSizes = (require(6819) /* metro dependency 6819: GuildIcon */).GuildIconSizes;
const SMALL_32 = GuildIconSizes.SMALL_32;
const guildIcon = <GuildIcon guild={guild} size={SMALL_32} animate />;
const Text = (require(4573) /* metro dependency 4573: Text */).Text;
return (
<View style={styles.guildPill}>
{guildIcon}
<Text
style={styles.guildName}
variant="heading-md/semibold"
color="mobile-text-heading-primary"
>
{guild?.name}
</Text>
</View>
);
}
function isFeedbackComplete(a0) { // fn#77626, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10091:1301, offset: 0x01e049d5, size: 49 bytes, params: 2, frame: 4
const {rating, reason} = a0 ?? ({});
const GOOD = FeedbackRating.GOOD;
return rating === GOOD || reason != null;
}
function isFeedbackGood(a0) { // fn#77627, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10091:1400, offset: 0x01e04a06, size: 36 bytes, params: 2, frame: 2
const rating = (a0 ?? ({})).rating;
const GOOD = FeedbackRating.GOOD;
return rating === GOOD;
}
function SummaryFeedbackActionSheet({guildId, feedbackSettings}) { // fn#77628, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10091:1581, offset: 0x01e04a2a, size: 1702 bytes, params: 2, frame: 42
var r11;
var r1;
var r21;
var r13;
var FeedbackForm;
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
const t = (require(1244) /* metro dependency 1244: indexNative */).t;
const Text = (require(4573) /* metro dependency 4573: Text */).Text;
var Card;
var FormSwitchRow;
var object11;
const styles = useStyles();
const binding = env0_4;
const value4 = binding.useRef(null);
let useState = binding.useState;
const value5 = Reflect.apply(useState, binding, [undefined]);
const binding2 = env0_3;
const value6 = binding2(value5, 2);
const property = value6[0];
var env0_4 = value6[1];
useState = binding.useState;
const value8 = binding2(Reflect.apply(useState, binding, [false]), 2);
const property2 = value8[0];
const env0_6 = value8[1];
useState = binding.useState;
const value9 = binding2(Reflect.apply(useState, binding, [false]), 2);
const property3 = value9[0];
const env0_7 = value9[1];
const value10 = binding.useCallback(_fun77629, [property2, feedbackSettings]);
binding.useEffect(function() {
return _fun77631;
}, [property, value10]);
const value11 = binding.useCallback(_fun77632, [value10]);
const value12 = binding.useCallback(_fun77633, []);
const useStateFromStoresModule = require(632) /* metro dependency 632: useStateFromStores */;
const useStateFromStoresObject = useStateFromStoresModule.useStateFromStoresObject;
object = [UserGuildSettingsStore];
object[1] = GuildStore;
const {guild, muted, notifyHighlights} = Reflect.apply(useStateFromStoresObject, useStateFromStoresModule, [object,
function() {
var object = {};
var guildIdBinding = guildId;
object.guild = GuildStore.getGuild(guildIdBinding);
object.muted = UserGuildSettingsStore.isMuted(guildIdBinding);
object.notifyHighlights = UserGuildSettingsStore.getNotifyHighlights(guildIdBinding);
return object;
}, [guildId]]);
const value14 = feedbackSettings?.reasons != null;
if (value14) {
if (isFeedbackComplete(property)) {
r1 = <Text style={[styles.centerText,
styles.thanks]} variant="heading-md/semibold" color="text-brand">{intl.string((require(1244) /* metro dependency 1244: indexNative */).t.kZbFIO)}</Text>;
} else {
FeedbackForm = (require(9908) /* metro dependency 9908: FeedbackForm */).FeedbackForm;
var feedbackFormProps = {ratingsBodyLabel: intl.string(t.Yzl7Or),
reasonsHeaderLabel: intl.string(t.g1q5fr)};
r11 = feedbackSettings?.reasons ?? [];
feedbackFormProps.reasons = r11;
r11 = feedbackSettings != null ? feedbackSettings.onFeedbackShown : function() {
};
feedbackFormProps.trackOpen = r11;
feedbackFormProps.onFeedbackChanged = value11;
r1 = <FeedbackForm {...feedbackFormProps} />;
}
r21 = r1;
} else {
r21 = null;
}
const value19 = 316 + (value14 ? property2 ? 64 : 148 : 0) + (importDefault(1585) /* metro dependency 1585: useSafeAreaInsetsNative */)().bottom;
let r6 = value14 ? isFeedbackComplete(property) : !value14;
r6 = !r6 ? property?.rating == null : r6;
const BottomSheet = (require(6275) /* metro dependency 6275: BottomSheetNative */).BottomSheet;
const r5 = r6 ? value19 : undefined;
const BottomSheetScrollView = (require(6277) /* metro dependency 6277 */).BottomSheetScrollView;
const r7 = property3 ? value12 : undefined;
const items4 = [<GuildPill guild={guild} />];
items4[1] = <Text style={styles.headerTitle} variant="heading-lg/semibold" color="mobile-text-heading-primary">{intl.string((require(1244) /* metro dependency 1244: indexNative */).t.o8Bypv)}</Text>;
const TextWithIOSLinkWorkaround = (require(6766) /* metro dependency 6766: TextWithIOSLinkWorkaround */).TextWithIOSLinkWorkaround;
let centerText = styles.centerText;
let format = intl.format;
const enfuur = (require(1244) /* metro dependency 1244: indexNative */).t.enfuur;
let defaultImport = importDefault(1948) /* metro dependency 1948: HelpdeskUtils */;
const getArticleURL = defaultImport.getArticleURL;
const HIGHLIGHTS_NOTIFICATIONS = HelpdeskArticles.HIGHLIGHTS_NOTIFICATIONS;
items4[2] = <TextWithIOSLinkWorkaround style={centerText} variant="text-md/medium" color="text-default">{Reflect.apply(format,
intl, [enfuur, {helpUrl: Reflect.apply(getArticleURL, defaultImport,
[HIGHLIGHTS_NOTIFICATIONS])}])}</TextWithIOSLinkWorkaround>;
const items5 = [<View style={styles.header}>{items4}</View>];
items5[1] = r21 != null && ((View) => <View style={styles.feedback}>{r21}</View>)((importDefault(4017) /* metro dependency 4017: ReanimatedRexport */).View);
const isFeedbackGood2 = isFeedbackGood(property);
if (isFeedbackGood2) {
r13 = !isFeedbackGood2;
} else {
Card = (require(6239) /* metro dependency 6239: CardNative */).Card;
var cardProps = {'style': null, 'shadow': 'low', 'border': 'subtle', style: styles.settings};
FormSwitchRow = (require(7972) /* metro dependency 7972: native */).FormSwitchRow;
r13 = <Card {...cardProps}><FormSwitchRow disabled={muted} label={intl.string((require(1244) /* metro dependency 1244: indexNative */).t.MVi7LQ)} value={muted || notifyHighlights === HighlightSettings.DISABLED} onValueChange={function(a0) {
var defaultImport = importDefault(dependencyMap[24]);
var updateGuildNotificationSettings = defaultImport.updateGuildNotificationSettings;
var guildIdBinding = guildId;
var object = {};
object.notify_highlights = a0 ? HighlightSettings.DISABLED : HighlightSettings.ENABLED;
var NotificationLabel = require(dependencyMap[25]).NotificationLabel;
Reflect.apply(updateGuildNotificationSettings, defaultImport, [guildIdBinding, object,
NotificationLabel.highlights(!a0)]);
}} /></Card>;
}
items5[2] = r13;
centerText = styles.centerText;
format = intl.format;
const F9rfLX = (require(1244) /* metro dependency 1244: indexNative */).t.F9rfLX;
items5[3] = <TextWithIOSLinkWorkaround style={centerText} variant="text-sm/medium" color="text-default">{Reflect.apply(format,
intl, [F9rfLX, {notifSettingsHook: notifSettingsHook}])}</TextWithIOSLinkWorkaround>;
return (
<BottomSheet
scrollable
ref={value4}
contentHeight={r5}
startHeight={value19}
>
<BottomSheetScrollView contentContainerStyle={styles.contentContainer} onLayout={r7}>
<View>
{items5}
</View>
</BottomSheetScrollView>
</BottomSheet>
);
}
function _fun77629(a0) { // fn#77629, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10091:1819, offset: 0x01e050d0, size: 132 bytes, params: 2, frame: 14
var value6;
if (!(env0_5 || a0?.rating == null)) {
if (!(feedbackSettings == null || feedbackSettings.onFeedbackCompleted == null)) {
feedbackSettings.onFeedbackCompleted(a0);
}
value6 = environment.__proto__;
(require(9907) /* metro dependency 9907: PushFeedbackActions */).handleSurveyCleanup();
env0_6(true);
}
}
function _fun77630() { // fn#77630, offset: 0x01e05154, size: 11 bytes, params: 1, frame: 1
return _fun77631;
}
function _fun77632(a0) { // fn#77632, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10091:2027, offset: 0x01e05173, size: 97 bytes, params: 2, frame: 14
env0_4(a0);
if (isFeedbackComplete(a0)) {
env0_8(a0);
env0_7(false);
} else {
env0_7(true);
}
(require(9907) /* metro dependency 9907: PushFeedbackActions */).handleSurveyCleanup();
}
function _fun77633() { // fn#77633, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10091:2132, offset: 0x01e051d4, size: 43 bytes, params: 1, frame: 11
const current = env0_2.current;
if (current != null) {
current.expandActionSheet();
}
env0_7(false);
}
function notifSettingsHook() { // fn#77637, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10091:4168, owner: SummaryFeedbackActionSheet.notifSettingsHook, offset: 0x01e052ba, size: 67 bytes, params: 1, frame: 13
let value = environment.__proto__;
(importDefault(4080) /* metro dependency 4080: ActionSheetActionCreators */).hideActionSheet();
value = importDefault(6613) /* metro dependency 6613: NotificationSettingsModalActionCreators */;
value.open(guildId);
}
function _fun77631() { // fn#77631, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10091:1987, offset: 0x01e0515f, size: 20 bytes, params: 1, frame: 11
env1_8(env1_3);
}