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

172 lines
11 KiB
TypeScript

/* Metro module 15428; source: modules/soundboard/native/SoundboardSoundPreviewActionSheet.tsx; dependencies: [29, 31, 27, 1878, 4613, 661, 33, 4501, 697, 477, 566, 6771, 6944, 6951, 6639, 4583, 6805, 6739, 11508, 4573, 4578, 8633, 8635, 1244, 8146, 4017, 2] */
import ObjectWithoutProperties from '../../../by-id/module-00029-ObjectWithoutProperties.js'; /* Metro dependency 29 */
import UserStore from '../../../stores/UserStore.tsx'; /* Metro dependency 1878 */
import ReanimatedRexport from '../../reanimated/ReanimatedRexport.tsx'; /* Metro dependency 4017 */
import SoundboardStore from '../SoundboardStore.tsx'; /* Metro dependency 4613 */
import UseAnalyticsLocations from '../../app_analytics/useAnalyticsLocations.tsx'; /* Metro dependency 6771 */
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 JsxRuntimeModule from '../../../by-id/module-00033-JsxRuntime.js'; /* Metro dependency 33 */
import * as PlatformUtilsModule from '../../../utils/PlatformUtils.tsx'; /* Metro dependency 477 */
import * as FluxModule from '../../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
import * as ConstantsModule from '../../../Constants.tsx'; /* Metro dependency 661 */
import * as IndexNativeModule from '../../../intl/index.native.tsx'; /* Metro dependency 1244 */
import * as CreateStylesModule from '../../../design/components/Styles/native/createStyles.tsx'; /* Metro dependency 4501 */
import * as TextModule from '../../../design/components/Text/native/Text.tsx'; /* Metro dependency 4573 */
import * as ButtonNativeModule from '../../../design/components/Button/native/Button.native.tsx'; /* Metro dependency 4578 */
import * as ButtonHooksNativeModule from '../../../design/components/Button/native/ButtonHooks.native.tsx'; /* Metro dependency 4583 */
import * as ActionSheetNativeModule from '../../../design/components/Sheet/native/ActionSheet.native.tsx'; /* Metro dependency 6805 */
function _fun118030(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#118030, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15625:6, offset: 0x024c927c, size: 641 bytes, params: 8, frame: 25
const env0_0 = require;
const env0_3 = ['style'];
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const value = undefined;
const StyleSheet = ReactNativeModule.StyleSheet;
const createStyles = CreateStylesModule.createStyles;
object = {};
let PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
object.emoji = {'marginTop': null, 'width': 64, 'height': 64, 'alignSelf': 'center', marginTop: PX_16};
object.emojiFastImage = {'width': 128, 'height': 128};
object.emojiText = {fontSize: PlatformUtilsModule.isIOS() ? 60 : value, lineHeight: 74};
PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
object.text = {marginTop: PX_16, alignSelf: 'center'};
const object5 = {};
const PX_8 = (importDefault(697) /* metro dependency 697: native */).space.PX_8;
object5.gap = PX_8;
const PX_24 = (importDefault(697) /* metro dependency 697: native */).space.PX_24;
object5.marginTop = PX_24;
object.buttonContainer = object5;
const TEXT_DEFAULT = (importDefault(697) /* metro dependency 697: native */).colors.TEXT_DEFAULT;
object.star = {'width': 16, 'height': 16, tintColor: TEXT_DEFAULT};
const object6 = {'borderColor': 'transparent', 'borderWidth': 1, 'borderRadius': null, 'pointerEvents': 'none'};
object6.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.round;
copyDataProperties(object6, StyleSheet.absoluteFillObject, undefined);
object.border = object6;
const TEXT_FEEDBACK_POSITIVE = (importDefault(697) /* metro dependency 697: native */).colors.TEXT_FEEDBACK_POSITIVE;
object.borderPlaying = {borderColor: TEXT_FEEDBACK_POSITIVE};
const env0_13 = Reflect.apply(createStyles, CreateStylesModule, [object]);
(FileImportTrackerModule).fileFinishedImporting('modules/soundboard/native/SoundboardSoundPreviewActionSheet.tsx');
exports.default = SoundboardSoundPreviewActionSheet;
return value;
function SoundboardSoundPreviewActionSheet({channelId, sound}) { // fn#118031, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15625:943, offset: 0x024c94fd, size: 1057 bytes, params: 2, frame: 38
const styles = useStyles();
const env0_2 = (FluxModule).useStateFromStores([UserStore], _fun118032);
const analyticsLocations = (UseAnalyticsLocations)().analyticsLocations;
const analyticsLocations2 = analyticsLocations;
const value2 = (FluxModule).useStateFromStoresObject([SoundboardStore],
_fun118033);
const isPlayingSound = value2.isPlayingSound;
const isPlayingSound2 = isPlayingSound;
const isFavorite = value2.isFavorite;
const binding = isFavorite;
const value3 = binding.useCallback(_fun118034, [isFavorite, sound, analyticsLocations]);
const value4 = binding.useCallback(_fun118035, [channelId, sound, isPlayingSound]);
const value5 = (ButtonHooksNativeModule).useButtonPressAnimationProps();
const style = value5.style;
const isPlayingSound22 = isPlayingSound2(value5, analyticsLocations2);
const ActionSheet = (ActionSheetNativeModule).ActionSheet;
const items3 = [
((Component) => <Component fastImageStyle={[styles.emoji, styles.emojiFastImage]} textEmojiStyle={[styles.emoji,
styles.emojiText]} src={(importDefault(11508) /* metro dependency 11508: getSoundboardEmojiUrl */)(sound,
64)} name={sound.emojiName ?? ''} />)(importDefault(6739) /* metro dependency 6739: Emoji */),
];
const Text = (TextModule).Text;
items3[1] = (
<Text style={styles.text} variant="heading-lg/extrabold">
{sound.name}
</Text>
);
const Button = (ButtonNativeModule).Button;
const buttonProps2 = {variant: 'primary',
icon: ((Component) => <Component style={styles.star} />)(isFavorite ? (require(8633) /* metro dependency 8633: StarIcon */).StarIcon : (require(8635) /* metro dependency 8635: StarOutlineIcon */).StarOutlineIcon)};
const intl = (IndexNativeModule).intl;
let string = intl.string;
const t = (IndexNativeModule).t;
buttonProps2.text = isFavorite ? Reflect.apply(string, intl, [t.aBUcp3]) : Reflect.apply(string, intl, [t.yZFibY]);
buttonProps2.onPress = value3;
const button = <Button {...buttonProps2} />;
const buttonProps = {...isPlayingSound22};
buttonProps['variant'] = 'secondary';
buttonProps['icon'] = <Image style={styles.star} source={importDefault(8146) /* metro dependency 8146 */} />;
string = intl.string;
const Kd4uxG = (IndexNativeModule).t.Kd4uxG;
buttonProps['text'] = Reflect.apply(string, intl, [Kd4uxG]);
buttonProps['onPress'] = value4;
const button2 = <Button {...buttonProps} />;
const View2 = (ReanimatedRexport).View;
items3[2] = (
<View style={styles.buttonContainer}>
{button}
<View>
{button2}
<View2 style={[styles.border, isPlayingSound && styles.borderPlaying, style]} />
</View>
</View>
);
return (
<ActionSheet startExpanded>
<View>
{items3}
</View>
</ActionSheet>
);
function _fun118032() { // fn#118032, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15625:1056, offset: 0x024c991e, size: 34 bytes, params: 1, frame: 10
const value = environment.__proto__;
return UserStore.getCurrentUser()?.id;
}
function _fun118033() { // fn#118033, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15625:1191, offset: 0x024c9940, size: 82 bytes, params: 1, frame: 14
const r2 = env0_2 != null && SoundboardStore.isUserPlayingSounds(env0_2);
const soundboardStoreBinding = SoundboardStore;
return {isPlayingSound: r2, isFavorite: soundboardStoreBinding.isFavoriteSound(sound.soundId)};
}
function _fun118034() { // fn#118034, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15625:1341, offset: 0x024c9992, size: 163 bytes, params: 1, frame: 20
var moduleValue;
var trackSoundFavorited;
var object;
var soundBinding;
var object2;
var moduleValue2;
var value;
if (isFavorite) {
moduleValue2 = require(6944) /* metro dependency 6944: SoundboardActionCreators */;
moduleValue2.removeFavoriteSound(sound.soundId);
} else {
moduleValue = require(6951) /* metro dependency 6951: SoundboardUtils */;
trackSoundFavorited = moduleValue.trackSoundFavorited;
object = {};
soundBinding = sound;
object.sound = soundBinding;
object2 = {};
copyDataProperties(object2, analyticsLocations, undefined);
object2['object'] = AnalyticsObjects.SOUNDBOARD_SOUND;
object.location = object2;
Reflect.apply(trackSoundFavorited, moduleValue, [object]);
value = require(6944) /* metro dependency 6944: SoundboardActionCreators */;
value.addFavoriteSound(soundBinding.soundId);
}
}
function _fun118035() { // fn#118035, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15625:1537, offset: 0x024c9a35, size: 84 bytes, params: 1, frame: 18
var value2;
var moduleValue;
if (!isPlayingSound) {
value2 = environment.__proto__;
moduleValue = require(6944) /* metro dependency 6944: SoundboardActionCreators */;
moduleValue.playSoundLocally(channelId, sound,
(require(6639) /* metro dependency 6639: SoundboardTypes */).LocalSoundTrigger.SOUNDBOARD);
}
}
}
}
global.__d(_fun118030, 15428, [29, 31, 27, 1878, 4613, 661, 33, 4501, 697, 477, 566, 6771, 6944, 6951, 6639, 4583,
6805, 6739, 11508, 4573, 4578, 8633, 8635, 1244, 8146, 4017,
2]) /* metro module 15428, dependencies: [29, 31, 27, 1878, 4613, 661, 33, 4501, 697, 477, 566, 6771, 6944, 6951, 6639, 4583, 6805, 6739, 11508, 4573, 4578, 8633, 8635, 1244, 8146, 4017, 2] */;