From ca3a2c8fcce2aaa613817bde047f143915ef8fe0 Mon Sep 17 00:00:00 2001 From: devthejo Date: Sat, 24 May 2025 15:02:51 +0200 Subject: [PATCH] feat(follow-location): init --- .../SendAlertConfirm/FieldNotifySelector.js | 32 +++++++++++++++++++ src/scenes/SendAlertConfirm/useOnSubmit.js | 11 +++++-- 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/src/scenes/SendAlertConfirm/FieldNotifySelector.js b/src/scenes/SendAlertConfirm/FieldNotifySelector.js index be13701..b016aae 100644 --- a/src/scenes/SendAlertConfirm/FieldNotifySelector.js +++ b/src/scenes/SendAlertConfirm/FieldNotifySelector.js @@ -22,6 +22,7 @@ export default function FieldNotifySelector() { const callEmergency = watch("callEmergency"); const notifyAround = watch("notifyAround"); const notifyRelatives = watch("notifyRelatives"); + const followLocation = watch("followLocation"); const level = watch("level"); const checkedColor = colors.primary; @@ -106,6 +107,29 @@ export default function FieldNotifySelector() { }} /> + + ( + { + setValue("followLocation", !followLocation); + }} + /> + )} + color={checkedColor} + uncheckedColor={uncheckedColor} + label="Suivre ma localisation" + onPress={() => { + setValue("followLocation", !followLocation); + }} + /> + ); } @@ -122,6 +146,7 @@ const useStyles = createStyles( ({ wp, hp, scaleText, fontSize, theme: { colors, textShadowForWhite } }) => ({ container: { marginTop: hp(2), + marginBottom: hp(3), }, checkboxItemContainer: { borderRadius: 4, @@ -130,6 +155,13 @@ const useStyles = createStyles( marginVertical: hp(0.2), backgroundColor: colors.surface, }, + followLocationContainer: { + borderRadius: 4, + borderWidth: 1, + borderColor: colors.outline, + marginVertical: hp(4), + backgroundColor: colors.surface, + }, checkboxItem: { paddingHorizontal: 6, }, diff --git a/src/scenes/SendAlertConfirm/useOnSubmit.js b/src/scenes/SendAlertConfirm/useOnSubmit.js index bdf3418..8cce637 100644 --- a/src/scenes/SendAlertConfirm/useOnSubmit.js +++ b/src/scenes/SendAlertConfirm/useOnSubmit.js @@ -33,8 +33,14 @@ async function onSubmit(args, context) { const [alertInput] = args; const { navigation } = context; - const { subject, level, callEmergency, notifyAround, notifyRelatives } = - alertInput; + const { + subject, + level, + callEmergency, + notifyAround, + notifyRelatives, + followLocation, + } = alertInput; const coords = await getCurrentLocation(); @@ -62,6 +68,7 @@ async function onSubmit(args, context) { callEmergency, notifyAround, notifyRelatives, + followLocation: !!followLocation, location, accuracy, altitude,