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

198 lines
9.8 KiB
TypeScript

/* Metro module 9403; source: modules/oauth2/native/ApplicationDetails.tsx; dependencies: [31, 27, 33, 4501, 697, 9345, 9404, 9406, 21, 4121, 4056, 1244, 6705, 9408, 9409, 4076, 4122, 9411, 8036, 6766, 2] */
import SnowflakeUtils from '../../../utils/SnowflakeUtils.tsx'; /* Metro dependency 21 */
import Native from '../../../external/discord_common/js/packages/tokens/native.tsx'; /* Metro dependency 697 */
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 ClockIconModule from '../../../design/components/Icon/native/redesign/generated/ClockIcon.tsx'; /* Metro dependency 4076 */
import * as ScopesModule from '../scopes.tsx'; /* Metro dependency 4121 */
import * as OAuth2ScopesModule from '../../../external/discord_common/js/shared/shared-constants/OAuth2Scopes.tsx'; /* Metro dependency 4122 */
import * as LockIconModule from '../../../design/components/Icon/native/redesign/generated/LockIcon.tsx'; /* Metro dependency 6705 */
import * as TextWithIOSLinkWorkaroundModule from '../../a11y/native/TextWithIOSLinkWorkaround.tsx'; /* Metro dependency 6766 */
import * as ShieldIconModule from '../../../design/components/Icon/native/redesign/generated/ShieldIcon.tsx'; /* Metro dependency 8036 */
function _fun73311(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#73311, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9589:6, offset: 0x01d67cf6, size: 303 bytes, params: 8, frame: 21
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
ReactModule;
let value = JsxRuntimeModule;
const env0_4 = value.jsx;
const env0_5 = value.jsxs;
value = require(4501) /* metro dependency 4501: createStyles */;
const createStyles = value.createStyles;
const TEXT_MUTED = (Native).colors.TEXT_MUTED;
const env0_6 = Reflect.apply(createStyles, value, [{applicationDetails: {'flexDirection': 'column', 'gap': 16},
entry: {'flexDirection': 'row', 'alignItems': 'center', 'gap': 8}, entryText: {flex: 1},
entryIcon: {'width': 16, 'height': 16, tintColor: TEXT_MUTED}}]);
(FileImportTrackerModule).fileFinishedImporting('modules/oauth2/native/ApplicationDetails.tsx');
exports.default = ApplicationDetails;
function ApplicationDetailsEntry({iconComponent, text}) { // fn#73312, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9589:363, offset: 0x01d67e25, size: 161 bytes, params: 2, frame: 20
const styles = useStyles();
const r6 = iconComponent != null ? iconComponent({style: styles.entryIcon}) : null;
const TextWithIOSLinkWorkaround = (TextWithIOSLinkWorkaroundModule).TextWithIOSLinkWorkaround;
return (
<View style={styles.entry}>
{r6}
<TextWithIOSLinkWorkaround
variant="text-sm/normal"
color="text-default"
style={styles.entryText}
>
{text}
</TextWithIOSLinkWorkaround>
</View>
);
}
function ApplicationDetails({application, scopes, redirectUri, approximateGuildCount, isEmbeddedFlow, disclosures, connectedAccount}) { // fn#73313, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9589:711, offset: 0x01d67ec6, size: 953 bytes, params: 2, frame: 32
var r20;
var r7;
var r6;
var URL;
var value7;
var uRL;
var value8;
var href;
var value9;
var value10;
var value11;
var error;
var object;
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
var object3;
var object4;
const styles = useStyles();
const Date = global.Date;
const defaultImport = SnowflakeUtils;
const value2 = defaultImport.extractTimestamp(application.id);
let prototype = Date.prototype;
const value3 = Object.create(prototype, {constructor: {value: Date}});
const date = new Date(value2);
const value4 = date instanceof Object ? date : value3;
const securityMessage = (ScopesModule).getSecurityMessage(scopes);
if (redirectUri == null) {
r20 = null;
} else if (isEmbeddedFlow) {
r20 = null;
} else {
try {
URL = global.URL;
prototype = URL.prototype;
value7 = Object.create(prototype, {constructor: {value: URL}});
uRL = new URL(redirectUri);
value8 = uRL instanceof Object ? uRL : value7;
href = value8.href;
value9 = href.split('/');
value10 = value9.slice(0, 3);
value11 = value10.join('/');
r20 = value11;
} catch (error) {
r20 = redirectUri;
}
}
if (r20 != null) {
r7 = (
<ApplicationDetailsEntry
iconComponent={(require(4056) /* metro dependency 4056: LinkIcon */).LinkIcon}
text={intl.format((require(1244) /* metro dependency 1244: indexNative */).t['5k5OKD'], {origin: r20})}
/>
);
} else {
r7 = null;
}
const items2 = [r7];
const LockIcon = (LockIconModule).LockIcon;
items2[1] = (
<ApplicationDetailsEntry
iconComponent={LockIcon}
text={(require(9408) /* metro dependency 9408: Utils */).getApplicationDetailsText(application)}
/>
);
if (connectedAccount != null) {
r6 = (
<ApplicationDetailsEntry
iconComponent={(require(9409) /* metro dependency 9409: HammerIcon */).HammerIcon}
text={intl.string((require(1244) /* metro dependency 1244: indexNative */).t['8qui3M'])}
/>
);
} else {
r6 = null;
}
items2[2] = r6;
const ClockIcon = (ClockIconModule).ClockIcon;
items2[3] = (
<ApplicationDetailsEntry
iconComponent={ClockIcon}
text={intl.formatToPlainString((require(1244) /* metro dependency 1244: indexNative */).t['+1bjc8'],
{date: value4})}
/>
);
const includes = scopes.includes;
const OAuth2Scopes = (OAuth2ScopesModule).OAuth2Scopes;
const BOT = OAuth2Scopes.BOT;
if (Reflect.apply(includes, scopes, [BOT])) {
if (approximateGuildCount != null) {
r6 = (
<ApplicationDetailsEntry
iconComponent={(require(9411) /* metro dependency 9411: RobotIcon */).RobotIcon}
text={intl.formatToPlainString((require(1244) /* metro dependency 1244: indexNative */).t.UHGHSP,
{guildCount: approximateGuildCount})}
/>
);
} else {
r6 = null;
}
} else {
r6 = null;
}
items2[4] = r6;
const ShieldIcon = (ShieldIconModule).ShieldIcon;
items2[5] = <ApplicationDetailsEntry iconComponent={ShieldIcon} text={securityMessage} />;
items2[6] = disclosures != null ? disclosures.map(_fun73314) : null;
return (
<View style={styles.applicationDetails}>
{items2}
</View>
);
function _fun73314(a0) { // fn#73314, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9589:1841, offset: 0x01d6827f, size: 236 bytes, params: 2, frame: 19
var r1;
var object;
const value = environment.__proto__;
const textForDisclosure = (require(9345) /* metro dependency 9345: disclosures */).getTextForDisclosure(a0);
const ApplicationDisclosure = (require(9345) /* metro dependency 9345: disclosures */).ApplicationDisclosure;
const IP_LOCATION = ApplicationDisclosure.IP_LOCATION;
if (IP_LOCATION === a0) {
object = {};
object.iconComponent = (require(9404) /* metro dependency 9404: GlobeEarthIcon */).GlobeEarthIcon;
r1 = object;
} else if ((require(9345) /* metro dependency 9345: disclosures */).ApplicationDisclosure.DISPLAYS_ADVERTISEMENTS !== a0) {
r1 = null;
} else {
object = {};
object.iconComponent = (require(9406) /* metro dependency 9406: EmbedIcon */).EmbedIcon;
r1 = object;
}
const value4 = null;
return (
value4 != r1 && value4 != textForDisclosure
? (
<ApplicationDetailsEntry
text={textForDisclosure}
{...r1}
key={a0.toFixed()}
/>
)
: value4
);
}
}
}
global.__d(_fun73311, 9403, [31, 27, 33, 4501, 697, 9345, 9404, 9406, 21, 4121, 4056, 1244, 6705, 9408, 9409, 4076,
4122, 9411, 8036, 6766,
2]) /* metro module 9403, dependencies: [31, 27, 33, 4501, 697, 9345, 9404, 9406, 21, 4121, 4056, 1244, 6705, 9408, 9409, 4076, 4122, 9411, 8036, 6766, 2] */;