Skip to content

Commit

Permalink
Merge pull request #1056 from JGreenlee/fix-onboarding-oct5
Browse files Browse the repository at this point in the history
🐛 Backwards Compat Fix for New Onboarding
  • Loading branch information
shankari authored Oct 5, 2023
2 parents 22880c8 + 26bd469 commit 0c5cd0e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion www/js/config/dynamicConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ export function getConfig() {
if (storedConfig) return Promise.resolve(storedConfig);
const KVStore = getAngularService('KVStore');
return KVStore.get(CONFIG_PHONE_UI_KVSTORE).then((config) => {
if (config) {
if (config && Object.keys(config).length) {
storedConfig = config;
return config;
}
Expand Down
9 changes: 8 additions & 1 deletion www/js/onboarding/onboardingHelper.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { DateTime } from "luxon";
import { getAngularService } from "../angular-react-helper";
import { getConfig } from "../config/dynamicConfig";
import { getConfig, resetDataAndRefresh } from "../config/dynamicConfig";

export const INTRO_DONE_KEY = 'intro_done';

Expand Down Expand Up @@ -28,6 +28,13 @@ export const setRegisterUserDone = (b) => registerUserDone = b;
export function getPendingOnboardingState(): Promise<OnboardingState> {
return Promise.all([getConfig(), readConsented(), readIntroDone()]).then(([config, isConsented, isIntroDone]) => {
let route: OnboardingRoute;

// backwards compat - prev. versions might have config cleared but still have intro_done set
if (!config && (isIntroDone || isConsented)) {
resetDataAndRefresh(); // if there's no config, we need to reset everything
return null;
}

if (isIntroDone) {
route = OnboardingRoute.DONE;
} else if (!config) {
Expand Down

0 comments on commit 0c5cd0e

Please sign in to comment.