Files
discord-decomp/sources/modules/oauth2/native/OAuth2AuthorizeContent.tsx
T
2026-07-28 01:06:53 +03:00

132 lines
8.4 KiB
TypeScript

/* Metro module 10209; source: modules/oauth2/native/OAuth2AuthorizeContent.tsx; dependencies: [57, 31, 27, 33, 4501, 697, 1478, 1585, 5467, 2] */
import Module00057 from '../../../by-id/module-00057.js'; /* Metro dependency 57 */
import UseWindowDimensionsNative from '../../screen/useWindowDimensions.native.tsx'; /* Metro dependency 1478 */
import UseSafeAreaInsetsNative from '../../safe_area/useSafeAreaInsets.native.tsx'; /* Metro dependency 1585 */
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 */
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
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});
let value = ReactNativeModule;
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;
object = {};
object.fill = {flex: 1};
const BACKGROUND_BASE_LOWER = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_BASE_LOWER;
object.scrollView = {'flex': 1, 'backgroundColor': null, 'paddingHorizontal': 16,
backgroundColor: BACKGROUND_BASE_LOWER};
object.scrollViewContentLandscape = {'flexDirection': 'row', 'alignItems': 'center', 'width': '100%', 'flexGrow': 1,
'gap': 16};
object.scrollViewContentPortrait = {'flexDirection': 'column', 'width': '100%', 'flexGrow': 1, 'gap': 16};
object.header = {paddingTop: 24};
object.bodyContainer = {'flexDirection': 'column', 'gap': 16, 'padding': 16};
const object4 = {marginHorizontal: 16};
let BORDER_SUBTLE = (importDefault(697) /* metro dependency 697: native */).colors.BORDER_SUBTLE;
object4.backgroundColor = BORDER_SUBTLE;
object4.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.lg;
object.bodyContainerBackground = object4;
object.footerPortrait = {'flexDirection': 'column', 'padding': 16, 'gap': 16};
BORDER_SUBTLE = (importDefault(697) /* metro dependency 697: native */).colors.BORDER_SUBTLE;
object.separator = {height: 1, backgroundColor: BORDER_SUBTLE};
const env0_9 = Reflect.apply(createStyles, value, [object]);
(FileImportTrackerModule).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 = property4;
const value3 = binding.useRef(null);
const env0_2 = value3;
const value4 = (UseWindowDimensionsNative)();
const value5 = value4.width > value4.height;
const {left, right, bottom} = (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 property4 = 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];
property4.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_79358} 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: ReactModule}});
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 OAuth2AuthorizeContentOnLayout({nativeEvent}) { // fn#79359, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10395:1886, owner: OAuth2AuthorizeContent.onLayout, offset: 0x01e4fcfa, size: 36 bytes, params: 2, frame: 11
env0_6(nativeEvent.layout.height);
}
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);
}
}
function OAuth2AuthorizeContentOnLayout_79361({nativeEvent}) { // fn#79361, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10395:2258, owner: OAuth2AuthorizeContent.onLayout, offset: 0x01e4fd68, size: 36 bytes, params: 2, frame: 11
env0_7(nativeEvent.layout.height);
}
}
}
global.__d(_fun79354, 10209, [57, 31, 27, 33, 4501, 697, 1478, 1585, 5467,
2]) /* metro module 10209, dependencies: [57, 31, 27, 33, 4501, 697, 1478, 1585, 5467, 2] */;