Files
discord-decomp/sources/modules/notifications/native/GuildHighlightsNotificationsActionSheet.tsx
T
2026-07-28 01:06:53 +03:00

315 lines
17 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] */
import Module00057 from '../../../by-id/module-00057.js'; /* Metro dependency 57 */
import GuildStore from '../../../stores/GuildStore.tsx'; /* Metro dependency 1867 */
import HelpdeskUtils from '../../../utils/HelpdeskUtils.tsx'; /* Metro dependency 1948 */
import ActionSheetActionCreators from '../../action_sheet/native/ActionSheetActionCreators.tsx'; /* Metro dependency 4080 */
import UserGuildSettingsStore from '../../../stores/UserGuildSettingsStore.tsx'; /* Metro dependency 4864 */
import GuildIcon from '../../guild/native/GuildIcon.tsx'; /* Metro dependency 6819 */
import * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ReactNativeModule from '../../../by-id/module-00027-ReactNative.js'; /* Metro dependency 27 */
import * as ReactModule from '../../../by-id/module-00031-React.js'; /* Metro dependency 31 */
import * as UseStateFromStoresModule from '../../../external/discord_common/js/packages/flux/useStateFromStores.tsx'; /* Metro dependency 632 */
import * as ConstantsModule from '../../../Constants.tsx'; /* Metro dependency 661 */
import * as TextModule from '../../../design/components/Text/native/Text.tsx'; /* Metro dependency 4573 */
import * as BottomSheetNativeModule from '../../../design/components/Sheet/native/BottomSheet.native.tsx'; /* Metro dependency 6275 */
import * as Module06277Module from '../../../by-id/module-06277.js'; /* Metro dependency 6277 */
import * as TextWithIOSLinkWorkaroundModule from '../../a11y/native/TextWithIOSLinkWorkaround.tsx'; /* Metro dependency 6766 */
import * as GuildIconModule from '../../guild/native/GuildIcon.tsx'; /* Metro dependency 6819 */
import * as ConstantsModule2 from '../../feedback/Constants.tsx'; /* Metro dependency 9906 */
import * as PushFeedbackActionsModule from '../../push_feedback/PushFeedbackActions.tsx'; /* Metro dependency 9907 */
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});
let value = ConstantsModule;
const env0_8 = value.HelpdeskArticles;
const env0_9 = value.HighlightSettings;
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 object2 = {'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;
object2.backgroundColor = GUILD_NOTIFICATIONS_BOTTOM_SHEET_PILL_BACKGROUND;
object2.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.round;
const SHADOW_LOW = (importDefault(697) /* metro dependency 697: native */).shadows.SHADOW_LOW;
copyDataProperties(object2, SHADOW_LOW, undefined);
const env0_14 = Reflect.apply(createStyles, value, [{guildPill: object2, guildName: {paddingHorizontal: 8}}]);
(FileImportTrackerModule).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 GuildIconSizes = (GuildIconModule).GuildIconSizes;
const SMALL_32 = GuildIconSizes.SMALL_32;
const guildIcon = (
<GuildIcon
guild={guild}
size={SMALL_32}
animate
/>
);
const Text = (TextModule).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 = (TextModule).Text;
var Card;
var FormSwitchRow;
var object2;
const styles = useStyles();
const binding = env0_4;
const value4 = binding.useRef(null);
let useState = binding.useState;
const value5 = Reflect.apply(useState, binding, [undefined]);
const value6 = Module00057(value5, 2);
const property = value6[0];
var env0_4 = value6[1];
useState = binding.useState;
const value8 = Module00057(Reflect.apply(useState, binding, [false]), 2);
const property2 = value8[0];
const env0_6 = value8[1];
useState = binding.useState;
const value9 = Module00057(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 useStateFromStoresObject = UseStateFromStoresModule.useStateFromStoresObject;
object = [UserGuildSettingsStore];
object[1] = GuildStore;
const {guild, muted, notifyHighlights} = Reflect.apply(useStateFromStoresObject, UseStateFromStoresModule, [object,
function() {
var object = {};
var guildStoreBinding = GuildStore;
var guildIdBinding = guildId;
object.guild = guildStoreBinding.getGuild(guildIdBinding);
var userGuildSettingsStoreBinding = UserGuildSettingsStore;
object.muted = userGuildSettingsStoreBinding.isMuted(guildIdBinding);
object.notifyHighlights = userGuildSettingsStoreBinding.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 = (BottomSheetNativeModule).BottomSheet;
const r5 = r6 ? value19 : undefined;
const BottomSheetScrollView = (Module06277Module).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 = (TextWithIOSLinkWorkaroundModule).TextWithIOSLinkWorkaround;
let centerText = styles.centerText;
let format = intl.format;
const enfuur = (require(1244) /* metro dependency 1244: indexNative */).t.enfuur;
let defaultImport = 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 (!(ReactNativeModule.View || 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 _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);
}
}
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);
}
(PushFeedbackActionsModule).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__;
(ActionSheetActionCreators).hideActionSheet();
value = importDefault(6613) /* metro dependency 6613: NotificationSettingsModalActionCreators */;
value.open(guildId);
}
}
}
global.__d(_fun77624, 9905, [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]) /* metro module 9905, 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] */;