Skip to content

Commit

Permalink
Merge pull request #1058 from Abby-Wheelis/auth-logs
Browse files Browse the repository at this point in the history
More token log statements
  • Loading branch information
shankari authored Oct 6, 2023
2 parents 0c5cd0e + 98d7324 commit e77910c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions www/js/config/dynamicConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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]) => {
Expand Down Expand Up @@ -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;
}
Expand Down
2 changes: 2 additions & 0 deletions www/js/onboarding/SaveQrPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
4 changes: 4 additions & 0 deletions www/js/onboarding/onboardingHelper.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand Down Expand Up @@ -48,6 +49,9 @@ export function getPendingOnboardingState(): Promise<OnboardingState> {
} 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 };
});
};
Expand Down
1 change: 1 addition & 0 deletions www/js/plugin/storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit e77910c

Please sign in to comment.