/* 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] */ import Module00005 from '../../../by-id/module-00005.js'; /* Metro dependency 5 */ import Dispatcher from '../../../Dispatcher.tsx'; /* Metro dependency 694 */ import UserStore from '../../../stores/UserStore.tsx'; /* Metro dependency 1878 */ import ConnectedAccountsStore from '../../../stores/ConnectedAccountsStore.tsx'; /* Metro dependency 5040 */ import ParentalConsentStore from '../../parent_tools/ParentalConsentStore.tsx'; /* Metro dependency 14316 */ 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 ConstantsModule from '../../../Constants.tsx'; /* Metro dependency 661 */ import * as Router_utilsModule from '../../routing/router_utils.tsx'; /* Metro dependency 1230 */ import * as NavigationRouteUtilsNativeModule from '../../main_tabs_v2/helpers/NavigationRouteUtils.native.tsx'; /* Metro dependency 4007 */ import * as NativePermissionConstantsModule from '../../native_permissions/NativePermissionConstants.tsx'; /* Metro dependency 4661 */ import * as ContactSyncConstantsModule from '../../contact_sync/native/ContactSyncConstants.tsx'; /* Metro dependency 11995 */ import * as NewUserAnalyticsUtilsModule from './NewUserAnalyticsUtils.tsx'; /* Metro dependency 12000 */ import * as NUFActionCreatorsModule from '../NUFActionCreators.tsx'; /* Metro dependency 12043 */ import * as NewUserModalTypesModule from './components/NewUserModalTypes.tsx'; /* Metro dependency 15792 */ 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 const env0_0 = require; const closure = function() { return _getNextOnboardingStep.apply(this, arguments); }; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); const value = Module00005; object = {key: 'choose-avatar', shouldShowStep: shouldShowStep_121317}; const object2 = {key: 'enable-notification'}; const env0_12 = value(_fun121319); object2.shouldShowStep = shouldShowStep_121320; const env0_13 = value(_fun121322); const items2 = [object2, {key: 'contact-sync', shouldShowStep: shouldShowStep_121324}]; items2[2] = {key: 'discoverability', shouldShowStep: function() { return true; }}; items2[3] = object; items2[4] = {key: 'connect-guardian', shouldShowStep: function() { return ParentalConsentStore.getShouldShowGuardianConnect(); }}; object = {key: 'accept-invite'}; object.shouldShowStep = (require(9151) /* metro dependency 9151: InstantInviteUtils */).hasDeferredInvite; object.transitionStep = transitionStep; items2[5] = object; (FileImportTrackerModule).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* _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; } } 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 (NewUserAnalyticsUtilsModule).trackNUFStep(a0, 'NUF Complete'); const isModalOpen = NavigationRouteUtilsNativeModule.isModalOpen; const NEW_USER_MODAL_KEY = (NewUserModalTypesModule).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 transitionTo = Router_utilsModule.transitionTo; const ME = Routes.ME; Reflect.apply(transitionTo, Router_utilsModule, [ME, {navigationReplace: true}]); (NUFActionCreatorsModule).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); 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 object2; 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); object2 = {lastShownStepIndex: value7, onboardingStepIndex: value7, continueNavigation: false}; } else { property = env2_14[value7]; object2 = {lastShownStepIndex: value7, onboardingStepIndex: value7, continueNavigation: (property == null ? value4 : property.transitionStep) == null}; } return object2; } await env2_17(r15, a1, value7); value = undefined; if (false) { } return value; } } 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 shouldShowStep_121320() { // fn#121320, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15999:795, offset: 0x00f29a76, size: 30 bytes, params: 1, frame: 13 return env0_12.apply(this, arguments); } 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 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 shouldShowStep_121324() { // fn#121324, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15999:1070, offset: 0x00f29a05, size: 30 bytes, params: 1, frame: 13 return env0_13.apply(this, arguments); } 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 (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 _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 object; 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; object = {}; copyDataProperties(object, state, items2); object['routes'] = items2; object['index'] = 0; Reflect.apply(dispatch, require, [Reflect.apply(reset, CommonActions, [object])]); } } } } global.__d(_fun121308, 15791, [5, 27, 14316, 5040, 1878, 661, 11995, 4661, 11997, 477, 9151, 694, 1485, 12000, 4007, 15792, 5080, 1230, 12043, 2]) /* metro module 15791, dependencies: [5, 27, 14316, 5040, 1878, 661, 11995, 4661, 11997, 477, 9151, 694, 1485, 12000, 4007, 15792, 5080, 1230, 12043, 2] */;