From 08481315d1f12520e92744128ee3f600194af53e Mon Sep 17 00:00:00 2001 From: Sebastian Barry <61334340+sebastianbarry@users.noreply.github.com> Date: Thu, 29 Feb 2024 10:37:11 -0700 Subject: [PATCH] Moved raw_data_use backwards compat hack Moved backwards compat hack to fill in the raw_data_use for programs that don't have it to PrivacyPolicy.tsx, from ProfileSettings.tsx so that the privacy policy is updated for the login screen, and it carries over to the Profile settings screen. --- www/js/control/ProfileSettings.tsx | 9 --------- www/js/onboarding/PrivacyPolicy.tsx | 11 +++++++++++ 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/www/js/control/ProfileSettings.tsx b/www/js/control/ProfileSettings.tsx index 4a33a6a68..9a639dd20 100644 --- a/www/js/control/ProfileSettings.tsx +++ b/www/js/control/ProfileSettings.tsx @@ -131,15 +131,6 @@ const ProfileSettings = () => { function whenReady(newAppConfig: AppConfig) { const tempUiConfig = newAppConfig; - // backwards compat hack to fill in the raw_data_use for programs that don't have it - const default_raw_data_use = { - en: `to monitor the ${tempUiConfig.intro.program_or_study}, send personalized surveys or provide recommendations to participants`, - es: `para monitorear el ${tempUiConfig.intro.program_or_study}, enviar encuestas personalizadas o proporcionar recomendaciones a los participantes`, - }; - Object.entries(tempUiConfig.intro.translated_text).forEach(([lang, val]) => { - val.raw_data_use = val.raw_data_use || default_raw_data_use[lang]; - }); - // Backwards compat hack to fill in the `app_required` based on the // old-style "program_or_study" // remove this at the end of 2023 when all programs have been migrated over diff --git a/www/js/onboarding/PrivacyPolicy.tsx b/www/js/onboarding/PrivacyPolicy.tsx index 8287595c9..8fe12961d 100644 --- a/www/js/onboarding/PrivacyPolicy.tsx +++ b/www/js/onboarding/PrivacyPolicy.tsx @@ -36,6 +36,17 @@ const PrivacyPolicy = () => { ); } + // backwards compat hack to fill in the raw_data_use for programs that don't have it + if (appConfig?.intro) { + const default_raw_data_use = { + en: `monitor the ${appConfig?.intro?.program_or_study}, send personalized surveys or provide recommendations to participants`, + es: `monitorear el ${appConfig?.intro?.program_or_study}, enviar encuestas personalizadas o proporcionar recomendaciones a los participantes`, + }; + Object.entries(appConfig?.intro?.translated_text).forEach(([lang, val]: [string, any]) => { + val.raw_data_use = val.raw_data_use || default_raw_data_use[lang]; + }); + } + const templateText = useMemo(() => getTemplateText(appConfig, i18n.language), [appConfig]); return (