192 lines
11 KiB
TypeScript
192 lines
11 KiB
TypeScript
/* Metro module 15873; source: modules/guild_settings/native/AssetChooser.tsx; dependencies: [153, 5, 6, 7, 15, 17, 18, 31, 27, 661, 33, 4501, 697, 4660, 5278, 1244, 15874, 15875, 1305, 3868, 2] */
|
|
import Module00005 from '../../../by-id/module-00005.js'; /* Metro dependency 5 */
|
|
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 Module00153 from '../../../by-id/module-00153.js'; /* Metro dependency 153 */
|
|
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 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 _fun122179(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#122179, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16081:6, offset: 0x0255d052, size: 627 bytes, params: 8, frame: 23
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
Module00153;
|
|
let value = ReactModule;
|
|
const createLegacyClassComponentStyles = CreateStylesModule.createLegacyClassComponentStyles;
|
|
object = {assetWrapper: {'width': '100%', 'alignItems': 'center'}};
|
|
const object2 = {'width': '100%', 'height': 192, 'borderRadius': null, 'overflow': 'hidden'};
|
|
object2.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.xs;
|
|
const BACKGROUND_BASE_LOW = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_BASE_LOW;
|
|
object2.backgroundColor = BACKGROUND_BASE_LOW;
|
|
object.asset = object2;
|
|
const BLACK = (importDefault(697) /* metro dependency 697: native */).unsafe_rawColors.BLACK;
|
|
object.uploadIconWrapper = {'position': 'absolute', 'bottom': 10, 'right': 10, 'shadowColor': null,
|
|
'shadowRadius': 10, 'shadowOffset': null, 'shadowOpacity': 0.2, shadowColor: BLACK, shadowOffset: {'height': 8,
|
|
'width': 0}};
|
|
object.uploadIcon = {'width': 16, 'height': 16};
|
|
const BLUE_345 = (importDefault(697) /* metro dependency 697: native */).unsafe_rawColors.BLUE_345;
|
|
object.remove = {'marginTop': 8, 'fontSize': 14, 'lineHeight': 18, color: BLUE_345};
|
|
const env0_17 = Reflect.apply(createLegacyClassComponentStyles, CreateStylesModule, [object]);
|
|
const PureComponent = value.PureComponent;
|
|
value = _fun122183(PureComponent);
|
|
const ThemeContext = (NativeModule).ThemeContext;
|
|
value.contextType = ThemeContext;
|
|
(FileImportTrackerModule).fileFinishedImporting('modules/guild_settings/native/AssetChooser.tsx');
|
|
exports.default = value;
|
|
function _isNativeReflectConstruct_122180() { // fn#122180, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16081:324, offset: 0x0255d2c5, 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_122180_isNativeReflectConstruct = function() {
|
|
return !!result;
|
|
})();
|
|
}
|
|
|
|
function _fun122183(a0) { // fn#122183, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16081:1039, offset: 0x0255d327, size: 97 bytes, params: 2, frame: 16
|
|
const AssetChooser2 = AssetChooser;
|
|
Inherits(AssetChooser2, a0);
|
|
return CreateClass(AssetChooser2, [{key: 'getSource', value: function() {
|
|
var property = this.props;
|
|
var rawSource = property.rawSource;
|
|
var getSource = property.getSource;
|
|
property = property.guild;
|
|
var value = null;
|
|
return value == rawSource ? value : rawSource.startsWith('data:') ? {uri: rawSource} : getSource(property, 192);
|
|
}}, {key: 'render', value: value_122189}]);
|
|
function AssetChooser(a0) { // fn#122184, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16081:1051, offset: 0x0255d388, size: 167 bytes, params: 2, frame: 21
|
|
var r0;
|
|
var Reflect;
|
|
let value = copyRestArgs(0, undefined);
|
|
let binding = env1_4;
|
|
binding(this, AssetChooser);
|
|
const items2 = [];
|
|
arraySpread(items2, value, 0, items2);
|
|
value = env1_7(AssetChooser);
|
|
binding = env1_6;
|
|
if (_isNativeReflectConstruct_122180()) {
|
|
Reflect = global.Reflect;
|
|
value = Reflect.construct(value, items2, env1_7(this).constructor);
|
|
r0 = value;
|
|
} else {
|
|
value = value.apply(this, items2);
|
|
r0 = value;
|
|
}
|
|
value = binding(this, r0);
|
|
value.handleChooseAsset = env1_3(_fun122186);
|
|
value.handleRemoveAsset = handleRemoveAsset;
|
|
return value;
|
|
function* _fun122186() { // fn#122186, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16081:1296, offset: 0x0255d43a, size: 153 bytes, params: 1, frame: 17
|
|
if (true) {
|
|
value = environment.__proto__;
|
|
var {size, onChooseAsset} = AssetChooser.props;
|
|
value = environment.__proto__.__proto__.__proto__;
|
|
var value3 = env3_1(env3_2[13]);
|
|
yield value3.openImagePicker(typeof size === 'number' ? {size: size} : size ?? ({size: env3_13}));
|
|
value = undefined;
|
|
if (false) {
|
|
return value;
|
|
}
|
|
var base64 = value.base64;
|
|
if (base64 != null) {
|
|
if (onChooseAsset != null) {
|
|
onChooseAsset(base64);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
function handleRemoveAsset() { // fn#122187, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16081:1487, owner: AssetChooser.handleRemoveAsset, offset: 0x0255d4d3, size: 35 bytes, params: 1, frame: 11
|
|
const onChooseAsset = env0_0.props.onChooseAsset;
|
|
if (onChooseAsset != null) {
|
|
onChooseAsset(null);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
function value_122189() { // fn#122189, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16081:1777, offset: 0x0255d547, size: 487 bytes, params: 1, frame: 35
|
|
const value = environment.__proto__;
|
|
const value2 = env1_17(this.context);
|
|
const disabled = this.props.disabled;
|
|
const source = this.getSource();
|
|
const jsxRuntimeEnv1_15Binding = jsxRuntimeEnv1_15;
|
|
const PressableOpacity = (PressablesModule).PressableOpacity;
|
|
const object2 = {accessibilityRole: 'button'};
|
|
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
|
|
object2.accessibilityLabel = intl.string((require(1244) /* metro dependency 1244: indexNative */).t['MsUY/S']);
|
|
object2.style = value2.assetWrapper;
|
|
object2.onPress = this.handleChooseAsset;
|
|
object2.disabled = disabled;
|
|
const value4 = null;
|
|
return (
|
|
<>
|
|
<PressableOpacity {...object2}>
|
|
<ImageBackground
|
|
source={value4 != source ? source : importDefault(15874) /* metro dependency 15874 */}
|
|
style={value2.asset}
|
|
>
|
|
{
|
|
disabled
|
|
? value4
|
|
: (
|
|
<View style={value2.uploadIconWrapper}>
|
|
<Image
|
|
style={value2.uploadIcon}
|
|
source={importDefault(15875) /* metro dependency 15875 */}
|
|
/>
|
|
</View>
|
|
)
|
|
}
|
|
</ImageBackground>
|
|
</PressableOpacity>
|
|
{
|
|
value4 == source || disabled
|
|
? value4
|
|
: (
|
|
<TouchableWithoutFeedback accessibilityRole="button" onPress={this.handleRemoveAsset}>
|
|
{((LegacyText) => <LegacyText style={value2.remove}>{intl.string((require(1244) /* metro dependency 1244: indexNative */).t.N86XcP)}</LegacyText>)((require(1305) /* metro dependency 1305: native */).LegacyText)}
|
|
</TouchableWithoutFeedback>
|
|
)
|
|
}
|
|
</>
|
|
);
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun122179, 15873, [153, 5, 6, 7, 15, 17, 18, 31, 27, 661, 33, 4501, 697, 4660, 5278, 1244, 15874, 15875,
|
|
1305, 3868,
|
|
2]) /* metro module 15873, dependencies: [153, 5, 6, 7, 15, 17, 18, 31, 27, 661, 33, 4501, 697, 4660, 5278, 1244, 15874, 15875, 1305, 3868, 2] */;
|