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

Rewrite + test storedevicesettings.js #1079

Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
change "ready" handling
since there is no angular code in this file, can't use $ionicPlatform

instead call the init function from the App code
  • Loading branch information
Abby Wheelis committed Oct 23, 2023
commit 589eca93eac8fb8df59870e9ea6b94e64049c6a1
2 changes: 2 additions & 0 deletions www/js/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { OnboardingRoute, OnboardingState, getPendingOnboardingState } from './o
import { setServerConnSettings } from './config/serverConn';
import AppStatusModal from './control/AppStatusModal';
import usePermissionStatus from './usePermissionStatus';
import { initDeviceSettings } from './splash/storeDeviceSettings';

const defaultRoutes = (t) => [
{ key: 'label', title: t('diary.label-tab'), focusedIcon: 'check-bold', unfocusedIcon: 'check-outline' },
Expand Down Expand Up @@ -48,6 +49,7 @@ const App = () => {
useEffect(() => {
if (!appConfig) return;
setServerConnSettings(appConfig).then(() => {
initDeviceSettings();
refreshOnboardingState();
});
}, [appConfig]);
Expand Down
7 changes: 1 addition & 6 deletions www/js/splash/storedevicesettings.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import { getAngularService } from '../angular-react-helper';
import { updateUser } from '../commHelper';
import { displayError, logDebug, logInfo } from '../plugin/logger';
import { readConsentState, isConsented } from './startprefs';
import { readIntroDone } from '../onboarding/onboardingHelper';
import i18next from 'i18next';

const $ionicPlatform = getAngularService('$ionicPlatform');

let _datacollect;

const storeDeviceSettings = function () {
Expand All @@ -30,7 +27,7 @@ const storeDeviceSettings = function () {
});
}

const initDeviceSettings = function () {
export const initDeviceSettings = function () {
_datacollect = window['cordova'].plugins.BEMDataCollection;
readConsentState()
.then(isConsented)
Expand All @@ -44,8 +41,6 @@ const initDeviceSettings = function () {
logInfo("storedevicesettings startup done");
}

$ionicPlatform.ready().then(initDeviceSettings);

export const afterConsentStore = function () {
console.log("in storedevicesettings, executing after consent is received");
if (readIntroDone()) {
Expand Down