From bce6c8570b72be7dbac88145664bd070134d11a0 Mon Sep 17 00:00:00 2001 From: benguedj <71835422+benguedj@users.noreply.github.com> Date: Mon, 13 May 2024 10:46:16 +0200 Subject: [PATCH 1/3] Rebase master (#1746) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: release (#1732) * fix: add CNPG prod cluster (#1729) * fix: add CNPG prod cluster * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * Update values.yaml * fix * fix * fix * fix * chore: fix preprod workflow * fix: release * chore(release): version 1.135.1 * release ([#1732](https://github.com/SocialGouv/1000jours/issues/1732)) ([8393d46](https://github.com/SocialGouv/1000jours/commit/8393d46e007c9d9dec23e3f0febca7cdd24b3629)), closes [#1729](https://github.com/SocialGouv/1000jours/issues/1729) * chore(release): version 1.135.2 * add CNPG prod cluster ([#1729](https://github.com/SocialGouv/1000jours/issues/1729)) ([4b74272](https://github.com/SocialGouv/1000jours/commit/4b74272b1384654235fbbc6c75200e0830961496)) * allow metabse ingress ([#1733](https://github.com/SocialGouv/1000jours/issues/1733)) ([1f841e1](https://github.com/SocialGouv/1000jours/commit/1f841e1b24023966219c6fcf81c1f50f5d10de74)) * release ([dffeb6c](https://github.com/SocialGouv/1000jours/commit/dffeb6c31befe7a36db59bdcd34c61cd8cfb7904)) * fix: 🐛 Corrige la navigation vers les articles depuis calendar * fix(ci): restore from cnpg (#1736) * fix: restore from CNPG * fix: reset dbs on dev/preprod deploys * fix * fix * fix * fix * fix * fix * Update values.yaml * Update values.yaml * Update values.yaml * fix(cnpg): use fixed name DB * fix(restore): use defaults recovery user (#1738) * fix(restore): use defaults recovery user * Update values.yaml * Update values.yaml * Update values.yaml * fix(cnpg): disable preprod backups for real * fix: Corrige les notifications articles et certaines redirections vers les articles * chore: change le numéro de version (v1.1.98) * chore(release): version 1.135.3 * Corrige les notifications articles et certaines redirections vers les articles ([5364e89](https://github.com/SocialGouv/1000jours/commit/5364e89de2b1261439882ac7e47c141a8ea16e2d)) * **ci:** restore from cnpg ([#1736](https://github.com/SocialGouv/1000jours/issues/1736)) ([fb94763](https://github.com/SocialGouv/1000jours/commit/fb947636a6f892534ad757383e89d4d41dd61843)) * **cnpg:** disable preprod backups for real ([67ea71b](https://github.com/SocialGouv/1000jours/commit/67ea71b94d827c1053da6cc37cfa718180c766d5)) * **cnpg:** use fixed name DB ([e5073fb](https://github.com/SocialGouv/1000jours/commit/e5073fbd31fee8fb79eb3765852e26dbd0441b65)) * **restore:** use defaults recovery user ([#1738](https://github.com/SocialGouv/1000jours/issues/1738)) ([c230ef1](https://github.com/SocialGouv/1000jours/commit/c230ef1b868ccdd13eedf115017ae171e36ce946)) * 🐛 Corrige la navigation vers les articles depuis calendar ([b0904c0](https://github.com/SocialGouv/1000jours/commit/b0904c032d1262bf6ec586ccad97fa30e3b845a5)) * fix: yarn berry + fetch + docker opti (#1739) * fix: 🐛 Corrige la redirection vers les articles depuis les tnd * chore(release): version 1.135.4 * 🐛 Corrige la redirection vers les articles depuis les tnd ([2e1a2d7](https://github.com/SocialGouv/1000jours/commit/2e1a2d75e315620b912ec189cc6d35cb01b8738e)) * yarn berry + fetch + docker opti ([#1739](https://github.com/SocialGouv/1000jours/issues/1739)) ([772e4ca](https://github.com/SocialGouv/1000jours/commit/772e4ca24378629017a4b86e51d8fc24a9f23891)) * chore(release): version 1.135.5 * 🐛 Corrige la redirection vers les articles depuis les tnd ([ad155a0](https://github.com/SocialGouv/1000jours/commit/ad155a00a61404e1fb291ad5f7df6e271da59aaa)) * Corrige les notifications articles et certaines redirections vers les articles ([e2ab03f](https://github.com/SocialGouv/1000jours/commit/e2ab03f01d8deeb992483018264480b5ba08608d)) * yarn berry + fetch + docker opti ([#1739](https://github.com/SocialGouv/1000jours/issues/1739)) ([204a176](https://github.com/SocialGouv/1000jours/commit/204a1768b78a743d666def2aa715e46299efc0cc)) * **ci:** restore from cnpg ([#1736](https://github.com/SocialGouv/1000jours/issues/1736)) ([8cb13d5](https://github.com/SocialGouv/1000jours/commit/8cb13d53d5a375f357b7ed165922621f1a32eb66)) * **cnpg:** disable preprod backups for real ([0a313f0](https://github.com/SocialGouv/1000jours/commit/0a313f028d3d80395b4d6bd5d78824eba7503d03)) * **cnpg:** use fixed name DB ([8f8796c](https://github.com/SocialGouv/1000jours/commit/8f8796cd82205d403b12636e4a0995941cff3df1)) * **restore:** use defaults recovery user ([#1738](https://github.com/SocialGouv/1000jours/issues/1738)) ([3cefc73](https://github.com/SocialGouv/1000jours/commit/3cefc73649ee5d292c29875bd638bfebd233fd79)) * 🐛 Corrige la navigation vers les articles depuis calendar ([5bcfd15](https://github.com/SocialGouv/1000jours/commit/5bcfd15e745a2e89ba06a44b8eb7eb19ee9df4fc)) * feat: ajoute un champ dans la config pour activer zeroAccident * chore(release): version 1.136.0 * ajoute un champ dans la config pour activer zeroAccident ([bf2ce24](https://github.com/SocialGouv/1000jours/commit/bf2ce2443c03cda78f8826b5f6a66a2571beffd3)) * feat: ajoute un flag zeroAccident sur les articles * chore(release): version 1.137.0 * ajoute un flag zeroAccident sur les articles ([a782dc6](https://github.com/SocialGouv/1000jours/commit/a782dc618641ede29c43cf4f468d1adea67b13d5)) * chore(release): version 1.138.0 * ajoute un champ dans la config pour activer zeroAccident ([c31e085](https://github.com/SocialGouv/1000jours/commit/c31e0853c852b559982e642851a9d14d9d3a52f4)) * ajoute un flag zeroAccident sur les articles ([29ee0fd](https://github.com/SocialGouv/1000jours/commit/29ee0fdc549103b7a68fca62b12c5db1a4b22e6c)) * zeroaaccident ([438aab0](https://github.com/SocialGouv/1000jours/commit/438aab05081a50bd0bdd80d5e93d5f16b6f0755d)) * chore(release): version 1.138.1 * Expo build iOS ([1b5b9ff](https://github.com/SocialGouv/1000jours/commit/1b5b9ffad7ff804dda503188beb293ca62ca68fa)) * chore(release): version 1.138.2 * 🐛 Politique de confidentialité 2024 ([5661675](https://github.com/SocialGouv/1000jours/commit/5661675fb24f367ab51b595fc109998bb7c1ed4f)) * chore(release): version 1.139.0 * 🐛 Ajoute les liens de l'app ZéroAccident ([a75f778](https://github.com/SocialGouv/1000jours/commit/a75f77888ca32dbcdc4adfdc429c2c034b873203)) * 🎸 Ajoute un champ 'note' pour l'annuaire 1000j blues ([c1e552c](https://github.com/SocialGouv/1000jours/commit/c1e552ce0e4660e1bfec45f590114081fd192cce)) * chore(release): version 1.140.0 * **recosante:** add recosante widget on evaluation page ([#1742](https://github.com/SocialGouv/1000jours/issues/1742)) ([dafc7be](https://github.com/SocialGouv/1000jours/commit/dafc7bef7e5a43c2fe01452636baa1e856639dd6)) * chore(release): version 1.140.1 * add info dev (expoUpdates enabled) ([00d337c](https://github.com/SocialGouv/1000jours/commit/00d337cbe6070c97e1a2b413c7362351cb3640e3)) * feat: add contact type for widget epds --------- Co-authored-by: Julien Bouquillon Co-authored-by: semantic-release-bot Co-authored-by: Jo --- CHANGELOG.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a01209884..49e49a6aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,8 @@ ## [1.141.2](https://github.com/SocialGouv/1000jours/compare/v1.141.1...v1.141.2) (2024-07-08) - ### Bug Fixes -* change type whatsapp_redirect_message to richtext ([#1755](https://github.com/SocialGouv/1000jours/issues/1755)) ([1094147](https://github.com/SocialGouv/1000jours/commit/1094147f4c8042e28e013f6c9f8b41be18bc7134)) +- change type whatsapp_redirect_message to richtext ([#1755](https://github.com/SocialGouv/1000jours/issues/1755)) ([1094147](https://github.com/SocialGouv/1000jours/commit/1094147f4c8042e28e013f6c9f8b41be18bc7134)) ## [1.141.1](https://github.com/SocialGouv/1000jours/compare/v1.141.0...v1.141.1) (2024-07-03) From ec6e996c6ad334af1e1e3da183fcd0c51a3c018e Mon Sep 17 00:00:00 2001 From: Benjamin Guedj Date: Mon, 22 Jul 2024 10:39:25 +0200 Subject: [PATCH 2/3] =?UTF-8?q?fix:=20Mise=20=C3=A0=20jour=20des=20notific?= =?UTF-8?q?ations=20apr=C3=A8s=20changement=20de=20profil?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../baseComponents/loader.component.tsx | 4 +- .../profile.component.tsx | 329 ++++++++++-------- 2 files changed, 184 insertions(+), 149 deletions(-) diff --git a/front/src/components/baseComponents/loader.component.tsx b/front/src/components/baseComponents/loader.component.tsx index b679cb6db..e25b90aad 100644 --- a/front/src/components/baseComponents/loader.component.tsx +++ b/front/src/components/baseComponents/loader.component.tsx @@ -15,11 +15,11 @@ const Loader: React.FC = ({ backdrop = true }) => { presentationStyle="overFullScreen" transparent={true} > - + {/* */} - + {/* */} ) : ( diff --git a/front/src/screens/onboardingAndProfile/profile.component.tsx b/front/src/screens/onboardingAndProfile/profile.component.tsx index ddceb928f..64d851353 100644 --- a/front/src/screens/onboardingAndProfile/profile.component.tsx +++ b/front/src/screens/onboardingAndProfile/profile.component.tsx @@ -21,6 +21,7 @@ import { CommonText, CustomButton, Datepicker, + GraphQLLoader, Icomoon, IcomoonIcons, SecondaryText, @@ -28,6 +29,8 @@ import { } from "../../components/baseComponents"; import TrackerHandler from "../../components/tracker/trackerHandler.component"; import { + CalendarDbQueries, + FetchPoliciesConstants, Formats, Labels, PlatformConstants, @@ -36,6 +39,7 @@ import { import { USER_SITUATIONS } from "../../constants/profile.constants"; import { Colors, FontWeight, Margins, Paddings, Sizes } from "../../styles"; import type { + Event, ProfileGender, RootStackParamList, UserContext, @@ -48,8 +52,11 @@ import { TndNotificationUtils, TrackerUtils, } from "../../utils"; -import { NotificationType } from "../../utils/notifications/notification.util"; +import { NotificationType, cancelScheduleEventsNotification, getAllNotificationsByType, scheduleEventsNotification } from "../../utils/notifications/notification.util"; import { checkErrorOnProfile } from "../../utils/step/step.util"; +import { useEvents } from "../../hooks"; +import { gql, useLazyQuery, useQuery } from "@apollo/client"; +import { formattedEvents } from "../../utils/events/event.util"; interface Props { navigation: StackNavigationProp; @@ -109,6 +116,23 @@ const Profile: FC = ({ navigation }) => { setGender(genderStored ?? genderEmpty); }; + const [fetchEvents, { loading, error, data, called, refetch }] = useLazyQuery( + gql(CalendarDbQueries.ALL_EVENTS), + { + fetchPolicy: FetchPoliciesConstants.CACHE_AND_NETWORK, + onCompleted: async (data) => { + const evenements = (data as { evenements: Event[] }).evenements; + const events = formattedEvents(evenements, childBirthday); + await cancelScheduleEventsNotification(); + await scheduleEventsNotification(events); + navigateToRoot(); + }, + onError: (e: any) => { + console.warn(e); + }, + } + ); + useEffect(() => { const initDataWithStorageValue = async () => { const userSituationsStored = (await StorageUtils.getObjectValue( @@ -192,9 +216,10 @@ const Profile: FC = ({ navigation }) => { const validateForm = useCallback(async () => { const checkedUserSituation = StepUtils.getCheckedUserSituationOrUndefined(userSituations); - const error = checkErrorOnProfile(checkedUserSituation, childBirthday); - if (error) { - Alert.alert(Labels.warning, error, [{ text: "OK" }]); + const errorOnProfile = checkErrorOnProfile(checkedUserSituation, childBirthday); + + if (errorOnProfile) { + Alert.alert(Labels.warning, errorOnProfile, [{ text: "OK" }]); return; } @@ -235,7 +260,6 @@ const Profile: FC = ({ navigation }) => { const notifs = await NotificationUtils.getAllNotificationsByType( NotificationType.tnd ); - console.log(notifs); const isFirstTime = notifs.length === 0; void TndNotificationUtils.scheduleTndNotifications( childBirthday, @@ -249,7 +273,12 @@ const Profile: FC = ({ navigation }) => { // Annule la notification 'NextStep' et supprime les données concernant l'étape courante await resetNextStep(); - navigateToRoot(); + if(checkedUserSituation?.childBirthdayRequired && childBirthday) { + await fetchEvents(); + } else { + await cancelScheduleEventsNotification(); + navigateToRoot(); + } }, [childBirthday, navigateToRoot, userSituations, gender]); const scrollViewRef = React.useRef(null); @@ -293,161 +322,167 @@ const Profile: FC = ({ navigation }) => { }; return ( - - - - - - - - - - - - - {Labels.profile.title} - - - {Labels.profile.subTitle} - - - {userSituations.map((situation, index) => ( - - - - {situation.label} - - - - {situation.isChecked && - situation.childBirthdayRequired && - datePickerIsReady && ( - - - {situation.childBirthdayLabel} - - - 0 - ? new Date(childBirthday) - : undefined - } - onChange={onUpdatedDate} - color={Colors.primaryYellow} - /> - - - )} - - - ))} - - - - {`${Labels.profile.gender.select} :`} + <> + {loading ? + : null + } + + + + + + + + + + + + + + {Labels.profile.title} + + + {Labels.profile.subTitle} - - {genders.map((item, index) => ( - + + {userSituations.map((situation, index) => ( + - - {item.label} - + {situation.label} + + + {situation.isChecked && + situation.childBirthdayRequired && + datePickerIsReady && ( + + + {situation.childBirthdayLabel} + + + 0 + ? new Date(childBirthday) + : undefined + } + onChange={onUpdatedDate} + color={Colors.primaryYellow} + /> + + + )} + ))} - - - - - - } - action={onCloseButtonPressed} - /> - - - + + + {`${Labels.profile.gender.select} :`} + + + {genders.map((item, index) => ( + + + + {item.label} + + + + ))} + + + + + + + } + action={onCloseButtonPressed} + /> + + + + - - - + + + ); }; From e2405d7443e150f3e7205fb4c301633ad7ad5289 Mon Sep 17 00:00:00 2001 From: Benjamin Guedj Date: Mon, 22 Jul 2024 10:40:27 +0200 Subject: [PATCH 3/3] =?UTF-8?q?chore:=20Change=20le=20num=C3=A9ro=20de=20v?= =?UTF-8?q?ersion=20(v1.1.107)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- front/app.config.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/front/app.config.js b/front/app.config.js index f8c3721f2..de4393766 100644 --- a/front/app.config.js +++ b/front/app.config.js @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/naming-convention */ -const APP_VERSION = "1.1.106"; -const APP_VERSION_NUM = 106; +const APP_VERSION = "1.1.107"; +const APP_VERSION_NUM = 107; export default { expo: {