256 lines
19 KiB
TypeScript
256 lines
19 KiB
TypeScript
/* Metro module 15423; source: modules/soundboard/native/SoundButton.tsx; dependencies: [31, 27, 1878, 15418, 33, 4017, 4501, 697, 477, 5278, 4577, 6739, 11508, 15424, 566, 15425, 6771, 6789, 6951, 3802, 7890, 7892, 3857, 10896, 1244, 15427, 4573, 6705, 2] */
|
|
import UserStore from '../../../stores/UserStore.tsx'; /* Metro dependency 1878 */
|
|
import ReanimatedRexport from '../../reanimated/ReanimatedRexport.tsx'; /* Metro dependency 4017 */
|
|
import UseAnalyticsLocations from '../../app_analytics/useAnalyticsLocations.tsx'; /* Metro dependency 6771 */
|
|
import AnalyticsLocation from '../../app_analytics/AnalyticsLocation.tsx'; /* Metro dependency 6789 */
|
|
import UseSoundboardSoundPlayerNative from '../useSoundboardSoundPlayer.native.tsx'; /* Metro dependency 15425 */
|
|
import OpenSoundboardSoundPreviewActionSheet from './utils/openSoundboardSoundPreviewActionSheet.tsx'; /* Metro dependency 15427 */
|
|
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 IndexNativeModule from '../../../intl/index.native.tsx'; /* Metro dependency 1244 */
|
|
import * as ReanimatedRexportModule from '../../reanimated/ReanimatedRexport.tsx'; /* Metro dependency 4017 */
|
|
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 SpringModule from '../../../design/animation/reanimated/spring/spring.tsx'; /* Metro dependency 4577 */
|
|
import * as PressablesModule from '../../../design/void/Pressables/native/Pressables.tsx'; /* Metro dependency 5278 */
|
|
import * as SoundboardUtilsModule from '../SoundboardUtils.tsx'; /* Metro dependency 6951 */
|
|
import * as SoundboardStyleConstantsModule from './SoundboardStyleConstants.tsx'; /* Metro dependency 15418 */
|
|
import * as SoundboardHooksModule from './SoundboardHooks.tsx'; /* Metro dependency 15424 */
|
|
|
|
function _fun118000(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#118000, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15620:6, offset: 0x024c7f82, size: 869 bytes, params: 8, frame: 28
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const value = undefined;
|
|
const View = (ReactNativeModule).View;
|
|
const SOUND_BUTTON_HEIGHT = (SoundboardStyleConstantsModule).SOUND_BUTTON_HEIGHT;
|
|
let createAnimatedComponent = ReanimatedRexport.createAnimatedComponent;
|
|
const env0_8 = Reflect.apply(createAnimatedComponent, ReanimatedRexport, [View]);
|
|
const env0_9 = {'damping': 10, 'stiffness': 300, 'mass': 1};
|
|
const createStyles = CreateStylesModule.createStyles;
|
|
object = {};
|
|
const object2 = {'marginTop': 4, 'height': null, 'backgroundColor': null, 'display': 'flex',
|
|
'flexDirection': 'column', 'justifyContent': 'center', 'alignItems': 'center', 'borderRadius': null,
|
|
'borderWidth': 1};
|
|
object2.height = SOUND_BUTTON_HEIGHT;
|
|
const CARD_BACKGROUND_DEFAULT = (importDefault(697) /* metro dependency 697: native */).colors.CARD_BACKGROUND_DEFAULT;
|
|
object2.backgroundColor = CARD_BACKGROUND_DEFAULT;
|
|
object2.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.lg;
|
|
const BORDER_MUTED = (importDefault(697) /* metro dependency 697: native */).colors.BORDER_MUTED;
|
|
object2.borderColor = BORDER_MUTED;
|
|
const SHADOW_LOW = (importDefault(697) /* metro dependency 697: native */).shadows.SHADOW_LOW;
|
|
copyDataProperties(object2, SHADOW_LOW, undefined);
|
|
object.button = object2;
|
|
const CARD_PRIMARY_PRESSED_BG = (importDefault(697) /* metro dependency 697: native */).colors.CARD_PRIMARY_PRESSED_BG;
|
|
object.buttonPressed = {backgroundColor: CARD_PRIMARY_PRESSED_BG};
|
|
object.buttonDisabled = {opacity: 0.5};
|
|
const object5 = {'borderStyle': 'solid', 'borderWidth': 2};
|
|
const STATUS_SPEAKING = (importDefault(697) /* metro dependency 697: native */).colors.STATUS_SPEAKING;
|
|
object5.borderColor = STATUS_SPEAKING;
|
|
const CARD_SECONDARY_BG = (importDefault(697) /* metro dependency 697: native */).colors.CARD_SECONDARY_BG;
|
|
object5.backgroundColor = CARD_SECONDARY_BG;
|
|
object.buttonPlaying = object5;
|
|
const value6 = 24;
|
|
object.emoji = {'height': 24, 'width': 24, 'fontSize': null, 'lineHeight': 28,
|
|
fontSize: PlatformUtilsModule.isIOS() ? value6 : value};
|
|
const object7 = {'display': 'flex', 'alignItems': 'center', 'justifyContent': 'center', 'height': 40, 'width': 40,
|
|
'backgroundColor': null, 'backgroundSize': 32, 'borderRadius': null, 'marginBottom': 8};
|
|
const BACKGROUND_MOD_MUTED = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_MOD_MUTED;
|
|
object7.backgroundColor = BACKGROUND_MOD_MUTED;
|
|
object7.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.round;
|
|
object.emojiWrapper = object7;
|
|
object.text = {marginHorizontal: 8};
|
|
object.textPlaying = {marginHorizontal: 6};
|
|
const object10 = {'position': 'absolute', 'top': null, 'end': null, 'width': 12, 'height': 12};
|
|
let PX_12 = (importDefault(697) /* metro dependency 697: native */).space.PX_12;
|
|
object10.top = PX_12;
|
|
PX_12 = (importDefault(697) /* metro dependency 697: native */).space.PX_12;
|
|
object10.end = PX_12;
|
|
const WHITE = (importDefault(697) /* metro dependency 697: native */).colors.WHITE;
|
|
object10.tintColor = WHITE;
|
|
object.lock = object10;
|
|
const env0_10 = Reflect.apply(createStyles, CreateStylesModule, [object]);
|
|
createAnimatedComponent = ReanimatedRexport.createAnimatedComponent;
|
|
const PressableOpacity = (PressablesModule).PressableOpacity;
|
|
const env0_11 = Reflect.apply(createAnimatedComponent, ReanimatedRexport, [PressableOpacity]);
|
|
object = {code: 'function SoundButtonTsx1(){const{animationConfig,withDelay,withSpring,interpolate,SPRING_CONFIG}=this.__closure;var _animationConfig$play,_animationConfig$pres,_animationConfig;const isNotPressed=animationConfig.sharedValues.pressed.get()===0;const isPlaying=animationConfig.sharedValues.playing.get()>0;const shouldDoPlayingAnimation=isNotPressed&&isPlaying;const playingAnimationScaleValue=withDelay((_animationConfig$play=animationConfig.playingAnimationDelay)!==null&&_animationConfig$play!==void 0?_animationConfig$play:0,withSpring(interpolate(animationConfig.sharedValues.playing.get(),[0,1],[1,animationConfig.scaleFactors.playing]),SPRING_CONFIG));const pressedAnimationScaleValue=withSpring(interpolate(animationConfig.sharedValues.pressed.get(),[0,1],[1,animationConfig.scaleFactors.pressed]),SPRING_CONFIG);const rotationScaleValue=interpolate(animationConfig.sharedValues.pressed.get(),[0,1],[0,(_animationConfig$pres=(_animationConfig=animationConfig)===null||_animationConfig===void 0?void 0:_animationConfig.pressedRotationDegrees)!==null&&_animationConfig$pres!==void 0?_animationConfig$pres:0]);return{transform:[{scale:shouldDoPlayingAnimation?playingAnimationScaleValue:pressedAnimationScaleValue},{rotate:rotationScaleValue+"deg"}]};}'};
|
|
const value9 = ReactModule.memo(_fun118004);
|
|
(FileImportTrackerModule).fileFinishedImporting('modules/soundboard/native/SoundButton.tsx');
|
|
exports.SoundButton = value9;
|
|
return value;
|
|
function useAnimation(a0) { // fn#118001, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15620:2620, offset: 0x024c82e7, size: 163 bytes, params: 2, frame: 18
|
|
const env0_0 = a0;
|
|
const useAnimatedStyle = ReanimatedRexportModule.useAnimatedStyle;
|
|
const useAnimationT2 = useAnimationT;
|
|
const object = {animationConfig: a0};
|
|
object.withDelay = ReanimatedRexportModule.withDelay;
|
|
object.withSpring = (require(4577) /* metro dependency 4577: spring */).withSpring;
|
|
object.interpolate = ReanimatedRexportModule.interpolate;
|
|
object.SPRING_CONFIG = env0_9;
|
|
useAnimationT2.__closure = object;
|
|
useAnimationT2.__workletHash = 13932429225740;
|
|
useAnimationT2.__initData = env0_12;
|
|
return Reflect.apply(useAnimatedStyle, ReanimatedRexportModule, [useAnimationT2]);
|
|
function useAnimationT() { // fn#118002, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15620:2660, owner: useAnimation.t, offset: 0x024c838a, size: 518 bytes, params: 1, frame: 32
|
|
let binding = env0_0;
|
|
const value2 = binding.sharedValues.pressed.get();
|
|
const value3 = binding.sharedValues.playing.get();
|
|
const value4 = 0;
|
|
const value5 = value3 > value4;
|
|
const value7 = undefined;
|
|
const withDelay = ReanimatedRexportModule.withDelay;
|
|
const r6 = binding.playingAnimationDelay ?? value4;
|
|
let withSpring = SpringModule.withSpring;
|
|
let interpolate = ReanimatedRexportModule.interpolate;
|
|
binding = env0_0;
|
|
const value9 = Reflect.apply(interpolate, ReanimatedRexportModule, [binding.sharedValues.playing.get(), [0, 1], [1,
|
|
binding.scaleFactors.playing]]);
|
|
const binding2 = env1_9;
|
|
const value10 = Reflect.apply(withDelay, ReanimatedRexportModule, [r6, Reflect.apply(withSpring, SpringModule,
|
|
[value9, binding2])]);
|
|
withSpring = SpringModule.withSpring;
|
|
const value12 = Reflect.apply(withSpring, SpringModule,
|
|
[ReanimatedRexportModule.interpolate(binding.sharedValues.pressed.get(), [0, 1], [1, binding.scaleFactors.pressed]),
|
|
binding2]);
|
|
const items2 = [{scale: value4 !== value2 ? value12 : value5 ? value10 : value12}];
|
|
interpolate = ReanimatedRexportModule.interpolate;
|
|
binding = env0_0;
|
|
items2[1] = {rotate: '' + Reflect.apply(interpolate, ReanimatedRexportModule, [binding.sharedValues.pressed.get(), [0, 1], [0,
|
|
(binding == null ? value7 : env0_0.pressedRotationDegrees) ?? value4]]) + 'deg'};
|
|
return {transform: items2};
|
|
}
|
|
|
|
}
|
|
|
|
function SoundButtonEmoji({sound, sharedValues}) { // fn#118003, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15620:3400, offset: 0x024c8590, size: 279 bytes, params: 2, frame: 21
|
|
const styles = useStyles();
|
|
const value2 = useAnimation({sharedValues: sharedValues, scaleFactors: {'pressed': 0.8, 'playing': 1.2}});
|
|
const value3 = useAnimation({sharedValues: sharedValues, scaleFactors: {'pressed': 0.7200000000000001,
|
|
'playing': 1.08}, playingAnimationDelay: 100, pressedRotationDegrees: -15});
|
|
const binding = env0_8;
|
|
return ((Component) => <Component style={[styles.emojiWrapper,
|
|
value2]}>{((Component) => <Component style={value3}>{((Component) => <Component fastImageStyle={styles.emoji} textEmojiStyle={styles.emoji} src={(importDefault(11508) /* metro dependency 11508: getSoundboardEmojiUrl */)(sound,
|
|
24)} name={sound.emojiName ?? ''} />)(importDefault(6739) /* metro dependency 6739: Emoji */)}</Component>)(binding)}</Component>)(binding);
|
|
}
|
|
|
|
function _fun118004({sound, channel, style, isSectionLocked}) { // fn#118004, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15620:3846, offset: 0x024c86a7, size: 867 bytes, params: 2, frame: 33
|
|
isSectionLocked = !(isSectionLocked === undefined) && isSectionLocked;
|
|
const useSoundButtonStyleConfig = SoundboardHooksModule.useSoundButtonStyleConfig;
|
|
const buttonWidth = Reflect.apply(useSoundButtonStyleConfig, SoundboardHooksModule, []).buttonWidth;
|
|
let r11 = sound.emojiId != null || sound.emojiName != null;
|
|
const styles = useStyles();
|
|
const currentUser = (require(566) /* metro dependency 566: flux */).useStateFromStores([UserStore], function() {
|
|
return UserStore.getCurrentUser();
|
|
});
|
|
const value5 = (UseSoundboardSoundPlayerNative)(sound,
|
|
channel.id);
|
|
const playSoundboardSound = value5.playSoundboardSound;
|
|
const playSoundboardSound2 = playSoundboardSound;
|
|
const isPlayingSound = value5.isPlayingSound;
|
|
const defaultImport2 = UseAnalyticsLocations;
|
|
const SOUNDBOARD_BUTTON = (AnalyticsLocation).SOUNDBOARD_BUTTON;
|
|
const analyticsLocations = defaultImport2(SOUNDBOARD_BUTTON).analyticsLocations;
|
|
const canUseSoundboardSound2 = (SoundboardUtilsModule).canUseSoundboardSound(currentUser,
|
|
sound, channel);
|
|
const value6 = !canUseSoundboardSound2;
|
|
let binding = playSoundboardSound2;
|
|
const value7 = binding.useCallback(_fun118006, [analyticsLocations, channel.guild_id, currentUser,
|
|
playSoundboardSound, sound, value6]);
|
|
const value8 = _fun118007(isPlayingSound);
|
|
const value9 = useAnimation({sharedValues: value8.sharedValues, scaleFactors: {'pressed': 0.95, 'playing': 1.05}});
|
|
const value11 = value8.sharedValues.pressed.get() > 0;
|
|
const value12 = binding.useCallback(_fun118011, [channel.id, sound]);
|
|
binding = env0_11;
|
|
const bindingProps = {style: [styles.button, {width: buttonWidth}, value11 ? styles.buttonPressed : null, value9,
|
|
isPlayingSound ? styles.buttonPlaying : null,
|
|
canUseSoundboardSound2 || isSectionLocked ? null : styles.buttonDisabled, style], accessibilityRole: 'button',
|
|
accessibilityLabel: sound.name, onPressIn: value8.handlers.pressIn, onPressOut: value8.handlers.pressOut,
|
|
onPress: value7, onLongPress: value12};
|
|
r11 = r11 && <SoundButtonEmoji sharedValues={value8.sharedValues} sound={sound} />;
|
|
const Text = (TextModule).Text;
|
|
return (
|
|
<View>
|
|
{((Component) => <Component {...bindingProps}>{r11}<Text lineClamp={1} style={[styles.text,
|
|
isPlayingSound ? styles.textPlaying : null]} variant="text-sm/semibold">{sound.name}</Text></Component>)(binding)}
|
|
{(canUseSoundboardSound2 ? value6 : !isSectionLocked) && ((LockIcon) => <LockIcon style={styles.lock} />)((require(6705) /* metro dependency 6705: LockIcon */).LockIcon)}
|
|
</View>
|
|
);
|
|
function _fun118006() { // fn#118006, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15620:4235, offset: 0x024c8a0a, size: 300 bytes, params: 1, frame: 17
|
|
var value2;
|
|
var defaultImport;
|
|
var open;
|
|
var object;
|
|
const intl = (IndexNativeModule).intl;
|
|
const t = (IndexNativeModule).t;
|
|
var value;
|
|
if (env0_5) {
|
|
value2 = environment.__proto__;
|
|
defaultImport = importDefault(3802) /* metro dependency 3802: PremiumUtils */;
|
|
if (defaultImport.canUseSoundboardEverywhere(currentUser)) {
|
|
if (!sound.available) {
|
|
value = importDefault(3857) /* metro dependency 3857: ToastActionCreators */;
|
|
open = value.open;
|
|
object = {key: 'DISABLED_SOUND_PRESSED', icon: importDefault(10896) /* metro dependency 10896 */};
|
|
object.content = intl.string(t.MDOXJR);
|
|
object.toastDurationMs = 3000;
|
|
Reflect.apply(open, value, [object]);
|
|
}
|
|
} else if (sound.guildId === channel.guild_id) {
|
|
if (!sound.available) {
|
|
value = importDefault(3857) /* metro dependency 3857: ToastActionCreators */;
|
|
open = value.open;
|
|
object = {key: 'DISABLED_SOUND_PRESSED', icon: importDefault(10896) /* metro dependency 10896 */};
|
|
object.content = intl.string(t.MDOXJR);
|
|
object.toastDurationMs = 3000;
|
|
Reflect.apply(open, value, [object]);
|
|
}
|
|
} else {
|
|
(importDefault(7890) /* metro dependency 7890: openPremiumUpsellActionSheet */)((require(7892) /* metro dependency 7892: EntitlementFeatureNames */).EntitlementFeatureNames.SOUNDBOARD_EVERYWHERE);
|
|
}
|
|
} else {
|
|
playSoundboardSound(analyticsLocations);
|
|
}
|
|
}
|
|
|
|
function _fun118007(a0) { // fn#118007, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15620:4545, offset: 0x024c8b36, size: 203 bytes, params: 2, frame: 19
|
|
var environment;
|
|
const env0_0 = a0;
|
|
let value = environment.__proto__;
|
|
const value2 = (ReanimatedRexportModule).useSharedValue(0);
|
|
const value3 = (ReanimatedRexportModule).useSharedValue(0);
|
|
const binding = env1_3;
|
|
value = binding.useCallback(_fun118008, [value2]);
|
|
const value4 = binding.useCallback(_fun118009, [value2]);
|
|
binding.useEffect(_fun118010, [a0, value3, value2]);
|
|
return {handlers: {pressIn: value, pressOut: value4}, sharedValues: {pressed: value2, playing: value3}};
|
|
function _fun118008() { // fn#118008, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15620:4626, offset: 0x01b81401, size: 24 bytes, params: 1, frame: 11
|
|
env0_1.set(1);
|
|
}
|
|
|
|
function _fun118009() { // fn#118009, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15620:4664, offset: 0x01b81419, size: 23 bytes, params: 1, frame: 11
|
|
env0_1.set(0);
|
|
}
|
|
|
|
function _fun118010() { // fn#118010, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15620:4705, offset: 0x024c8c01, size: 33 bytes, params: 1, frame: 12
|
|
const binding = env0_2;
|
|
binding.set(env0_0 ? 1 : 0);
|
|
}
|
|
|
|
}
|
|
|
|
function _fun118011() { // fn#118011, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15620:4944, offset: 0x024c8c22, size: 49 bytes, params: 1, frame: 13
|
|
const value = environment.__proto__;
|
|
(OpenSoundboardSoundPreviewActionSheet)(channel.id, sound);
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun118000, 15423, [31, 27, 1878, 15418, 33, 4017, 4501, 697, 477, 5278, 4577, 6739, 11508, 15424, 566,
|
|
15425, 6771, 6789, 6951, 3802, 7890, 7892, 3857, 10896, 1244, 15427, 4573, 6705,
|
|
2]) /* metro module 15423, dependencies: [31, 27, 1878, 15418, 33, 4017, 4501, 697, 477, 5278, 4577, 6739, 11508, 15424, 566, 15425, 6771, 6789, 6951, 3802, 7890, 7892, 3857, 10896, 1244, 15427, 4573, 6705, 2] */;
|