368 lines
18 KiB
TypeScript
368 lines
18 KiB
TypeScript
/* Metro module 4596; source: components_native/common/Alert.tsx; dependencies: [6, 7, 15, 17, 18, 31, 27, 33, 4501, 697, 1305, 4597, 4041, 4570, 4573, 1244, 4578, 5278, 7704, 3868, 1478, 8750, 2] */
|
|
function _fun38946(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#38946, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4774:6, offset: 0x010d1d85, size: 700 bytes, params: 8, frame: 28
|
|
var object3;
|
|
const env0_0 = require;
|
|
const closure = getAlertButtonVariant;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_4 = importDefault(6) /* metro dependency 6 */;
|
|
const env0_5 = importDefault(7) /* metro dependency 7 */;
|
|
const env0_6 = importDefault(15) /* metro dependency 15 */;
|
|
const env0_7 = importDefault(17) /* metro dependency 17 */;
|
|
const env0_8 = importDefault(18) /* metro dependency 18 */;
|
|
let value = importAll(31) /* metro dependency 31 */;
|
|
const value2 = require(27) /* metro dependency 27 */;
|
|
const env0_10 = value2.View;
|
|
const StyleSheet = value2.StyleSheet;
|
|
const env0_11 = value2.ScrollView;
|
|
const value3 = require(33) /* metro dependency 33 */;
|
|
const env0_12 = value3.jsx;
|
|
const env0_13 = value3.jsxs;
|
|
const env0_14 = value3.Fragment;
|
|
const createStylesModule = require(4501) /* metro dependency 4501: createStyles */;
|
|
const createLegacyClassComponentStyles = createStylesModule.createLegacyClassComponentStyles;
|
|
object3 = {};
|
|
const object5 = {};
|
|
object5.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.sm;
|
|
object5.padding = 16;
|
|
const BACKGROUND_BASE_LOW = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_BASE_LOW;
|
|
object5.backgroundColor = BACKGROUND_BASE_LOW;
|
|
object3.alert = object5;
|
|
const MOBILE_TEXT_HEADING_PRIMARY = (importDefault(697) /* metro dependency 697: native */).colors.MOBILE_TEXT_HEADING_PRIMARY;
|
|
object3.titleText = {marginBottom: 16, color: MOBILE_TEXT_HEADING_PRIMARY};
|
|
const object6 = {};
|
|
object6.height = StyleSheet.hairlineWidth;
|
|
const BORDER_SUBTLE = (importDefault(697) /* metro dependency 697: native */).colors.BORDER_SUBTLE;
|
|
object6.backgroundColor = BORDER_SUBTLE;
|
|
object3.divider = object6;
|
|
const TEXT_STRONG = (importDefault(697) /* metro dependency 697: native */).colors.TEXT_STRONG;
|
|
object3.body = {marginTop: 16, color: TEXT_STRONG};
|
|
object3.buttons = {marginTop: 24};
|
|
object3.cancelButton = {marginTop: 8};
|
|
object3.secondaryConfirm = {'marginTop': 16, 'alignSelf': 'center'};
|
|
const object7 = {};
|
|
object7.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.sm;
|
|
object3.gradient = object7;
|
|
const env0_15 = Reflect.apply(createLegacyClassComponentStyles, createStylesModule, [object3]);
|
|
const PureComponent = value.PureComponent;
|
|
const value5 = _fun38951(PureComponent);
|
|
const ThemeContext = (require(3868) /* metro dependency 3868: native */).ThemeContext;
|
|
value5.contextType = ThemeContext;
|
|
const ButtonColors = (require(1305) /* metro dependency 1305: native */).ButtonColors;
|
|
const BRAND = ButtonColors.BRAND;
|
|
value5.defaultProps = {confirmColor: BRAND, autoCloseOnConfirm: true};
|
|
value = value.memo(_fun38967);
|
|
value.Colors = ButtonColors;
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('components_native/common/Alert.tsx');
|
|
exports.default = value;
|
|
exports.getAlertButtonVariant = closure;
|
|
}
|
|
|
|
function _isNativeReflectConstruct_38947() { // fn#38947, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4774:247, offset: 0x010d2041, size: 94 bytes, params: 1, frame: 18
|
|
var Boolean;
|
|
var prototype;
|
|
var valueOf;
|
|
var call;
|
|
var Reflect;
|
|
var construct;
|
|
var closure;
|
|
var value;
|
|
var error;
|
|
try {
|
|
Boolean = global.Boolean;
|
|
prototype = Boolean.prototype;
|
|
valueOf = prototype.valueOf;
|
|
call = valueOf.call;
|
|
Reflect = global.Reflect;
|
|
construct = Reflect.construct;
|
|
Boolean = global.Boolean;
|
|
closure = function() {
|
|
};
|
|
value = Reflect.apply(construct, Reflect, [Boolean, [], closure]);
|
|
value = Reflect.apply(call, valueOf, [value]);
|
|
var result = !value;
|
|
} catch (error) {
|
|
}
|
|
return (_isNativeReflectConstruct_38947_isNativeReflectConstruct = function() {
|
|
return !!result;
|
|
})();
|
|
}
|
|
|
|
function getAlertButtonVariant(a0) { // fn#38950, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4774:940, offset: 0x010d209f, size: 249 bytes, params: 2, frame: 14
|
|
const ButtonColors = (require(1305) /* metro dependency 1305: native */).ButtonColors;
|
|
const GREEN = ButtonColors.GREEN;
|
|
if (GREEN === a0) {
|
|
return 'active';
|
|
}
|
|
const RED = ButtonColors.RED;
|
|
if (RED === a0) {
|
|
return 'destructive';
|
|
}
|
|
const GREY = ButtonColors.GREY;
|
|
if (GREY === a0) {
|
|
return 'secondary';
|
|
}
|
|
const LIGHTGREY = ButtonColors.LIGHTGREY;
|
|
if (LIGHTGREY === a0) {
|
|
return 'secondary';
|
|
}
|
|
const TRANSPARENT = ButtonColors.TRANSPARENT;
|
|
if (TRANSPARENT === a0) {
|
|
return 'secondary';
|
|
}
|
|
const WHITE = ButtonColors.WHITE;
|
|
if (WHITE === a0) {
|
|
return 'primary-overlay';
|
|
}
|
|
return 'primary';
|
|
}
|
|
|
|
function _fun38951(a0) { // fn#38951, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4774:1297, offset: 0x010d2198, size: 233 bytes, params: 2, frame: 16
|
|
const closure = Alert_38952;
|
|
env0_8(closure, a0);
|
|
return env0_5(closure, [{key: 'componentDidMount', value: function() {
|
|
var env0_0 = this;
|
|
if (this.titleRef.current != null) {
|
|
global.setImmediate(_fun38958);
|
|
}
|
|
}}, {key: 'componentWillUnmount', value: function() {
|
|
this.timeout.stop();
|
|
this.focusTimeout.stop();
|
|
}}, {key: 'componentDidUpdate', value: function() {
|
|
var confirming = this.props.confirming;
|
|
if (confirming != null) {
|
|
this.timeout.stop();
|
|
this.setState({confirming: confirming});
|
|
}
|
|
}}, {key: 'renderHeader', value: value_38962}, {key: 'renderBody', value: value_38963}, {key: 'renderButtons',
|
|
value: value_38964}, {key: 'renderFooter', value: value_38965}, {key: 'render', value: value_38966}]);
|
|
}
|
|
|
|
function _fun38967(a0) { // fn#38967, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4774:4837, offset: 0x010d2b18, size: 182 bytes, params: 2, frame: 19
|
|
const value2 = (importDefault(1478) /* metro dependency 1478: useWindowDimensionsNative */)();
|
|
const value3 = (require(8750) /* metro dependency 8750: useIsScreenLandscapeNative */).useIsScreenLandscape();
|
|
const Math = global.Math;
|
|
const min = Math.min;
|
|
const Math2 = global.Math;
|
|
return ((Component) => <Component width={Reflect.apply(min, Math, [0.9 * Math2.min(value2.width, value2.height),
|
|
400])} contentHeight={0.7 * value2.height} isLandscape={value3} {...a0} />)(env0_16);
|
|
}
|
|
|
|
function Alert_38952(a0) { // fn#38952, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4774:1309, offset: 0x010d2281, size: 325 bytes, params: 2, frame: 21
|
|
var r0;
|
|
var Reflect;
|
|
let value = copyRestArgs(0, undefined);
|
|
let binding = env1_4;
|
|
binding(this, Alert_38952);
|
|
const items = [];
|
|
arraySpread(items, value, 0, items);
|
|
value = env1_7(Alert_38952);
|
|
binding = env1_6;
|
|
if (_isNativeReflectConstruct_38947()) {
|
|
Reflect = global.Reflect;
|
|
value = Reflect.construct(value, items, env1_7(this).constructor);
|
|
r0 = value;
|
|
} else {
|
|
value = value.apply(this, items);
|
|
r0 = value;
|
|
}
|
|
value = binding(this, r0);
|
|
value.titleRef = env1_9.createRef();
|
|
value.state = {confirming: false};
|
|
value.renderContent = (importAll(4597) /* metro dependency 4597: CustomMarkupNative */).getParser();
|
|
const Timeout = (require(4041) /* metro dependency 4041: Timers */).Timeout;
|
|
const value4 = Object.create(Timeout.prototype, {constructor: {value: Timeout}});
|
|
let timeout = new Timeout();
|
|
value.timeout = timeout instanceof Object ? timeout : value4;
|
|
const value6 = Object.create(Timeout.prototype, {constructor: {value: Timeout}});
|
|
timeout = new Timeout();
|
|
value.focusTimeout = timeout instanceof Object ? timeout : value6;
|
|
value.handleConfirm = handleConfirm_38953;
|
|
value.handleCancel = handleCancel_38955;
|
|
value.handleSecondaryConfirm = handleSecondaryConfirm;
|
|
return value;
|
|
}
|
|
|
|
function value_38957() { // fn#38957, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4774:2143, offset: 0x010d24ca, size: 50 bytes, params: 1, frame: 11
|
|
if (this.titleRef.current != null) {
|
|
global.setImmediate(_fun38958);
|
|
}
|
|
}
|
|
|
|
function value_38962() { // fn#38962, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4774:2548, offset: 0x010d25bf, size: 219 bytes, params: 1, frame: 24
|
|
const value = environment.__proto__;
|
|
const value2 = env1_15(this.context);
|
|
const title = this.props.title;
|
|
const value3 = null;
|
|
return value3 == title || title === '' ? value3 : <View>{((Text) => <Text ref={this.titleRef} accessible accessibilityRole="header" variant="heading-md/extrabold" color="text-default" style={value2.titleText}>{typeof title !== 'string' ? title : this.renderContent(title)}</Text>)((require(4573) /* metro dependency 4573: Text */).Text)}<View style={value2.divider} /></View>;
|
|
}
|
|
|
|
function value_38963() { // fn#38963, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4774:2895, offset: 0x010d269a, size: 206 bytes, params: 1, frame: 25
|
|
const value = environment.__proto__;
|
|
const value2 = env1_15(this.context);
|
|
const {body, children} = this.props;
|
|
const jsxRuntimeEnv1_14Binding = jsxRuntimeEnv1_14;
|
|
const value3 = null;
|
|
return (
|
|
<>
|
|
{value3 != body ? <ScrollView style={{maxHeight: this.props.contentHeight}}>{((Text) => <Text variant="text-md/normal" style={value2.body}>{typeof body !== 'string' ? body : this.renderContent(body)}</Text>)((require(4573) /* metro dependency 4573: Text */).Text)}</ScrollView> : value3}
|
|
{children}
|
|
</>
|
|
);
|
|
}
|
|
|
|
function value_38964() { // fn#38964, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4774:3200, offset: 0x010d2768, size: 607 bytes, params: 1, frame: 31
|
|
var r16;
|
|
var r7;
|
|
var r6;
|
|
var r8;
|
|
var r14;
|
|
var r15;
|
|
var r0;
|
|
var intl;
|
|
const Button = (require(4578) /* metro dependency 4578: ButtonNative */).Button;
|
|
let value = environment.__proto__;
|
|
const binding = env1_15;
|
|
const context = this.context;
|
|
const value2 = undefined;
|
|
const value3 = binding(context);
|
|
const props = this.props;
|
|
const cancelText = props.cancelText;
|
|
const confirmText = props.confirmText;
|
|
if (value2 !== confirmText) {
|
|
r16 = confirmText;
|
|
} else {
|
|
intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
|
|
r16 = intl.string((require(1244) /* metro dependency 1244: indexNative */).t.BddRzS);
|
|
}
|
|
const confirmColor = props.confirmColor;
|
|
const secondaryConfirmText = props.secondaryConfirmText;
|
|
const noDefaultButtons = props.noDefaultButtons;
|
|
const renderConfirmIcon = props.renderConfirmIcon;
|
|
const renderConfirmRightIcon = props.renderConfirmRightIcon;
|
|
const renderConfirmButton = props.renderConfirmButton;
|
|
const isConfirmButtonDisabled = props.isConfirmButtonDisabled;
|
|
const confirming = this.state.confirming;
|
|
const value5 = null;
|
|
if (noDefaultButtons) {
|
|
r0 = value5;
|
|
} else {
|
|
r7 = value5 != cancelText ? <View style={value3.cancelButton}><Button variant="secondary" onPress={this.handleCancel} text={cancelText} /></View> : value2;
|
|
if (value5 != secondaryConfirmText) {
|
|
const PressableOpacity = (require(5278) /* metro dependency 5278: Pressables */).PressableOpacity;
|
|
r6 = <PressableOpacity accessibilityRole="button" style={value3.secondaryConfirm} onPress={this.handleSecondaryConfirm}>{((Text) => <Text variant="text-sm/semibold" color="text-link">{secondaryConfirmText}</Text>)((require(4573) /* metro dependency 4573: Text */).Text)}</PressableOpacity>;
|
|
} else {
|
|
r6 = value2;
|
|
}
|
|
var viewBindingProps = {style: value3.buttons};
|
|
r8 = value5 == renderConfirmButton ? value2 : renderConfirmButton();
|
|
if (value5 == r8) {
|
|
var buttonProps = {variant: getAlertButtonVariant(confirmColor), onPress: this.handleConfirm, text: r16,
|
|
loading: confirming};
|
|
value = value5 != isConfirmButtonDisabled;
|
|
r14 = value && isConfirmButtonDisabled;
|
|
buttonProps.disabled = r14;
|
|
r15 = value5 == renderConfirmIcon ? value2 : renderConfirmIcon();
|
|
r15 = value5 == r15 ? value5 == renderConfirmRightIcon ? value2 : renderConfirmRightIcon() : r15;
|
|
r14 = value5 != r15 ? r15 : value2;
|
|
buttonProps.icon = r14;
|
|
value = 'start';
|
|
buttonProps.iconPosition = value5 != renderConfirmIcon ? value : value5 != renderConfirmRightIcon ? 'end' : value2;
|
|
value = <Button {...buttonProps} />;
|
|
r8 = value;
|
|
}
|
|
value = <View {...viewBindingProps}>{r8}{r7}{r6}</View>;
|
|
r0 = value;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function value_38965() { // fn#38965, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4774:4225, offset: 0x010d29c7, size: 50 bytes, params: 1, frame: 14
|
|
var r0;
|
|
const footer = this.props.footer;
|
|
let value = null;
|
|
if (value == footer) {
|
|
r0 = value;
|
|
} else {
|
|
value = environment.__proto__;
|
|
value = <View>{footer}</View>;
|
|
r0 = value;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function value_38966() { // fn#38966, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4774:4320, offset: 0x010d29f9, size: 287 bytes, params: 1, frame: 24
|
|
const value = environment.__proto__;
|
|
const value2 = env1_15(this.context);
|
|
const {style, width, isLandscape, onClose} = this.props;
|
|
const jsxRuntimeEnv1_14Binding = jsxRuntimeEnv1_14;
|
|
const value3 = ((Component) => <Component absolute componentStyles={value2.gradient} />)(importDefault(7704) /* metro dependency 7704: ThemedGradient */);
|
|
const items2 = [value2.alert, style];
|
|
items2[2] = {width: width};
|
|
const items3 = [this.renderHeader()];
|
|
items3[1] = this.renderBody();
|
|
items3[2] = this.renderButtons();
|
|
items3[3] = this.renderFooter();
|
|
const fragment = <>{value3}<View onAccessibilityEscape={onClose} style={items2}>{items3}</View></>;
|
|
return isLandscape ? <ScrollView style={{maxHeight: width}}>{fragment}</ScrollView> : fragment;
|
|
}
|
|
|
|
function Alert_38952HandleConfirm() { // fn#38953, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4774:1681, owner: Alert_38952.handleConfirm, offset: 0x010d23c6, size: 129 bytes, params: 1, frame: 16
|
|
var binding;
|
|
var props;
|
|
var onClose;
|
|
var onConfirm;
|
|
var autoCloseOnConfirm;
|
|
if (!env0_0.state.confirming) {
|
|
binding = env0_0;
|
|
props = binding.props;
|
|
onClose = props.onClose;
|
|
onConfirm = props.onConfirm;
|
|
autoCloseOnConfirm = props.autoCloseOnConfirm;
|
|
binding.setState({confirming: true});
|
|
binding.timeout.start(500, _fun38954);
|
|
if (autoCloseOnConfirm) {
|
|
if (onClose != null) {
|
|
onClose();
|
|
}
|
|
}
|
|
if (onConfirm != null) {
|
|
onConfirm();
|
|
}
|
|
}
|
|
}
|
|
|
|
function Alert_38952HandleCancel() { // fn#38955, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4774:1906, owner: Alert_38952.handleCancel, offset: 0x010d2466, size: 50 bytes, params: 1, frame: 11
|
|
const {onClose, onCancel} = env0_0.props;
|
|
if (onCancel != null) {
|
|
onCancel();
|
|
}
|
|
if (onClose != null) {
|
|
onClose();
|
|
}
|
|
}
|
|
|
|
function handleSecondaryConfirm() { // fn#38956, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4774:2002, owner: Alert_38952.handleSecondaryConfirm, offset: 0x010d2498, size: 50 bytes, params: 1, frame: 11
|
|
const {onClose, onConfirmSecondary} = env0_0.props;
|
|
if (onClose != null) {
|
|
onClose();
|
|
}
|
|
if (onConfirmSecondary != null) {
|
|
onConfirmSecondary();
|
|
}
|
|
}
|
|
|
|
function _fun38958() { // fn#38958, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4774:2197, offset: 0x010d24fc, size: 41 bytes, params: 1, frame: 13
|
|
env0_0.focusTimeout.start(300, _fun38959);
|
|
}
|
|
|
|
function _fun38954() { // fn#38954, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4774:1822, offset: 0x010d2447, size: 31 bytes, params: 1, frame: 12
|
|
env1_0.setState({confirming: false});
|
|
}
|
|
|
|
function _fun38959() { // fn#38959, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4774:2231, offset: 0x010d2525, size: 57 bytes, params: 1, frame: 13
|
|
const value = environment.__proto__.__proto__.__proto__;
|
|
(require(4570) /* metro dependency 4570: setAccessibilityFocusAndroid */).setAccessibilityFocus({ref: env1_0.titleRef});
|
|
}
|
|
|