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

187 lines
8.0 KiB
TypeScript

/* Metro module 14218; source: modules/mfa/native/screens/TotpScreen.tsx; dependencies: [5, 57, 31, 33, 14219, 14214, 1244, 14220, 14217, 2] */
function _fun107508(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#107508, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14415:6, offset: 0x022ff298, size: 185 bytes, params: 8, frame: 19
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_3 = importDefault(5) /* metro dependency 5 */;
const env0_4 = importDefault(57) /* metro dependency 57 */;
const env0_5 = importAll(31) /* metro dependency 31 */;
const env0_6 = (require(33) /* metro dependency 33 */).jsx;
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/mfa/native/screens/TotpScreen.tsx');
exports.default = TotpScreen;
}
function isValidClipboardCode(a0) { // fn#107509, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14415:140, offset: 0x022ff351, size: 72 bytes, params: 2, frame: 13
const length = a0.length;
const TOTP_CODE_LENGTH = (require(14219) /* metro dependency 14219: MFA */).TOTP_CODE_LENGTH;
return length === TOTP_CODE_LENGTH && RegExp('^\\d+$', '').test(a0);
}
function TotpScreen({mfaChallenge, finish}) { // fn#107510, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14415:318, offset: 0x022ff399, size: 691 bytes, params: 2, frame: 30
var object4;
const binding = env0_5;
let useState = binding.useState;
const value2 = Reflect.apply(useState, binding, [false]);
const binding2 = env0_4;
const value3 = binding2(value2, 2);
const property = value3[0];
const env0_1 = value3[1];
useState = binding.useState;
const value4 = binding2(Reflect.apply(useState, binding, ['']), 2);
const property2 = value4[0];
const env0_3 = value4[1];
useState = binding.useState;
const value5 = binding2(Reflect.apply(useState, binding, [undefined]), 2);
const property3 = value5[0];
var env0_4 = value5[1];
useState = binding.useState;
const value6 = binding2(Reflect.apply(useState, binding, [false]), 2);
const property4 = value6[0];
var env0_5 = value6[1];
const value8 = binding.useCallback(_fun107511(), [finish]);
const MfaOptionScreen = importDefault(14214) /* metro dependency 14214: MfaOptionScreen */;
object4 = {};
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
let string = intl.string;
object4.headerText = Reflect.apply(string, intl,
[(require(1244) /* metro dependency 1244: indexNative */).t.uc00u5]);
const ClipboardCopyInput = importDefault(14220) /* metro dependency 14220: ClipboardCopyInput */;
const object3 = {};
string = intl.string;
const HZPBOd = (require(1244) /* metro dependency 1244: indexNative */).t.HZPBOd;
object3.label = Reflect.apply(string, intl, [HZPBOd]);
object3.placeholder = intl.string((require(1244) /* metro dependency 1244: indexNative */).t.tARzgo);
object3.isValidClipboardCode = isValidClipboardCode;
const TOTP_CODE_LENGTH = (require(14219) /* metro dependency 14219: MFA */).TOTP_CODE_LENGTH;
object3.maxLength = TOTP_CODE_LENGTH;
object3.onChangeCode = value8;
object3.error = property3;
object3.isDisabled = property || property4;
object3.textContentType = 'oneTimeCode';
object3.autoComplete = 'one-time-code';
object3.keyboardType = 'number-pad';
object4.input = <ClipboardCopyInput {...object3} />;
const defaultImport3 = importDefault(14217) /* metro dependency 14217: button */;
const defaultImport3Props = {variant: 'primary',
text: intl.string((require(1244) /* metro dependency 1244: indexNative */).t.geKm7t),
loading: property || property4, onPress: onPress_107515};
let r9 = property || property4;
r9 = !r9 ? property2.length !== (require(14219) /* metro dependency 14219: MFA */).TOTP_CODE_LENGTH : r9;
defaultImport3Props.disabled = r9;
object4.submit = ((Component) => <Component {...defaultImport3Props} />)(defaultImport3);
object4.screenProps = {mfaChallenge: mfaChallenge, finish: finish};
object4.mfaMethod = 'totp';
return <MfaOptionScreen {...object4} />;
}
function _fun107511() { // fn#107511, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14415:549, offset: 0x022ff64c, size: 36 bytes, params: 1, frame: 12
const env0_0 = env1_3(_fun107513);
return _fun107514;
}
function TotpScreenOnPress() { // fn#107515, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14415:1308, owner: TotpScreen.onPress, offset: 0x022ff747, size: 20 bytes, params: 1, frame: 11
env0_6(env0_2);
}
function* _fun107513(a0) { // fn#107513, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14415:569, offset: 0x022ff67b, size: 204 bytes, params: 2, frame: 19
var message;
var r3;
var object2;
var moduleValue;
var value5;
var value6;
var binding;
var error;
var body;
let value = undefined;
if (true) {
value = undefined;
env2_3(a0);
if (env3_7(a0)) {
env2_4(value);
importDefault(true);
reducibleJoin4: while (true) {
reduciblePort21: while (true) {
exceptionLanding15: while (true) {
try {
} catch (error) {
break exceptionLanding15;
}
break reducibleJoin4;
}
binding = env2_4;
reducibleJoin18: while (true) {
if (error == null) {
message = value;
break reducibleJoin18;
}
body = error.body;
if (body == null) {
message = value;
break reducibleJoin18;
}
message = body.message;
break reducibleJoin18;
}
reducibleJoin20: while (true) {
if (message != null) {
r3 = message;
break reducibleJoin20;
}
message = error.message;
r3 = message;
break reducibleJoin20;
}
binding(r3);
break reduciblePort21;
}
importDefault(false);
return value;
}
try {
object2 = {};
} catch (error) {
break exceptionLanding15;
}
try {
object2.mfaType = 'totp';
} catch (error) {
break exceptionLanding15;
}
try {
object2.data = a0;
} catch (error) {
break exceptionLanding15;
}
try {
moduleValue = require(object2);
} catch (error) {
break exceptionLanding15;
}
yield moduleValue;
try {
value5 = undefined;
value6 = false;
} catch (error) {
break exceptionLanding15;
}
if (value6) {
return value5;
}
try {
binding = env2_5;
} catch (error) {
break exceptionLanding15;
}
try {
binding(true);
} catch (error) {
break exceptionLanding15;
}
importDefault(false);
}
}
return value;
}