Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define noop implementation of 11+ redirect for desktop app #57328

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 1 addition & 24 deletions src/libs/actions/Welcome/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import * as API from '@libs/API';
import {SIDE_EFFECT_REQUEST_COMMANDS, WRITE_COMMANDS} from '@libs/API/types';
import DateUtils from '@libs/DateUtils';
import Log from '@libs/Log';
import CONST from '@src/CONST';
import type {OnboardingCompanySize} from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import type {OnboardingPurpose} from '@src/types/onyx';
import type Onboarding from '@src/types/onyx/Onboarding';
import type TryNewDot from '@src/types/onyx/TryNewDot';
import {isEmptyObject} from '@src/types/utils/EmptyObject';
import {clearInitialPath} from './OnboardingFlow';
import switchToOldDotOnNonMicroCompanySize from './switchToOldDotOnNonMicroCompanySize';

type OnboardingData = Onboarding | undefined;

Expand Down Expand Up @@ -150,29 +150,6 @@ function completeHybridAppOnboarding() {
});
}

/*
* Decides whether we should set dismissed key to `true` or `false` based on company size
*/
function switchToOldDotOnNonMicroCompanySize(onboardingCompanySize: OnboardingCompanySize) {
if (onboardingCompanySize === CONST.ONBOARDING_COMPANY_SIZE.MICRO) {
return;
}

const optimisticData: OnyxUpdate[] = [
{
onyxMethod: Onyx.METHOD.MERGE,
key: ONYXKEYS.NVP_TRYNEWDOT,
value: {
classicRedirect: {
dismissed: true,
},
},
},
];

API.write(WRITE_COMMANDS.SWITCH_TO_OLD_DOT_ON_COMPANY_SIZE, {onboardingCompanySize}, {optimisticData});
}

Onyx.connect({
key: ONYXKEYS.NVP_ONBOARDING,
callback: (value) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import type SwitchToOldDotOnNonMicroCompanySize from './types';

// We don't want to use this API on desktop, so we just noop here
const switchToOldDotOnNonMicroCompanySize: SwitchToOldDotOnNonMicroCompanySize = () => {};

export default switchToOldDotOnNonMicroCompanySize;
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import type {OnyxUpdate} from 'react-native-onyx';
import Onyx from 'react-native-onyx';
import * as API from '@libs/API';
import {WRITE_COMMANDS} from '@libs/API/types';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import type SwitchToOldDotOnNonMicroCompanySize from './types';

const switchToOldDotOnNonMicroCompanySize: SwitchToOldDotOnNonMicroCompanySize = (onboardingCompanySize) => {
if (onboardingCompanySize === CONST.ONBOARDING_COMPANY_SIZE.MICRO) {
return;
}

const optimisticData: OnyxUpdate[] = [
{
onyxMethod: Onyx.METHOD.MERGE,
key: ONYXKEYS.NVP_TRYNEWDOT,
value: {
classicRedirect: {
dismissed: true,
},
},
},
];

API.write(WRITE_COMMANDS.SWITCH_TO_OLD_DOT_ON_COMPANY_SIZE, {onboardingCompanySize}, {optimisticData});
};

export default switchToOldDotOnNonMicroCompanySize;
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import type {OnboardingCompanySize} from '@src/CONST';

type SwitchToOldDotOnNonMicroCompanySize = (onboardingCompanySize: OnboardingCompanySize) => void;

export default SwitchToOldDotOnNonMicroCompanySize;
6 changes: 1 addition & 5 deletions src/pages/OnboardingEmployees/BaseOnboardingEmployees.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,7 @@ function BaseOnboardingEmployees({shouldUseNativeStyles, route}: BaseOnboardingE
return;
}
setOnboardingCompanySize(selectedCompanySize);

// Redirect is disabled on desktop
if (getPlatform() !== CONST.PLATFORM.DESKTOP) {
switchToOldDotOnNonMicroCompanySize(selectedCompanySize);
}
switchToOldDotOnNonMicroCompanySize(selectedCompanySize);

const shouldCreateWorkspace = !onboardingPolicyID && !paidGroupPolicy;

Expand Down
Loading