270 lines
15 KiB
TypeScript
270 lines
15 KiB
TypeScript
/* Metro module 14450; source: components_native/common/UnreadBars.tsx; dependencies: [6, 7, 15, 17, 18, 31, 27, 4502, 661, 33, 4501, 6597, 697, 4000, 4081, 4082, 1305, 1244, 3868, 566, 11206, 2] */
|
|
import ClassCallCheck from '../../by-id/module-00006-ClassCallCheck.js'; /* Metro dependency 6 */
|
|
import CreateClass from '../../by-id/module-00007-CreateClass.js'; /* Metro dependency 7 */
|
|
import PossibleConstructorReturn from '../../by-id/module-00015-PossibleConstructorReturn.js'; /* Metro dependency 15 */
|
|
import Module00017 from '../../by-id/module-00017.js'; /* Metro dependency 17 */
|
|
import Inherits from '../../by-id/module-00018-Inherits.js'; /* Metro dependency 18 */
|
|
import HapticFeedbackTypes from '../../modules/haptics/HapticFeedbackTypes.tsx'; /* Metro dependency 4082 */
|
|
import AccessibilityStore from '../../modules/a11y/AccessibilityStore.tsx'; /* Metro dependency 4502 */
|
|
import TextStyles from '../../modules/rebrand/native/TextStyles.tsx'; /* Metro dependency 6597 */
|
|
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 ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */
|
|
import * as IndexNativeModule from '../../intl/index.native.tsx'; /* Metro dependency 1244 */
|
|
import * as NativeModule from '../../design/void/native.tsx'; /* Metro dependency 1305 */
|
|
import * as NativeModule2 from '../../external/discord_common/js/packages/design/native.tsx'; /* Metro dependency 3868 */
|
|
import * as ColorUtilsModule from '../../utils/ColorUtils.tsx'; /* Metro dependency 4000 */
|
|
import * as HapticUtilsNativeModule from '../../modules/haptics/HapticUtils.native.tsx'; /* Metro dependency 4081 */
|
|
import * as CreateStylesModule from '../../design/components/Styles/native/createStyles.tsx'; /* Metro dependency 4501 */
|
|
import * as TransitionGroupModule from '../../external/discord_common/js/packages/transition-group/TransitionGroup.tsx'; /* Metro dependency 11206 */
|
|
|
|
function _fun109356(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#109356, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14647:6, offset: 0x02348365, size: 636 bytes, params: 8, frame: 28
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
let value = ReactModule;
|
|
const Fonts = (ConstantsModule).Fonts;
|
|
const createLegacyClassComponentStyles = CreateStylesModule.createLegacyClassComponentStyles;
|
|
object = {};
|
|
const object2 = {};
|
|
const DISPLAY_SEMIBOLD = Fonts.DISPLAY_SEMIBOLD;
|
|
const WHITE = (importDefault(697) /* metro dependency 697: native */).unsafe_rawColors.WHITE;
|
|
copyDataProperties(object2, TextStyles(DISPLAY_SEMIBOLD, WHITE, 12, {uppercase: true}), 12);
|
|
object.unreadText = object2;
|
|
const object4 = {'margin': 8, 'height': 24, 'justifyContent': 'center', 'alignItems': 'center'};
|
|
object4.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.md;
|
|
let hexWithOpacity = ColorUtilsModule.hexWithOpacity;
|
|
const PRIMARY_400 = (importDefault(697) /* metro dependency 697: native */).unsafe_rawColors.PRIMARY_400;
|
|
object4.backgroundColor = Reflect.apply(hexWithOpacity, ColorUtilsModule, [PRIMARY_400, 0.9]);
|
|
object.unread = object4;
|
|
hexWithOpacity = ColorUtilsModule.hexWithOpacity;
|
|
const RED_400 = (importDefault(697) /* metro dependency 697: native */).unsafe_rawColors.RED_400;
|
|
object.mention = {backgroundColor: Reflect.apply(hexWithOpacity, ColorUtilsModule, [RED_400, 0.9])};
|
|
const env0_15 = Reflect.apply(createLegacyClassComponentStyles, CreateStylesModule, [object]);
|
|
const PureComponent = value.PureComponent;
|
|
value = _fun109360(PureComponent);
|
|
value.defaultProps = {bottom: false};
|
|
const ThemeContext = (NativeModule2).ThemeContext;
|
|
value.contextType = ThemeContext;
|
|
(FileImportTrackerModule).fileFinishedImporting('components_native/common/UnreadBars.tsx');
|
|
exports.default = UnreadBars;
|
|
function _isNativeReflectConstruct_109357() { // fn#109357, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14647:272, offset: 0x023485e1, size: 98 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_109357_isNativeReflectConstruct = function() {
|
|
return !!result;
|
|
})();
|
|
}
|
|
|
|
function _fun109360(a0) { // fn#109360, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14647:886, offset: 0x02348643, size: 199 bytes, params: 2, frame: 16
|
|
const UnreadBar2 = UnreadBar;
|
|
Inherits(UnreadBar2, a0);
|
|
return CreateClass(UnreadBar2, [{key: 'componentWillEnter', value: function(a0) {
|
|
this.show(a0);
|
|
}}, {key: 'componentWillLeave', value: function(a0) {
|
|
this.hide(a0);
|
|
}}, {key: 'show', value: value_109367}, {key: 'hide', value: value_109368}, {key: 'getAnimatedStyle',
|
|
value: value_109369}, {key: 'render', value: value_109370}]);
|
|
function UnreadBar(a0) { // fn#109361, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14647:898, offset: 0x0234870a, size: 224 bytes, params: 2, frame: 22
|
|
var r0;
|
|
var Reflect;
|
|
let value = copyRestArgs(0, undefined);
|
|
let binding = env1_3;
|
|
binding(this, UnreadBar);
|
|
const items2 = [];
|
|
arraySpread(items2, value, 0, items2);
|
|
value = env1_6(UnreadBar);
|
|
binding = env1_5;
|
|
if (_isNativeReflectConstruct_109357()) {
|
|
Reflect = global.Reflect;
|
|
value = Reflect.construct(value, items2, env1_6(this).constructor);
|
|
r0 = value;
|
|
} else {
|
|
value = value.apply(this, items2);
|
|
r0 = value;
|
|
}
|
|
value = binding(this, r0);
|
|
value.state = {active: false};
|
|
const Value = Animated.Value;
|
|
const value4 = Object.create(Value.prototype, {constructor: {value: Value}});
|
|
const value5 = new Value(0);
|
|
value.animation = value5 instanceof Object ? value5 : value4;
|
|
value.handlePress = handlePress_109362;
|
|
value.handlePressIn = handlePressIn;
|
|
value.handlePressOut = handlePressOut;
|
|
return value;
|
|
function UnreadBarHandlePress() { // fn#109362, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14647:1172, owner: UnreadBar.handlePress, offset: 0x023487ea, size: 97 bytes, params: 1, frame: 17
|
|
const binding = env0_0;
|
|
const {item, onPress} = binding.props;
|
|
const triggerHapticFeedback = HapticUtilsNativeModule.triggerHapticFeedback;
|
|
const IMPACT_LIGHT = (HapticFeedbackTypes).IMPACT_LIGHT;
|
|
Reflect.apply(triggerHapticFeedback, HapticUtilsNativeModule, [IMPACT_LIGHT]);
|
|
binding.hide();
|
|
onPress(item);
|
|
}
|
|
|
|
function handlePressIn() { // fn#109363, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14647:1297, owner: UnreadBar.handlePressIn, offset: 0x0234884b, size: 31 bytes, params: 1, frame: 12
|
|
env0_0.setState({active: true});
|
|
}
|
|
|
|
function handlePressOut() { // fn#109364, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14647:1344, owner: UnreadBar.handlePressOut, offset: 0x02194751, size: 31 bytes, params: 1, frame: 12
|
|
env0_0.setState({active: false});
|
|
}
|
|
|
|
}
|
|
|
|
function value_109367(a0) { // fn#109367, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14647:1547, offset: 0x02348894, size: 59 bytes, params: 2, frame: 13
|
|
const value = environment.__proto__;
|
|
Animated.spring(this.animation, {'toValue': 1, 'friction': 15, 'tension': 250, 'useNativeDriver': true}).start(a0);
|
|
}
|
|
|
|
function value_109368(a0) { // fn#109368, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14647:1668, offset: 0x023488cf, size: 59 bytes, params: 2, frame: 13
|
|
const value = environment.__proto__;
|
|
Animated.spring(this.animation, {'toValue': 0, 'friction': 15, 'tension': 250, 'useNativeDriver': true}).start(a0);
|
|
}
|
|
|
|
function value_109370() { // fn#109370, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14647:2240, offset: 0x02348a40, size: 447 bytes, params: 1, frame: 28
|
|
const value = environment.__proto__;
|
|
const binding = env1_15;
|
|
const context = this.context;
|
|
const value2 = undefined;
|
|
const value3 = binding(context);
|
|
const {compact, item} = this.props;
|
|
const mention2 = item.mention;
|
|
const section = item.section;
|
|
const handlePress = this.handlePress;
|
|
const handlePressIn = this.handlePressIn;
|
|
const handlePressOut = this.handlePressOut;
|
|
const View2 = Animated.View;
|
|
const view2Props = {style: this.getAnimatedStyle(),
|
|
nativeID: 'unread-bar-animated-view-' + mention2 + '-' + section};
|
|
const items2 = [value3.unread];
|
|
items2[1] = mention2 ? value3.mention : value2;
|
|
const LegacyText = (NativeModule).LegacyText;
|
|
const unreadText = value3.unreadText;
|
|
const intl = (IndexNativeModule).intl;
|
|
const string = intl.string;
|
|
const t = (IndexNativeModule).t;
|
|
return (
|
|
<TouchableWithoutFeedback
|
|
accessibilityRole="button"
|
|
onPress={handlePress}
|
|
onPressIn={handlePressIn}
|
|
onPressOut={handlePressOut}
|
|
testID={'unread-bar-touchable-' + mention2 + '-' + section}
|
|
>
|
|
<View2 {...view2Props}>
|
|
<View style={items2} nativeID={'unread-bar-view-' + mention2 + '-' + section}>
|
|
<LegacyText style={unreadText} maxFontSizeMultiplier={1.5}>
|
|
{compact ? Reflect.apply(string, intl, [t.y2b7CA]) : mention2 ? Reflect.apply(string, intl,
|
|
[t['8zH0LJ']]) : Reflect.apply(string, intl, [t.FCRiT3])}
|
|
</LegacyText>
|
|
</View>
|
|
</View2>
|
|
</TouchableWithoutFeedback>
|
|
);
|
|
}
|
|
|
|
}
|
|
|
|
function UnreadBars({scrollToLocation, beforeItem, afterItem, compact, contentInset = {'top': 0, 'left': 0, 'right': 0, 'bottom': 0}}) { // fn#109371, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14647:3068, offset: 0x02348bff, size: 306 bytes, params: 2, frame: 27
|
|
compact = !(compact === undefined) && compact;
|
|
const closure = function({section, row}) {
|
|
scrollToLocation({section: section, item: row, animated: true});
|
|
};
|
|
const useReducedMotion = (require(566) /* metro dependency 566: flux */).useStateFromStores([AccessibilityStore],
|
|
function() {
|
|
return AccessibilityStore.useReducedMotion;
|
|
});
|
|
const TransitionGroup = (TransitionGroupModule).TransitionGroup;
|
|
const Fragment = env0_8.Fragment;
|
|
return (
|
|
<TransitionGroup component={Fragment}>
|
|
{
|
|
beforeItem != null
|
|
? ((Component) => <Component compact={compact} item={beforeItem} onPress={closure} contentInset={contentInset} useReducedMotion={useReducedMotion} key="BEFORE" />)(env0_16)
|
|
: null
|
|
}
|
|
{
|
|
afterItem != null
|
|
? ((Component) => <Component compact={compact} item={afterItem} onPress={closure} contentInset={contentInset} bottom useReducedMotion={useReducedMotion} key="AFTER" />)(env0_16)
|
|
: null
|
|
}
|
|
</TransitionGroup>
|
|
);
|
|
}
|
|
|
|
}
|
|
|
|
function value_109369() { // fn#109369, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14647:1801, offset: 0x0234890a, size: 310 bytes, params: 1, frame: 21
|
|
var r11;
|
|
var r0;
|
|
var top;
|
|
var value4;
|
|
var object;
|
|
var animation;
|
|
var object2;
|
|
const {bottom, contentInset, useReducedMotion} = this.props;
|
|
const active = this.state.active;
|
|
const object4 = {position: 'absolute'};
|
|
const left = contentInset.left;
|
|
const value = 0;
|
|
let r1 = left ?? value;
|
|
object4.left = r1;
|
|
object4.right = contentInset.right ?? value;
|
|
const r4 = bottom ? 'bottom' : 'top';
|
|
if (bottom) {
|
|
r1 = contentInset.bottom ?? value;
|
|
} else {
|
|
top = contentInset.top;
|
|
value4 = top != null;
|
|
r1 = value4 ? top : value;
|
|
r11 = value4;
|
|
}
|
|
object4[r4] = r1;
|
|
if (useReducedMotion) {
|
|
object2 = {};
|
|
copyDataProperties(object2, object4, r11);
|
|
object2['opacity'] = this.animation;
|
|
r0 = object2;
|
|
} else {
|
|
object = {};
|
|
copyDataProperties(object, object4, r11);
|
|
animation = this.animation;
|
|
object['opacity'] = animation;
|
|
animation = this.animation;
|
|
object['transform'] = [{translateY: animation.interpolate({inputRange: [0, 1], outputRange: [bottom ? 72 : -72,
|
|
active ? 1 : value]})}];
|
|
r0 = object;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
global.__d(_fun109356, 14450, [6, 7, 15, 17, 18, 31, 27, 4502, 661, 33, 4501, 6597, 697, 4000, 4081, 4082, 1305,
|
|
1244, 3868, 566, 11206,
|
|
2]) /* metro module 14450, dependencies: [6, 7, 15, 17, 18, 31, 27, 4502, 661, 33, 4501, 6597, 697, 4000, 4081, 4082, 1305, 1244, 3868, 566, 11206, 2] */;
|