Files
2026-07-28 01:06:53 +03:00

187 lines
11 KiB
TypeScript

/* Metro module 10749; source: components_native/calls/CallPTTButton.tsx; dependencies: [57, 31, 1379, 4259, 4294, 661, 33, 4501, 697, 4000, 566, 10659, 10665, 10750, 5321, 4017, 1305, 1244, 2] */
import Module00057 from '../../by-id/module-00057.js'; /* Metro dependency 57 */
import ChannelStore from '../../stores/ChannelStore.tsx'; /* Metro dependency 1379 */
import MediaEngineStore from '../../stores/MediaEngineStore.tsx'; /* Metro dependency 4259 */
import RTCConnectionStore from '../../stores/RTCConnectionStore.tsx'; /* Metro dependency 4294 */
import UseCanSpeakInChannel from '../../modules/stage_channels/useCanSpeakInChannel.tsx'; /* Metro dependency 10659 */
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
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 FluxModule from '../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
import * as ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */
import * as ColorUtilsModule from '../../utils/ColorUtils.tsx'; /* Metro dependency 4000 */
import * as CreateStylesModule from '../../design/components/Styles/native/createStyles.tsx'; /* Metro dependency 4501 */
function _fun82650(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#82650, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10935:6, offset: 0x01efd291, size: 568 bytes, params: 8, frame: 28
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = ReactModule;
const createStyles = CreateStylesModule.createStyles;
const object2 = {};
object2.button = {margin: 13};
const object4 = {};
object4.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.xs;
object4.overflow = 'hidden';
let hexWithOpacity = ColorUtilsModule.hexWithOpacity;
const WHITE = (importDefault(697) /* metro dependency 697: native */).unsafe_rawColors.WHITE;
object4.backgroundColor = Reflect.apply(hexWithOpacity, ColorUtilsModule, [WHITE, 0.24]);
object2.container = object4;
object2.buttonBlur = {backgroundColor: 'transparent'};
hexWithOpacity = ColorUtilsModule.hexWithOpacity;
const BLACK = (importDefault(697) /* metro dependency 697: native */).unsafe_rawColors.BLACK;
object2.buttonBlurPressed = {backgroundColor: Reflect.apply(hexWithOpacity, ColorUtilsModule, [BLACK, 0.6])};
object2.textStyle = {fontSize: 16};
const BACKGROUND_BASE_LOW = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_BASE_LOW;
object2.brandButtonContainer = {backgroundColor: BACKGROUND_BASE_LOW};
const env0_11 = Reflect.apply(createStyles, CreateStylesModule, [object2]);
const env0_12 = {code: 'function CallPTTButtonTsx1(){const{runOnJS,setDragging}=this.__closure;runOnJS(setDragging)(false);}'};
const env0_13 = {code: 'function CallPTTButtonTsx2(){const{runOnJS,setDragging,setPressed,setIsSwipeToChatDisabled}=this.__closure;runOnJS(setDragging)(true);runOnJS(setPressed)(false);if(setIsSwipeToChatDisabled!=null){runOnJS(setIsSwipeToChatDisabled)(false);}}'};
value = value.memo(_fun82651);
(FileImportTrackerModule).fileFinishedImporting('components_native/calls/CallPTTButton.tsx');
exports.default = value;
exports.CallPTTButtonLooks = {BRAND: 'brand', BLUR: 'blur'};
function _fun82651({look = env0_10.BRAND, style, sendCallback, stopCallback}) { // fn#82651, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10935:1027, offset: 0x01efd4c9, size: 1019 bytes, params: 2, frame: 34
var r0;
var GestureDetector;
var View;
var object2;
var Button;
var intl;
const env0_3 = undefined;
let env0_4 = undefined;
const styles = useStyles();
const useStateFromStores = FluxModule.useStateFromStores;
let object = [MediaEngineStore];
const mode = Reflect.apply(useStateFromStores, FluxModule, [object, function() {
return MediaEngineStore.getMode();
}]);
const channelId = FluxModule.useStateFromStores([RTCConnectionStore], function() {
return RTCConnectionStore.getChannelId();
});
const value4 = FluxModule.useStateFromStores([ChannelStore], function() {
return ChannelStore.getChannel(channelId);
}, [channelId]);
const value5 = (UseCanSpeakInChannel)(channelId);
const binding = env0_4;
let useState = binding.useState;
const value6 = Reflect.apply(useState, binding, [false]);
const binding2 = env0_3;
const value7 = binding2(value6, 2);
const property = value7[0];
const property2 = value7[1];
env0_4 = property2;
useState = binding.useState;
const value8 = binding2(Reflect.apply(useState, binding, [false]), 2);
const property3 = value8[0];
const property4 = value8[1];
let r7 = value4?.isGuildStageVoice() && !value5;
const value11 = env0_4.useRef(false);
const setIsSwipeToChatDisabled = (require(10665) /* metro dependency 10665: VoiceChatModalContext */).useVoiceChatNavigationContext()?.setIsSwipeToChatDisabled;
env0_4.useEffect(_fun82655, [value11, property, property3, sendCallback, stopCallback]);
const Gesture = (require(5321) /* metro dependency 5321 */).Gesture;
const value13 = Gesture.Pan();
const onStart = value13.onStart;
let closure = G_82656;
closure.__closure = {runOnJS: (require(4017) /* metro dependency 4017: ReanimatedRexport */).runOnJS,
setDragging: property4, setPressed: property2, setIsSwipeToChatDisabled: setIsSwipeToChatDisabled};
closure.__workletHash = 10056118853836;
closure.__initData = env0_13;
const value14 = Reflect.apply(onStart, value13, [closure]);
const onEnd = value14.onEnd;
closure = F_82657;
closure.__closure = {runOnJS: (require(4017) /* metro dependency 4017: ReanimatedRexport */).runOnJS,
setDragging: property4};
closure.__workletHash = 8439106360958;
closure.__initData = env0_12;
if (channelId == null) {
r0 = null;
} else if (InputModes.VOICE_ACTIVITY === mode) {
r0 = null;
} else if (r7) {
r0 = null;
} else {
if (look === env0_10.BRAND) {
r7 = [styles.brandButtonContainer];
look = [styles.button, style];
} else {
look = property || property3 ? styles.buttonBlurPressed : styles.buttonBlur;
r7 = [styles.button, styles.container, style];
}
GestureDetector = (require(5321) /* metro dependency 5321 */).GestureDetector;
object = {gesture: Reflect.apply(onEnd, value14, [closure])};
View = (importDefault(4017) /* metro dependency 4017: ReanimatedRexport */).View;
object2 = {style: r7};
Button = (require(1305) /* metro dependency 1305: native */).Button;
var buttonProps = {style: look, textStyle: styles.textStyle};
intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
buttonProps.text = intl.string((require(1244) /* metro dependency 1244: indexNative */).t.Q8gkVL);
buttonProps.onTouchStart = onTouchStart;
buttonProps.onTouchEnd = onTouchEnd;
buttonProps.darkenOnPress = true;
r0 = (
<GestureDetector {...object}>
<View {...object2}>
<Button {...buttonProps} />
</View>
</GestureDetector>
);
}
return r0;
function _fun82655() { // fn#82655, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10935:1524, offset: 0x01efd904, size: 118 bytes, params: 1, frame: 13
var value2;
const r1 = env0_3 || env0_5;
if (r1 !== env0_7.current) {
value2 = environment.__proto__;
(require(10750) /* metro dependency 10750: MediaEngineActionCreators */).setPushToTalkState(r1);
if (r1) {
if (sendCallback != null) {
sendCallback();
}
} else if (stopCallback != null) {
stopCallback();
}
}
env0_7.current = r1;
}
function G_82656() { // fn#82656, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10935:1691, offset: 0x01efd97a, size: 127 bytes, params: 1, frame: 17
let value = environment.__proto__;
(require(4017) /* metro dependency 4017: ReanimatedRexport */).runOnJS(env0_6)(true);
(require(4017) /* metro dependency 4017: ReanimatedRexport */).runOnJS(env0_4)(false);
if (setIsSwipeToChatDisabled != null) {
value = require(4017) /* metro dependency 4017: ReanimatedRexport */;
value.runOnJS(setIsSwipeToChatDisabled)(false);
}
}
function F_82657() { // fn#82657, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10935:1936, offset: 0x01efd9f9, size: 51 bytes, params: 1, frame: 12
let value = environment.__proto__;
value = require(4017) /* metro dependency 4017: ReanimatedRexport */;
value = value.runOnJS(env0_6);
value(false);
}
function onTouchStart() { // fn#82658, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10935:2432, offset: 0x01efda2c, size: 48 bytes, params: 1, frame: 13
env0_4(true);
env0_6(false);
if (setIsSwipeToChatDisabled != null) {
setIsSwipeToChatDisabled(true);
}
}
function onTouchEnd() { // fn#82659, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10935:2482, offset: 0x01efda5c, size: 37 bytes, params: 1, frame: 13
env0_4(false);
if (setIsSwipeToChatDisabled != null) {
setIsSwipeToChatDisabled(false);
}
}
}
}
global.__d(_fun82650, 10749, [57, 31, 1379, 4259, 4294, 661, 33, 4501, 697, 4000, 566, 10659, 10665, 10750, 5321,
4017, 1305, 1244,
2]) /* metro module 10749, dependencies: [57, 31, 1379, 4259, 4294, 661, 33, 4501, 697, 4000, 566, 10659, 10665, 10750, 5321, 4017, 1305, 1244, 2] */;