Files
discord-decomp/sources/modules/oauth2/native/OAuth2AuthorizeContent.tsx
T
2026-07-27 16:20:00 +03:00

118 lines
6.8 KiB
TypeScript

/* Metro module 10209; source: modules/oauth2/native/OAuth2AuthorizeContent.tsx; dependencies: [57, 31, 27, 33, 4501, 697, 1478, 1585, 5467, 2] */
function _fun79354(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#79354, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10395:6, offset: 0x01e4f6f6, size: 490 bytes, params: 8, frame: 24
var object2;
const isNearBottom = function(a0) {
var r1;
var property = a0.layoutMeasurement;
var contentOffset = a0.contentOffset;
r1 = contentOffset !== undefined ? contentOffset : {y: 0};
var contentSize = a0.contentSize;
property = property.height;
return property + r1.y >= contentSize.height - 5;
};
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_2 = importDefault(57) /* metro dependency 57 */;
const env0_3 = importAll(31) /* metro dependency 31 */;
let value = require(27) /* metro dependency 27 */;
const env0_4 = value.View;
const env0_5 = value.ScrollView;
value = require(33) /* metro dependency 33 */;
const env0_6 = value.jsx;
const env0_7 = value.Fragment;
const env0_8 = value.jsxs;
value = require(4501) /* metro dependency 4501: createStyles */;
const createStyles = value.createStyles;
object2 = {};
object2.fill = {flex: 1};
const BACKGROUND_BASE_LOWER = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_BASE_LOWER;
object2.scrollView = {'flex': 1, 'backgroundColor': null, 'paddingHorizontal': 16,
backgroundColor: BACKGROUND_BASE_LOWER};
object2.scrollViewContentLandscape = {'flexDirection': 'row', 'alignItems': 'center', 'width': '100%',
'flexGrow': 1, 'gap': 16};
object2.scrollViewContentPortrait = {'flexDirection': 'column', 'width': '100%', 'flexGrow': 1, 'gap': 16};
object2.header = {paddingTop: 24};
object2.bodyContainer = {'flexDirection': 'column', 'gap': 16, 'padding': 16};
const object3 = {marginHorizontal: 16};
let BORDER_SUBTLE = (importDefault(697) /* metro dependency 697: native */).colors.BORDER_SUBTLE;
object3.backgroundColor = BORDER_SUBTLE;
object3.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.lg;
object2.bodyContainerBackground = object3;
object2.footerPortrait = {'flexDirection': 'column', 'padding': 16, 'gap': 16};
BORDER_SUBTLE = (importDefault(697) /* metro dependency 697: native */).colors.BORDER_SUBTLE;
object2.separator = {height: 1, backgroundColor: BORDER_SUBTLE};
const env0_9 = Reflect.apply(createStyles, value, [object2]);
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/oauth2/native/OAuth2AuthorizeContent.tsx');
exports.default = OAuth2AuthorizeContent;
}
function OAuth2AuthorizeContent({header, body, footer, appDetails, centerContent, setAllContentSeen, hasContentBackground, onScroll}) { // fn#79356, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10395:1036, offset: 0x01e4f926, size: 826 bytes, params: 2, frame: 36
const styles = useStyles();
const binding = env0_3;
const value3 = binding.useRef(null);
const env0_2 = value3;
const value4 = (importDefault(1478) /* metro dependency 1478: useWindowDimensionsNative */)();
const value5 = value4.width > value4.height;
const {left, right, bottom} = (importDefault(1585) /* metro dependency 1585: useSafeAreaInsetsNative */)();
let useState = binding.useState;
const value7 = Reflect.apply(useState, binding, [-1]);
const binding2 = env0_2;
const value8 = binding2(value7, 2);
const property = value8[0];
var env0_3 = property;
const env0_4 = value8[1];
useState = binding.useState;
const value9 = binding2(Reflect.apply(useState, binding, [-1]), 2);
const property2 = value9[0];
const env0_6 = value9[1];
useState = binding.useState;
const value10 = binding2(Reflect.apply(useState, binding, [-1]), 2);
const property3 = value10[0];
const env0_7 = value10[1];
env0_3.useLayoutEffect(_fun79357, [property, property >= 0 && property2 >= 0 && (footer == null || property3 >= 0),
property2, setAllContentSeen]);
return ((Component) => <Component style={[styles.fill,
{marginBottom: bottom}]}><ScrollView style={[styles.scrollView, {paddingLeft: left,
paddingRight: right}]} contentContainerStyle={[value5 ? styles.scrollViewContentLandscape : styles.scrollViewContentPortrait]} ref={value3} onContentSizeChange={onContentSizeChange} scrollEventThrottle={16} onLayout={onLayout_79359} onScroll={onScroll_79360} centerContent={centerContent}>{header != null ? <View style={styles.header}>{header}</View> : null}<View style={[styles.bodyContainer,
hasContentBackground ? styles.bodyContainerBackground : null,
value5 ? {flex: 1} : {}]}>{body}{appDetails != null ? <><View style={styles.separator} /><View>{appDetails}</View></> : null}</View></ScrollView>{footer != null ? <View onLayout={onLayout_79361} style={styles.footerPortrait}>{footer}</View> : null}</Component>)(importDefault(5467) /* metro dependency 5467: KeyboardAwareView */);
}
function _fun79357() { // fn#79357, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10395:1455, offset: 0x01e4fc60, size: 101 bytes, params: 1, frame: 14
var value2;
var isNearBottom2;
var setAllContentSeenBinding;
if (env0_8) {
value2 = environment.__proto__;
isNearBottom2 = isNearBottom({layoutMeasurement: {height: env0_5}, contentSize: {height: env0_3}});
setAllContentSeenBinding = setAllContentSeen;
if (isNearBottom2) {
if (setAllContentSeenBinding != null) {
setAllContentSeen(true);
}
} else if (setAllContentSeenBinding != null) {
setAllContentSeen(false);
}
}
}
function OAuth2AuthorizeContentOnContentSizeChange(a0, a1) { // fn#79358, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10395:1795, owner: OAuth2AuthorizeContent.onContentSizeChange, offset: 0x01e4fcc5, size: 53 bytes, params: 3, frame: 13
const current = env0_2.current;
if (current != null) {
current.scrollTo({y: 0});
}
env0_4(a1);
}
function OAuth2AuthorizeContentOnScroll(a0) { // fn#79360, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10395:1931, owner: OAuth2AuthorizeContent.onScroll, offset: 0x01e4fd1e, size: 74 bytes, params: 2, frame: 13
if (isNearBottom(a0.nativeEvent)) {
if (setAllContentSeen != null) {
setAllContentSeen(true);
}
}
if (onScroll != null) {
onScroll(a0);
}
}