From 03dd1f03c1a3a3614f1a5cd27e0c4d86ec9d75a2 Mon Sep 17 00:00:00 2001 From: Jack Greenlee Date: Wed, 9 Oct 2024 11:45:20 -0400 Subject: [PATCH 1/2] if isConsented, don't re-prompt for optional permissions --- www/js/onboarding/onboardingHelper.ts | 2 +- www/js/usePermissionStatus.ts | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/www/js/onboarding/onboardingHelper.ts b/www/js/onboarding/onboardingHelper.ts index 89e05d9e7..54fd0f1c2 100644 --- a/www/js/onboarding/onboardingHelper.ts +++ b/www/js/onboarding/onboardingHelper.ts @@ -73,7 +73,7 @@ export function getPendingOnboardingState(): Promise { ); } -async function readConsented() { +export async function readConsented() { return readConsentState().then(isConsented) as Promise; } diff --git a/www/js/usePermissionStatus.ts b/www/js/usePermissionStatus.ts index 63ee47e55..5781738fd 100644 --- a/www/js/usePermissionStatus.ts +++ b/www/js/usePermissionStatus.ts @@ -5,9 +5,7 @@ import { useTranslation } from 'react-i18next'; import { useAppTheme } from './appTheme'; import { logDebug, logWarn } from './plugin/logger'; import { AlertManager } from './components/AlertBar'; -import { storageGet } from './plugin/storage'; - -const HAS_REQUESTED_NOTIFS_KEY = 'HasRequestedNotificationPermission'; +import { readConsented } from './onboarding/onboardingHelper'; let DEVICE_PLATFORM: 'android' | 'ios'; let DEVICE_VERSION: number; @@ -368,12 +366,12 @@ const usePermissionStatus = () => { //load when ready useEffect(() => { if (appConfig && window['device']?.platform) { - storageGet(HAS_REQUESTED_NOTIFS_KEY).then((hasRequestedNotifs) => { + readConsented().then((isConsented) => { DEVICE_PLATFORM = window['device'].platform.toLowerCase(); DEVICE_VERSION = window['device'].version.split('.')[0]; setupPermissionText(); logDebug('setting up permissions'); - createChecklist(hasRequestedNotifs); + createChecklist(isConsented); }); } }, [appConfig]); From c9efeb4b745b351df8e4ab144f0b6a67b4b61a90 Mon Sep 17 00:00:00 2001 From: "K. Shankari" Date: Wed, 9 Oct 2024 09:27:41 -0700 Subject: [PATCH 2/2] Bump up the version number to match as well --- package.cordovabuild.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.cordovabuild.json b/package.cordovabuild.json index bc2a3f15b..0a8ef849f 100644 --- a/package.cordovabuild.json +++ b/package.cordovabuild.json @@ -122,7 +122,7 @@ "cordova-plugin-app-version": "0.1.14", "cordova-plugin-customurlscheme": "5.0.2", "cordova-plugin-device": "2.1.0", - "cordova-plugin-em-datacollection": "git+https://github.com/e-mission/e-mission-data-collection.git#v1.9.3", + "cordova-plugin-em-datacollection": "git+https://github.com/e-mission/e-mission-data-collection.git#v1.9.4", "cordova-plugin-em-opcodeauth": "git+https://github.com/e-mission/cordova-jwt-auth.git#v1.7.2", "cordova-plugin-em-server-communication": "git+https://github.com/e-mission/cordova-server-communication.git#v1.2.7", "cordova-plugin-em-serversync": "git+https://github.com/e-mission/cordova-server-sync.git#v1.3.3",