diff --git a/src/libs/AccountUtils.ts b/src/libs/AccountUtils.ts index b5b58bfbf70c..2d44e4d5ec8f 100644 --- a/src/libs/AccountUtils.ts +++ b/src/libs/AccountUtils.ts @@ -5,9 +5,6 @@ import type {Account} from '@src/types/onyx'; const isValidateCodeFormSubmitting = (account: OnyxEntry) => !!account?.isLoading && account.loadingForm === (account.requiresTwoFactorAuth ? CONST.FORMS.VALIDATE_TFA_CODE_FORM : CONST.FORMS.VALIDATE_CODE_FORM); -/** Whether the accound ID is an odd number, useful for A/B testing. */ -const isAccountIDOddNumber = (accountID: number) => accountID % 2 === 1; - function isDelegateOnlySubmitter(account: OnyxEntry): boolean { const delegateEmail = account?.delegatedAccess?.delegate; const delegateRole = account?.delegatedAccess?.delegates?.find((delegate) => delegate.email === delegateEmail)?.role; @@ -15,4 +12,4 @@ function isDelegateOnlySubmitter(account: OnyxEntry): boolean { return delegateRole === CONST.DELEGATE_ROLE.SUBMITTER; } -export default {isValidateCodeFormSubmitting, isAccountIDOddNumber, isDelegateOnlySubmitter}; +export default {isValidateCodeFormSubmitting, isDelegateOnlySubmitter}; diff --git a/src/libs/Permissions.ts b/src/libs/Permissions.ts index b0591d1ad42b..1d3428dfcfce 100644 --- a/src/libs/Permissions.ts +++ b/src/libs/Permissions.ts @@ -1,6 +1,9 @@ import type {OnyxEntry} from 'react-native-onyx'; import CONST from '@src/CONST'; import type Beta from '@src/types/onyx/Beta'; +import * as SessionUtils from './SessionUtils'; + +const isAccountIDEven = (accountID: number) => accountID % 2 === 0; function canUseAllBetas(betas: OnyxEntry): boolean { return !!betas?.includes(CONST.BETAS.ALL); @@ -26,9 +29,10 @@ function canUseCategoryAndTagApprovers(betas: OnyxEntry): boolean { return !!betas?.includes(CONST.BETAS.CATEGORY_AND_TAG_APPROVERS) || canUseAllBetas(betas); } -function canUseCombinedTrackSubmit(betas: OnyxEntry): boolean { +function canUseCombinedTrackSubmit(): boolean { // We don't need to show this to all betas since this will be used for developing a feature for A/B testing. - return !!betas?.includes(CONST.BETAS.COMBINED_TRACK_SUBMIT); + const session = SessionUtils.getSession(); + return isAccountIDEven(session?.accountID ?? -1); } function canUsePerDiem(betas: OnyxEntry): boolean { diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 4d8556da46ab..00e2c283e934 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -7321,7 +7321,7 @@ function canCreateRequest(report: OnyxEntry, policy: OnyxEntry, } const requestOptions = getMoneyRequestOptions(report, policy, participantAccountIDs); - if (Permissions.canUseCombinedTrackSubmit(allBetas ?? [])) { + if (Permissions.canUseCombinedTrackSubmit()) { requestOptions.push(CONST.IOU.TYPE.CREATE); } diff --git a/src/libs/actions/Report.ts b/src/libs/actions/Report.ts index a0441e729582..e3eb839fe1d8 100644 --- a/src/libs/actions/Report.ts +++ b/src/libs/actions/Report.ts @@ -96,7 +96,6 @@ import type {Route} from '@src/ROUTES'; import ROUTES from '@src/ROUTES'; import INPUT_IDS from '@src/types/form/NewRoomForm'; import type { - Beta, InvitedEmailsToAccountIDs, NewGroupChatDraft, PersonalDetailsList, @@ -280,12 +279,6 @@ Onyx.connect({ callback: (value) => (allReportDraftComments = value), }); -let allBetas: OnyxEntry; -Onyx.connect({ - key: ONYXKEYS.BETAS, - callback: (value) => (allBetas = value), -}); - let environmentURL: string; Environment.getEnvironmentURL().then((url: string) => (environmentURL = url)); @@ -3431,7 +3424,7 @@ function completeOnboarding( userReportedIntegration?: OnboardingAccountingType, ) { // If the user has the "combinedTrackSubmit" beta enabled we'll show different tasks for track and submit expense. - if (Permissions.canUseCombinedTrackSubmit(allBetas)) { + if (Permissions.canUseCombinedTrackSubmit()) { if (engagementChoice === CONST.ONBOARDING_CHOICES.PERSONAL_SPEND) { // eslint-disable-next-line no-param-reassign data = CONST.COMBINED_TRACK_SUBMIT_ONBOARDING_MESSAGES[CONST.ONBOARDING_CHOICES.PERSONAL_SPEND];