Skip to content

Commit

Permalink
pushnotify relies on events now
Browse files Browse the repository at this point in the history
moving to event-driven paradigm, so we don't call the method from pushNotify directly. this will apply to storedevicesettings once it gets migrated
  • Loading branch information
Abby Wheelis committed Nov 1, 2023
1 parent 5fbeac2 commit c406988
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 0 additions & 1 deletion www/js/onboarding/ProtocolPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { resetDataAndRefresh } from '../config/dynamicConfig';
import { AppContext } from '../App';
import PrivacyPolicy from './PrivacyPolicy';
import { onboardingStyles } from './OnboardingStack';
import { markConsented } from '../splash/startprefs';
import { setProtocolDone } from './onboardingHelper';

const ProtocolPage = () => {
Expand Down
8 changes: 5 additions & 3 deletions www/js/splash/startprefs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { getAngularService } from "../angular-react-helper";
import { storageGet, storageSet } from '../plugin/storage';
import { logInfo, logDebug, displayErrorMsg } from '../plugin/logger';
import { readIntroDone } from "../onboarding/onboardingHelper";
import { EVENT_NAMES, publish } from "../customEventHandler";

// data collection consented protocol: string, represents the date on
// which the consented protocol was approved by the IRB
Expand Down Expand Up @@ -37,15 +38,16 @@ export function markConsented() {
_req_consent);
// mark in local variable as well
_curr_consented = { ..._req_consent };
// publish event
publish(EVENT_NAMES.CONSENTED_EVENT, _req_consent);
})
//check for reconsent
.then(readIntroDone)
.then((isIntroDone) => {
if (isIntroDone) {
logDebug("reconsent scenario - marked consent after intro done - registering pushnoify and storing device settings")
const PushNotify = getAngularService("PushNotify");
logDebug("reconsent scenario - marked consent after intro done - registering pushnoify and storing device settings");
//pushnotify uses events now
const StoreSeviceSettings = getAngularService("StoreDeviceSettings");
PushNotify.registerPush();
StoreSeviceSettings.storeDeviceSettings();
}
})
Expand Down

0 comments on commit c406988

Please sign in to comment.