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

🐛 Backwards Compat Fix for New Onboarding #1056

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
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
Loading