240 lines
11 KiB
TypeScript
240 lines
11 KiB
TypeScript
/* Metro module 15791; source: modules/nuf/native/NewUserUtils.tsx; dependencies: [5, 27, 14316, 5040, 1878, 661, 11995, 4661, 11997, 477, 9151, 694, 1485, 12000, 4007, 15792, 5080, 1230, 12043, 2] */
|
|
function _fun121308(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#121308, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15999:6, offset: 0x025442de, size: 558 bytes, params: 8, frame: 21
|
|
var object3;
|
|
const env0_0 = require;
|
|
const closure = function() {
|
|
return _getNextOnboardingStep.apply(this, arguments);
|
|
};
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const value = importDefault(5) /* metro dependency 5 */;
|
|
const env0_4 = (require(27) /* metro dependency 27 */).NativeModules;
|
|
const parentalConsentStore = importDefault(14316) /* metro dependency 14316: ParentalConsentStore */;
|
|
const connectedAccountsStore = importDefault(5040) /* metro dependency 5040: ConnectedAccountsStore */;
|
|
const userStore = importDefault(1878) /* metro dependency 1878: UserStore */;
|
|
const constantsModule = require(661) /* metro dependency 661: Constants */;
|
|
const env0_8 = constantsModule.PlatformTypes;
|
|
const env0_9 = constantsModule.Routes;
|
|
const env0_10 = (require(11995) /* metro dependency 11995: ContactSyncConstants */).ContactPermissions;
|
|
const env0_11 = (require(4661) /* metro dependency 4661: NativePermissionConstants */).NotificationAuthorizationStatus;
|
|
object3 = {key: 'choose-avatar', shouldShowStep: shouldShowStep_121317};
|
|
const object4 = {key: 'enable-notification'};
|
|
const env0_12 = value(_fun121319);
|
|
object4.shouldShowStep = shouldShowStep_121320;
|
|
const env0_13 = value(_fun121322);
|
|
const items2 = [object4, {key: 'contact-sync', shouldShowStep: shouldShowStep_121324}];
|
|
items2[2] = {key: 'discoverability', shouldShowStep: function() {
|
|
return true;
|
|
}};
|
|
items2[3] = object3;
|
|
items2[4] = {key: 'connect-guardian', shouldShowStep: function() {
|
|
return ParentalConsentStore.getShouldShowGuardianConnect();
|
|
}};
|
|
object3 = {key: 'accept-invite'};
|
|
object3.shouldShowStep = (require(9151) /* metro dependency 9151: InstantInviteUtils */).hasDeferredInvite;
|
|
object3.transitionStep = transitionStep;
|
|
items2[5] = object3;
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/nuf/native/NewUserUtils.tsx');
|
|
exports.getKeyForOnboardingStep = getKeyForOnboardingStep;
|
|
exports.continueToNextStep = continueToNextStep;
|
|
exports.getNextOnboardingStep = closure;
|
|
}
|
|
|
|
function _shouldSkipContactSyncStep() { // fn#121309, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15999:381, offset: 0x0254450c, size: 50 bytes, params: 1, frame: 14
|
|
return env0_3(_fun121311).apply(this, arguments);
|
|
}
|
|
|
|
function lastStepComplete(a0) { // fn#121312, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15999:1382, offset: 0x025445de, size: 215 bytes, params: 2, frame: 17
|
|
(require(12000) /* metro dependency 12000: NewUserAnalyticsUtils */).trackNUFStep(a0, 'NUF Complete');
|
|
const navigationRouteUtilsNativeModule = require(4007) /* metro dependency 4007: NavigationRouteUtilsNative */;
|
|
const isModalOpen = navigationRouteUtilsNativeModule.isModalOpen;
|
|
const NEW_USER_MODAL_KEY = (require(15792) /* metro dependency 15792: NewUserModalTypes */).NEW_USER_MODAL_KEY;
|
|
if (Reflect.apply(isModalOpen, navigationRouteUtilsNativeModule, [NEW_USER_MODAL_KEY])) {
|
|
(importDefault(5080) /* metro dependency 5080: ModalActionCreators */).popWithKey(NEW_USER_MODAL_KEY);
|
|
}
|
|
const router_utilsModule = require(1230) /* metro dependency 1230: router_utils */;
|
|
const transitionTo = router_utilsModule.transitionTo;
|
|
const ME = Routes.ME;
|
|
Reflect.apply(transitionTo, router_utilsModule, [ME, {navigationReplace: true}]);
|
|
(require(12043) /* metro dependency 12043: NUFActionCreators */).setNewUserFlowCompleted();
|
|
}
|
|
|
|
function _getNextOnboardingStep() { // fn#121314, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15999:1722, offset: 0x025446b5, size: 50 bytes, params: 1, frame: 14
|
|
return env0_3(_fun121316).apply(this, arguments);
|
|
}
|
|
|
|
function shouldShowStep_121317() { // fn#121317, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15999:308, offset: 0x02544877, size: 39 bytes, params: 1, frame: 11
|
|
return UserStore.getCurrentUser()?.avatar == null;
|
|
}
|
|
|
|
function* _fun121319() { // fn#121319, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15999:669, offset: 0x025448a9, size: 106 bytes, params: 1, frame: 13
|
|
var NativePermissionManager;
|
|
var value5;
|
|
if (false) {
|
|
return undefined;
|
|
}
|
|
value = environment.__proto__;
|
|
const isIOS2 = env1_0(env1_2[9]).isIOS();
|
|
const value4 = !!isIOS2;
|
|
if (isIOS2) {
|
|
NativePermissionManager = env1_4.NativePermissionManager;
|
|
yield NativePermissionManager.getNotificationAuthorizationStatus();
|
|
value5 = undefined;
|
|
if (false) {
|
|
return value5;
|
|
}
|
|
return value5 !== env1_11.AUTHORIZED;
|
|
}
|
|
return value4;
|
|
}
|
|
|
|
function* _fun121322() { // fn#121322, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15999:883, offset: 0x0254491e, size: 93 bytes, params: 1, frame: 12
|
|
var environment;
|
|
if (false) {
|
|
return undefined;
|
|
}
|
|
value = environment.__proto__;
|
|
const binding = env1_6;
|
|
const getLocalAccount = binding.getLocalAccount;
|
|
const CONTACTS = env1_8.CONTACTS;
|
|
value = Reflect.apply(getLocalAccount, binding, [CONTACTS]);
|
|
const r1 = value != null && value.friendSync;
|
|
if (r1) {
|
|
return !r1;
|
|
}
|
|
yield shouldSkipContactSyncStep();
|
|
value = undefined;
|
|
if (false) {
|
|
return value;
|
|
}
|
|
return !value;
|
|
}
|
|
|
|
function transitionStep() { // fn#121327, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15999:1325, offset: 0x025449ae, size: 49 bytes, params: 1, frame: 13
|
|
(importDefault(694) /* metro dependency 694: Dispatcher */).dispatch({type: 'DEFERRED_INVITE_SHOW'});
|
|
}
|
|
|
|
function getKeyForOnboardingStep(a0) { // fn#121328, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15999:2489, offset: 0x025449df, size: 32 bytes, params: 2, frame: 3
|
|
return env0_14[a0]?.key;
|
|
}
|
|
|
|
function continueToNextStep(a0, a1) { // fn#121329, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15999:2588, offset: 0x025449ff, size: 88 bytes, params: 3, frame: 16
|
|
const env0_0 = a1;
|
|
const property = env0_14[a0];
|
|
const value = undefined;
|
|
const key = property == null ? value : property.key;
|
|
if (key !== null) {
|
|
a1.navigate(key, {});
|
|
global.setTimeout(_fun121330, 500);
|
|
}
|
|
return value;
|
|
}
|
|
|
|
function* _fun121311() { // fn#121311, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15999:456, offset: 0x02544549, size: 149 bytes, params: 1, frame: 16
|
|
var r3;
|
|
var value5;
|
|
var value6;
|
|
var value8;
|
|
if (false) {
|
|
return undefined;
|
|
}
|
|
value = environment.__proto__.__proto__;
|
|
const isContactSyncAvailable2 = env2_0(env2_2[8]).isContactSyncAvailable();
|
|
const value4 = !isContactSyncAvailable2;
|
|
if (isContactSyncAvailable2) {
|
|
value5 = env2_0(env2_2[8]);
|
|
yield value5.checkContactPermissions();
|
|
value6 = undefined;
|
|
if (false) {
|
|
return value6;
|
|
}
|
|
value8 = value6 === env2_10.UNAUTHORIZED;
|
|
if (value8) {
|
|
value = env2_0(env2_2[9]);
|
|
value = value.isIOS();
|
|
r3 = value;
|
|
} else {
|
|
r3 = value8;
|
|
}
|
|
return r3;
|
|
}
|
|
return value4;
|
|
}
|
|
|
|
async function _fun121316() { // fn#121316, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15999:1789, offset: 0x025446fb, size: 380 bytes, params: 1, frame: 26
|
|
var object;
|
|
let value = a0;
|
|
if (false) {
|
|
return undefined;
|
|
}
|
|
const value4 = undefined;
|
|
const r15 = value !== value4 ? value : false;
|
|
await value4;
|
|
if (false) {
|
|
return undefined;
|
|
}
|
|
value = environment.__proto__.__proto__;
|
|
let property = env2_14[a1];
|
|
let key = property == null ? value4 : property.key;
|
|
const r5 = key ?? 'registration';
|
|
const value7 = a2 + 1;
|
|
if (value7 >= env2_14.length) {
|
|
env2_16(r5);
|
|
return {lastShownStepIndex: a1, onboardingStepIndex: value7, continueNavigation: false};
|
|
}
|
|
property = env2_14[value7];
|
|
key = property.key;
|
|
const shouldShowStep = property.shouldShowStep;
|
|
const transitionStep = property.transitionStep;
|
|
await shouldShowStep();
|
|
const value8 = undefined;
|
|
if (false) {
|
|
return value8;
|
|
}
|
|
if (value8) {
|
|
env2_0(env2_2[13]).trackNUFStep(r5, key, {skip: r15});
|
|
if (transitionStep != null) {
|
|
env2_16(key);
|
|
env2_1(env2_2[11]).wait(transitionStep);
|
|
object = {lastShownStepIndex: value7, onboardingStepIndex: value7, continueNavigation: false};
|
|
} else {
|
|
property = env2_14[value7];
|
|
object = {lastShownStepIndex: value7, onboardingStepIndex: value7,
|
|
continueNavigation: (property == null ? value4 : property.transitionStep) == null};
|
|
}
|
|
return object;
|
|
}
|
|
await env2_17(r15, a1, value7);
|
|
value = undefined;
|
|
if (false) {
|
|
}
|
|
return value;
|
|
}
|
|
|
|
function shouldSkipContactSyncStep() { // fn#121323, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15999:969, offset: 0x0254497b, size: 30 bytes, params: 1, frame: 13
|
|
return env2_15.apply(this, arguments);
|
|
}
|
|
|
|
function _fun121330() { // fn#121330, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15999:2697, offset: 0x02544a57, size: 142 bytes, params: 1, frame: 16
|
|
var items2;
|
|
var dispatch;
|
|
var CommonActions;
|
|
var reset;
|
|
var object2;
|
|
const state = require.getState();
|
|
const routes = state.routes;
|
|
if (routes.length === 2) {
|
|
items2 = [routes[1]];
|
|
dispatch = require.dispatch;
|
|
value = environment.__proto__;
|
|
CommonActions = (require(1485) /* metro dependency 1485 */).CommonActions;
|
|
reset = CommonActions.reset;
|
|
object2 = {};
|
|
copyDataProperties(object2, state, items2);
|
|
object2['routes'] = items2;
|
|
object2['index'] = 0;
|
|
Reflect.apply(dispatch, require, [Reflect.apply(reset, CommonActions, [object2])]);
|
|
}
|
|
}
|
|
|