239 lines
13 KiB
TypeScript
239 lines
13 KiB
TypeScript
/* Metro module 10886; source: components_native/StreamPreview.tsx; dependencies: [6, 7, 15, 17, 18, 31, 27, 1310, 33, 4501, 697, 4002, 10887, 10888, 3868, 1244, 5278, 10271, 566, 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 Native from '../external/discord_common/js/packages/tokens/native.tsx'; /* Metro dependency 697 */
|
|
import ThemeStore from '../modules/user_settings/ThemeStore.tsx'; /* Metro dependency 1310 */
|
|
import UseFetchStreamPreview from '../modules/go_live/useFetchStreamPreview.tsx'; /* Metro dependency 10271 */
|
|
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 IndexNativeModule from '../intl/index.native.tsx'; /* Metro dependency 1244 */
|
|
import * as NativeModule from '../external/discord_common/js/packages/design/native.tsx'; /* Metro dependency 3868 */
|
|
import * as CreateStylesModule from '../design/components/Styles/native/createStyles.tsx'; /* Metro dependency 4501 */
|
|
import * as PressablesModule from '../design/void/Pressables/native/Pressables.tsx'; /* Metro dependency 5278 */
|
|
|
|
function _fun83389(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#83389, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11072:6, offset: 0x01f1889c, size: 686 bytes, params: 8, frame: 26
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
let value = ReactModule;
|
|
const StyleSheet = ReactNativeModule.StyleSheet;
|
|
let createLegacyClassComponentStyles = CreateStylesModule.createLegacyClassComponentStyles;
|
|
object = {};
|
|
const object2 = {};
|
|
copyDataProperties(object2, StyleSheet.absoluteFillObject, undefined);
|
|
object2['alignItems'] = 'center';
|
|
object2['justifyContent'] = 'center';
|
|
object2['paddingLeft'] = 20;
|
|
object2['paddingRight'] = 20;
|
|
object.wrapper = object2;
|
|
const TEXT_MUTED = (Native).colors.TEXT_MUTED;
|
|
object.text = {'textAlign': 'center', 'fontSize': 14, 'lineHeight': 18, 'marginTop': 16, color: TEXT_MUTED};
|
|
object.fallbackImage = {width: '100%'};
|
|
const env0_13 = Reflect.apply(createLegacyClassComponentStyles, CreateStylesModule, [object]);
|
|
let PureComponent = value.PureComponent;
|
|
const value5 = _fun83394(PureComponent);
|
|
const ThemeContext = (NativeModule).ThemeContext;
|
|
value5.contextType = ThemeContext;
|
|
createLegacyClassComponentStyles = CreateStylesModule.createLegacyClassComponentStyles;
|
|
object = {};
|
|
const BACKGROUND_BASE_LOWEST = (Native).colors.BACKGROUND_BASE_LOWEST;
|
|
object.touchable = {'flex': 1, 'width': '100%', 'height': null, 'aspectRatio': 1.7777777777777777,
|
|
height: undefined, backgroundColor: BACKGROUND_BASE_LOWEST};
|
|
const BLACK = (Native).unsafe_rawColors.BLACK;
|
|
object.imageContainer = {flex: 1, backgroundColor: BLACK};
|
|
object.image = {flex: 1};
|
|
const env0_15 = Reflect.apply(createLegacyClassComponentStyles, CreateStylesModule, [object]);
|
|
PureComponent = value.PureComponent;
|
|
value = _fun83397(PureComponent);
|
|
value.contextType = ThemeContext;
|
|
value.defaultProps = {renderFallback: renderFallback};
|
|
(FileImportTrackerModule).fileFinishedImporting('components_native/StreamPreview.tsx');
|
|
exports.default = ConnectedStreamPreview;
|
|
function _callSuper_83390(a0, a1, a2) { // fn#83390, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11072:239, offset: 0x01f18b4a, size: 100 bytes, params: 4, frame: 20
|
|
var r0;
|
|
var Reflect;
|
|
let value = a2;
|
|
const value3 = Module00017(a1);
|
|
if (_isNativeReflectConstruct_83391()) {
|
|
Reflect = global.Reflect;
|
|
value = Reflect.construct(value3, value || [], Module00017(a0).constructor);
|
|
r0 = value;
|
|
} else {
|
|
value = value3.apply(a0, value);
|
|
r0 = value;
|
|
}
|
|
return PossibleConstructorReturn(a0, r0);
|
|
}
|
|
|
|
function _isNativeReflectConstruct_83391() { // fn#83391, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11072:370, offset: 0x01f18bae, 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_83391_isNativeReflectConstruct = function() {
|
|
return !!result;
|
|
})();
|
|
}
|
|
|
|
function _fun83394(a0) { // fn#83394, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11072:851, offset: 0x01f18c10, size: 72 bytes, params: 2, frame: 15
|
|
const DefaultFallback2 = DefaultFallback;
|
|
Inherits(DefaultFallback2, a0);
|
|
return CreateClass(DefaultFallback2, [{key: 'render', value: value_83396}]);
|
|
function DefaultFallback() { // fn#83395, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11072:863, offset: 0x01f18c58, size: 42 bytes, params: 1, frame: 16
|
|
env1_3(this, DefaultFallback);
|
|
return _callSuper_83390(this, DefaultFallback, arguments);
|
|
}
|
|
|
|
function value_83396() { // fn#83396, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11072:1031, offset: 0x01f18c82, size: 167 bytes, params: 1, frame: 20
|
|
const value = environment.__proto__;
|
|
const value2 = env1_13(this.context);
|
|
return (
|
|
<View style={value2.wrapper}>
|
|
<Image
|
|
resizeMode="contain"
|
|
style={value2.fallbackImage}
|
|
source={(require(4002) /* metro dependency 4002: shared */).isThemeDark(this.props.theme) ? importDefault(10887) /* metro dependency 10887 */ : importDefault(10888) /* metro dependency 10888 */}
|
|
/>
|
|
</View>
|
|
);
|
|
}
|
|
|
|
}
|
|
|
|
function _fun83397(a0) { // fn#83397, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11072:1550, offset: 0x01f18d29, size: 72 bytes, params: 2, frame: 15
|
|
const StreamPreview2 = StreamPreview;
|
|
Inherits(StreamPreview2, a0);
|
|
return CreateClass(StreamPreview2, [{key: 'render', value: value_83402}]);
|
|
function StreamPreview(a0) { // fn#83398, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11072:1562, offset: 0x01f18d71, size: 125 bytes, params: 2, frame: 18
|
|
let value = copyRestArgs(0, undefined);
|
|
env1_3(this, StreamPreview);
|
|
const _callSuper_83390Binding = _callSuper_83390;
|
|
const items2 = [];
|
|
arraySpread(items2, value, 0, undefined);
|
|
value = _callSuper_83390Binding(this, StreamPreview, items2);
|
|
value.state = {'isImageLoaded': false, 'isImageErrored': false};
|
|
value.handleLoadStart = handleLoadStart;
|
|
value.handleLoad = handleLoad;
|
|
value.handleError = handleError_83401;
|
|
return value;
|
|
function handleLoadStart() { // fn#83399, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11072:1729, owner: StreamPreview.handleLoadStart, offset: 0x01f18dee, size: 36 bytes, params: 1, frame: 11
|
|
env0_0.setState({'isImageLoaded': false, 'isImageErrored': false});
|
|
}
|
|
|
|
function handleLoad() { // fn#83400, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11072:1797, owner: StreamPreview.handleLoad, offset: 0x01f18e12, size: 31 bytes, params: 1, frame: 12
|
|
env0_0.setState({isImageLoaded: true});
|
|
}
|
|
|
|
function StreamPreviewHandleError() { // fn#83401, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11072:1848, owner: StreamPreview.handleError, offset: 0x01f18e31, size: 31 bytes, params: 1, frame: 12
|
|
env0_0.setState({isImageErrored: true});
|
|
}
|
|
|
|
}
|
|
|
|
function value_83402() { // fn#83402, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11072:1951, offset: 0x01f18e50, size: 385 bytes, params: 1, frame: 28
|
|
var r8;
|
|
var r9;
|
|
var r0;
|
|
const value = environment.__proto__;
|
|
const binding = env1_15;
|
|
const context = this.context;
|
|
const value2 = undefined;
|
|
const value3 = binding(context);
|
|
const {url, ctaText, isFetching, renderFallback, style, children, theme, onPress, disabled} = this.props;
|
|
const state = this.state;
|
|
if (url == null) {
|
|
r0 = renderFallback == null ? value2 : renderFallback(isFetching, theme);
|
|
r8 = value2;
|
|
r9 = r0;
|
|
} else if (isFetching) {
|
|
r0 = renderFallback == null ? value2 : renderFallback(isFetching, theme);
|
|
r8 = value2;
|
|
r9 = r0;
|
|
} else if (state.isImageErrored) {
|
|
r0 = renderFallback == null ? value2 : renderFallback(isFetching, theme);
|
|
r8 = value2;
|
|
r9 = r0;
|
|
} else {
|
|
r9 = state.isImageLoaded || renderFallback == null ? value2 : renderFallback(true, theme);
|
|
r8 = (
|
|
<Image
|
|
resizeMode="contain"
|
|
style={value3.image}
|
|
source={{uri: url, cache: 'force-cache'}}
|
|
onLoadStart={this.handleLoadStart}
|
|
onLoad={this.handleLoad}
|
|
onError={this.handleError}
|
|
/>
|
|
);
|
|
}
|
|
const PressableOpacity = (PressablesModule).PressableOpacity;
|
|
return (
|
|
<PressableOpacity
|
|
accessibilityRole="button"
|
|
accessibilityLabel={ctaText}
|
|
activeOpacity={0.6}
|
|
style={[value3.touchable, style]}
|
|
disabled={disabled}
|
|
onPress={onPress}
|
|
>
|
|
<View style={value3.imageContainer}>
|
|
{r9}
|
|
{r8}
|
|
</View>
|
|
{children}
|
|
</PressableOpacity>
|
|
);
|
|
}
|
|
|
|
}
|
|
|
|
function renderFallback(a0, a1) { // fn#83403, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11072:2686, offset: 0x01f18fd1, size: 114 bytes, params: 3, frame: 18
|
|
const binding = env0_14;
|
|
const intl = (IndexNativeModule).intl;
|
|
const string = intl.string;
|
|
const t = (IndexNativeModule).t;
|
|
return ((Component) => <Component theme={a1} caption={a0 ? Reflect.apply(string, intl,
|
|
[t.NQ7H8V]) : Reflect.apply(string, intl, [t.uQZTBV])} />)(binding);
|
|
}
|
|
|
|
function ConnectedStreamPreview(a0) { // fn#83404, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11072:2917, offset: 0x01f19043, size: 172 bytes, params: 2, frame: 19
|
|
const {guildId, channelId, ownerId} = a0.stream;
|
|
const {previewUrl, isLoading} = (UseFetchStreamPreview)(guildId,
|
|
channelId, ownerId);
|
|
return ((Component) => <Component {...a0} {...{['url']: previewUrl}} {...{['isFetching']: isLoading}} {...{['theme']: (require(566) /* metro dependency 566: flux */).useStateFromStores([ThemeStore],
|
|
function() {
|
|
return ThemeStore.theme;
|
|
})}} />)(env0_16);
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun83389, 10886, [6, 7, 15, 17, 18, 31, 27, 1310, 33, 4501, 697, 4002, 10887, 10888, 3868, 1244, 5278,
|
|
10271, 566,
|
|
2]) /* metro module 10886, dependencies: [6, 7, 15, 17, 18, 31, 27, 1310, 33, 4501, 697, 4002, 10887, 10888, 3868, 1244, 5278, 10271, 566, 2] */;
|