Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

Commit

Permalink
Added check if animal or user is deleted but notification is still un…
Browse files Browse the repository at this point in the history
…read.
  • Loading branch information
labm1997 committed May 18, 2021
1 parent 5b10146 commit 04ac646
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/pages/NotificationsList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,28 +45,32 @@ export default function NotificationsList() : JSX.Element {
);

const notificationRenderer = (notification: (NotificationModels)): JSX.Element => {
// eslint-disable-next-line camelcase
const fromName = notification.from.data()?.full_name || 'Usuário deletado';
switch (notification.type) {
case NotificationType.adoptionInterest:
{
const animalName = notification.animal.data()?.name || 'Animal deletado';
return (
<TouchableOpacity
onPress={() => {
navigation.navigate('AnimalDetails', { animalUID: notification.animal.id });
}}
>
<Text>{notification.from.data().full_name} está interessado no seu pet {notification.animal.data().name}</Text>
<Text>{fromName} está interessado no seu pet {animalName}</Text>
</TouchableOpacity>
);
}
case NotificationType.adoptionRefused:
{
const animalName = notification.animal.data()?.name || 'Animal deletado';
return (
<TouchableOpacity
onPress={() => {
navigation.navigate('AnimalDetails', { animalUID: notification.animal.id });
}}
>
<Text>{notification.from.data().full_name} recusou sua solicitação ao pet {notification.animal.data().name}</Text>
<Text>{fromName} recusou sua solicitação ao pet {animalName}</Text>
</TouchableOpacity>
);
}
Expand Down

0 comments on commit 04ac646

Please sign in to comment.