()
| 98 | } |
| 99 | |
| 100 | function handleUpdateHabit() { |
| 101 | if (notificationToggle === true && !dayNotification && !timeNotification) { |
| 102 | Alert.alert("Você precisa colocar a frequência e horário da notificação"); |
| 103 | } else { |
| 104 | HabitsService.updateHabit({ |
| 105 | habitArea: habit?.habitArea, |
| 106 | habitName: habitInput, |
| 107 | habitFrequency: frequencyInput, |
| 108 | habitHasNotification: notificationToggle, |
| 109 | habitNotificationFrequency: dayNotification, |
| 110 | habitNotificationTime: timeNotification, |
| 111 | habitNotificationId: notificationToggle ? habitInput : null, |
| 112 | }).then(() => { |
| 113 | Alert.alert("Sucesso na atualização do hábito"); |
| 114 | if (!notificationToggle) { |
| 115 | NotificationService.deleteNotification(habit?.habitName); |
| 116 | } else { |
| 117 | NotificationService.deleteNotification(habit?.habitName); |
| 118 | NotificationService.createNotification( |
| 119 | habitInput, |
| 120 | frequencyInput, |
| 121 | dayNotification, |
| 122 | timeNotification |
| 123 | ); |
| 124 | } |
| 125 | |
| 126 | navigation.navigate("Home", { |
| 127 | updatedHabit: `Updated in ${habit?.habitArea}`, |
| 128 | }); |
| 129 | }); |
| 130 | } |
| 131 | } |
| 132 | useEffect(() => { |
| 133 | if (habit?.habitHasNotification == 1) { |
| 134 | setNotificationToggle(true); |
nothing calls this directly
no outgoing calls
no test coverage detected