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

182 lines
11 KiB
TypeScript

/* Metro module 12649; source: modules/activate_device/native/ActivateDevice.tsx; dependencies: [57, 31, 27, 33, 4501, 697, 12650, 12652, 8870, 9363, 12653, 4121, 12654, 5475, 12655, 12659, 12660, 1423, 12661, 6618, 2] */
import Module00057 from '../../../by-id/module-00057.js'; /* Metro dependency 57 */
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 AvatarUtilsModule from '../../../utils/AvatarUtils.tsx'; /* Metro dependency 1423 */
import * as ScopesModule from '../../oauth2/scopes.tsx'; /* Metro dependency 4121 */
import * as SafeAreaViewModule from '../../../components_native/common/SafeAreaView.tsx'; /* Metro dependency 6618 */
import * as ApplicationUtilsModule from '../../../utils/native/ApplicationUtils.tsx'; /* Metro dependency 8870 */
import * as ConsoleOAuthApplicationsModule from '../../../external/discord_common/js/shared/shared-constants/ConsoleOAuthApplications.tsx'; /* Metro dependency 9363 */
import * as UseActivateDeviceStepTrackingModule from '../useActivateDeviceStepTracking.tsx'; /* Metro dependency 12650 */
import * as UseDeviceCodeAuthorizeCallbackModule from '../useDeviceCodeAuthorizeCallback.tsx'; /* Metro dependency 12652 */
function _fun96982(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#96982, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12839:6, offset: 0x0216ebb0, size: 467 bytes, params: 8, frame: 23
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = ReactNativeModule;
const env0_5 = value.View;
const env0_6 = value.ImageBackground;
const env0_7 = value.ActivityIndicator;
const env0_8 = value.ScrollView;
value = require(4501) /* metro dependency 4501: createStyles */;
const createStyles = value.createStyles;
object = {};
object.background = {flex: 1};
const TEXT_BRAND = (importDefault(697) /* metro dependency 697: native */).colors.TEXT_BRAND;
object.imageStyle = {'marginVertical': 0, 'resizeMode': 'cover', backgroundColor: TEXT_BRAND};
object.safeArea = {'flex': 1, 'justifyContent': 'center', 'alignItems': 'center'};
const object4 = {'maxWidth': 480, 'backgroundColor': null, 'alignItems': 'center', 'justifyContent': 'center',
'borderRadius': null, 'padding': 24, 'marginHorizontal': 24, 'marginVertical': 36, 'shadowColor': null,
'shadowOpacity': 0.2};
const PANEL_BG = (importDefault(697) /* metro dependency 697: native */).colors.PANEL_BG;
object4.backgroundColor = PANEL_BG;
object4.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.lg;
const BLACK = (importDefault(697) /* metro dependency 697: native */).colors.BLACK;
object4.shadowColor = BLACK;
object4.shadowOffset = {'width': 0, 'height': 4};
object4.shadowRadius = 4;
object.content = object4;
object.scroller = {'alignSelf': 'stretch', 'flexGrow': 0};
object.scrollerContent = {'flexDirection': 'column', 'gap': 16};
const env0_10 = Reflect.apply(createStyles, value, [object]);
(FileImportTrackerModule).fileFinishedImporting('modules/activate_device/native/ActivateDevice.tsx');
exports.ActivateDevice = ActivateDevice;
function ActivateDevice({onClose, prefilledUserCode}) { // fn#96983, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12839:879, offset: 0x0216ed83, size: 815 bytes, params: 2, frame: 29
const styles = useStyles();
let useState = ReactModule.useState;
const value3 = Reflect.apply(useState, ReactModule, [{'type': 'user-code-input', 'usePrefilledCode': true}]);
const binding2 = env0_3;
const value4 = binding2(value3, 2);
const property = value4[0];
const property2 = value4[1];
useState = ReactModule.useState;
const value6 = binding2(Reflect.apply(useState, ReactModule, [null]), 2);
const property3 = value6[0];
var env0_3 = value6[1];
(UseActivateDeviceStepTrackingModule).useActivateDeviceStepTracking(property);
let useCallback = ReactModule.useCallback;
const value7 = Reflect.apply(useCallback, ReactModule, [_fun96984, [property2]]);
const value8 = ReactModule.useCallback(_fun96985, [property2]);
useCallback = ReactModule.useCallback;
const value11 = ReactModule.useCallback(_fun96987,
[(UseDeviceCodeAuthorizeCallbackModule).useDeviceCodeAuthorizeCallback(value7,
Reflect.apply(useCallback, ReactModule, [_fun96986, [property2]]), value8)]);
ReactModule.useEffect(_fun96989, [property]);
ReactModule.useEffect(_fun96991, [property3]);
const type = property.type;
const r10 = (
type === 'user-code-input'
? ((UserCodeInput) => <UserCodeInput prefilledUserCode={property.usePrefilledCode ? prefilledUserCode : undefined} onUserCodeAccepted={value11} onClose={onClose} />)((require(12655) /* metro dependency 12655: UserCodeInput */).UserCodeInput)
: (
type === 'authorization'
? (
<ActivityIndicator animating />
)
: (
type === 'success'
? ((ActivateDeviceSuccess) => <ActivateDeviceSuccess onComplete={onClose} data={property.userCodeData} successImage={property3} />)((require(12659) /* metro dependency 12659: ActivateDeviceSuccess */).ActivateDeviceSuccess)
: (
type !== 'error'
? null
: ((ActivateDeviceError) => <ActivateDeviceError onRetry={value7} />)((require(12660) /* metro dependency 12660: ActivateDeviceError */).ActivateDeviceError)
)
)
)
);
object = {};
object.source = AvatarUtilsModule.makeSource(importDefault(12661) /* metro dependency 12661: mobile_backgroundJpg */);
object.imageStyle = styles.imageStyle;
object.style = [styles.background];
const SafeAreaPaddingView = (SafeAreaViewModule).SafeAreaPaddingView;
return (
<ImageBackground {...object}>
<SafeAreaPaddingView
bottom
top
style={styles.safeArea}
>
<View style={styles.content}>
<ScrollView
bounces={false}
style={styles.scroller}
contentContainerStyle={styles.scrollerContent}
>
{r10}
</ScrollView>
</View>
</SafeAreaPaddingView>
</ImageBackground>
);
function _fun96984() { // fn#96984, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12839:1113, offset: 0x0216f0b2, size: 28 bytes, params: 1, frame: 11
env0_1({type: 'user-code-input'});
}
function _fun96985(a0) { // fn#96985, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12839:1170, offset: 0x0216f0ce, size: 34 bytes, params: 2, frame: 11
env0_1({type: 'success', userCodeData: a0});
}
function _fun96986(a0) { // fn#96986, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12839:1233, offset: 0x0216f0f0, size: 34 bytes, params: 2, frame: 11
env0_1({type: 'error', userCodeData: a0});
}
function _fun96987(a0) { // fn#96987, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12839:1342, offset: 0x0216f112, size: 124 bytes, params: 2, frame: 15
var environment;
const env0_0 = a0;
env0_1({type: 'authorization', userCodeData: a0});
const value = environment.__proto__;
(ApplicationUtilsModule).openOAuth2Modal({'clientId': null, 'scopes': null,
'responseType': 'code', 'isTrustedName': true, 'isEmbeddedFlow': true, 'withBackPressHandler': false,
clientId: a0.clientId, scopes: a0.scopes, callbackWithoutPost: callbackWithoutPost});
function callbackWithoutPost(a0) { // fn#96988, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12839:1547, offset: 0x0216f18e, size: 27 bytes, params: 2, frame: 13
return env1_4(env0_0, a0);
}
}
function _fun96989() { // fn#96989, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12839:1586, offset: 0x0216f1a9, size: 213 bytes, params: 1, frame: 17
var environment;
var userCodeData;
var value2;
const ConsoleOAuthApplications = (ConsoleOAuthApplicationsModule).ConsoleOAuthApplications;
var items2;
var scopes;
if ('userCodeData' in env0_0) {
userCodeData = env0_0.userCodeData;
value2 = environment.__proto__;
items2 = [ConsoleOAuthApplications.PLAYSTATION_APPLICATION_ID];
items2[1] = ConsoleOAuthApplications.PLAYSTATION_STAGING_APPLICATION_ID;
if (items2.includes(userCodeData.clientId)) {
env0_3(importDefault(12653) /* metro dependency 12653: ps_link_success_illustration2xPng */);
} else {
scopes = userCodeData.scopes;
if (scopes.some(_fun96990)) {
env0_3(importDefault(12654) /* metro dependency 12654: social_layer_link_success_illustration2xPng */);
}
}
}
function _fun96990(a0) { // fn#96990, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12839:1813, offset: 0x0216f27e, size: 41 bytes, params: 2, frame: 11
const value = environment.__proto__.__proto__;
return (ScopesModule).isSocialLayerUmbrellaScope(a0);
}
}
function _fun96991() { // fn#96991, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12839:1891, offset: 0x0216f2a7, size: 57 bytes, params: 1, frame: 12
var value2;
if (env0_2 != null) {
value2 = environment.__proto__;
(importDefault(5475) /* metro dependency 5475: FastImage */).preload(env0_2);
}
}
}
}
global.__d(_fun96982, 12649, [57, 31, 27, 33, 4501, 697, 12650, 12652, 8870, 9363, 12653, 4121, 12654, 5475, 12655,
12659, 12660, 1423, 12661, 6618,
2]) /* metro module 12649, dependencies: [57, 31, 27, 33, 4501, 697, 12650, 12652, 8870, 9363, 12653, 4121, 12654, 5475, 12655, 12659, 12660, 1423, 12661, 6618, 2] */;