diff --git a/www/js/config/dynamicConfig.ts b/www/js/config/dynamicConfig.ts index f706302ad..312f02c0b 100644 --- a/www/js/config/dynamicConfig.ts +++ b/www/js/config/dynamicConfig.ts @@ -191,6 +191,7 @@ function loadNewConfig(newToken, existingVersion = null) { const storeConfigPromise = window['cordova'].plugins.BEMUserCache.putRWDocument( CONFIG_PHONE_UI, toSaveConfig); const storeInKVStorePromise = KVStore.set(CONFIG_PHONE_UI_KVSTORE, toSaveConfig); + logDebug("UI_CONFIG: about to store " + JSON.stringify(toSaveConfig)); // loaded new config, so it is both ready and changed return Promise.all([storeConfigPromise, storeInKVStorePromise]).then( ([result, kvStoreResult]) => { @@ -232,12 +233,14 @@ export function getConfig() { const KVStore = getAngularService('KVStore'); return KVStore.get(CONFIG_PHONE_UI_KVSTORE).then((config) => { if (config && Object.keys(config).length) { + logDebug("Got config from KVStore: " + JSON.stringify(config)); storedConfig = config; return config; } logDebug("No config found in KVStore, fetching from native storage"); return window['cordova'].plugins.BEMUserCache.getDocument(CONFIG_PHONE_UI, false).then((config) => { if (config && Object.keys(config).length) { + logDebug("Got config from native storage: " + JSON.stringify(config)); storedConfig = config; return config; } diff --git a/www/js/onboarding/SaveQrPage.tsx b/www/js/onboarding/SaveQrPage.tsx index 8a3fab92e..67ddd74e2 100644 --- a/www/js/onboarding/SaveQrPage.tsx +++ b/www/js/onboarding/SaveQrPage.tsx @@ -36,8 +36,10 @@ const SaveQrPage = ({ }) => { const KVStore = getAngularService('KVStore'); const EXPECTED_METHOD = "prompted-auth"; const dbStorageObject = {"token": token}; + logDebug("about to login with token"); return KVStore.set(EXPECTED_METHOD, dbStorageObject).then((r) => { CommHelper.registerUser((successResult) => { + logDebug("registered user in CommHelper result " + successResult); refreshOnboardingState(); }, function(errorResult) { displayError(errorResult, "User registration error"); diff --git a/www/js/onboarding/onboardingHelper.ts b/www/js/onboarding/onboardingHelper.ts index cca0da1d4..cfbebb40b 100644 --- a/www/js/onboarding/onboardingHelper.ts +++ b/www/js/onboarding/onboardingHelper.ts @@ -1,6 +1,7 @@ import { DateTime } from "luxon"; import { getAngularService } from "../angular-react-helper"; import { getConfig, resetDataAndRefresh } from "../config/dynamicConfig"; +import { logDebug } from "../plugin/logger"; export const INTRO_DONE_KEY = 'intro_done'; @@ -48,6 +49,9 @@ export function getPendingOnboardingState(): Promise { } else { route = OnboardingRoute.SURVEY; } + + logDebug("pending onboarding state is " + route + " intro, config, consent, qr saved : " + isIntroDone + config + isConsented + saveQrDone); + return { route, opcode: config?.joined?.opcode }; }); }; diff --git a/www/js/plugin/storage.js b/www/js/plugin/storage.js index a14b1db83..e4d23042e 100644 --- a/www/js/plugin/storage.js +++ b/www/js/plugin/storage.js @@ -35,6 +35,7 @@ angular.module('emission.plugin.kvstore', ['emission.plugin.logger', kvstoreJs.set = function(key, value) { // add checks for data type var store_val = mungeValue(key, value); + logger.log("adding key " + key + " and value " + value + " to local storage"); /* * How should we deal with consistency here? Have the threads be * independent so that there is greater chance that one will succeed,