Skip to content

Commit

Permalink
fix: Putting the load in the onSuccess call of the sendNotification
Browse files Browse the repository at this point in the history
  • Loading branch information
yassine04e committed Dec 19, 2024
1 parent 5f10283 commit d862d89
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,9 @@ fun handleInvitationResponse(

notificationViewModel.sendNotificationToUser(
notification.senderUid, responseNotification)

notificationViewModel.loadNotificationsForUser(
profileViewModel.profile.value.fsUid)
},
onFailure = {
Toast.makeText(context, it.message, Toast.LENGTH_SHORT).show()
Expand All @@ -269,13 +272,14 @@ fun handleInvitationResponse(
Toast.makeText(context, responseMessage, Toast.LENGTH_SHORT).show()
notificationViewModel.sendNotificationToUser(
notification.senderUid, responseNotification)
notificationViewModel.loadNotificationsForUser(
profileViewModel.profile.value.fsUid)
},
onFailure = {
Toast.makeText(context, it.message, Toast.LENGTH_SHORT).show()
chosen()
})
}
notificationViewModel.loadNotificationsForUser(profileViewModel.profile.value.fsUid)
},
onFailure = {
Toast.makeText(context, "Failed to get travel", Toast.LENGTH_SHORT).show()
Expand Down Expand Up @@ -305,6 +309,9 @@ fun handleInvitationResponse(
onSuccess = {
notificationViewModel.sendNotificationToUser(
notification.senderUid, firendNotification)

notificationViewModel.loadNotificationsForUser(
profileViewModel.profile.value.fsUid)
},
onFailure = { Toast.makeText(context, it.message, Toast.LENGTH_LONG).show() })
Toast.makeText(context, "Friend added", Toast.LENGTH_LONG).show()
Expand Down Expand Up @@ -334,6 +341,8 @@ fun handleInvitationResponse(
notification.senderUid, firendNotification)

Toast.makeText(context, "Request declined", Toast.LENGTH_LONG).show()

notificationViewModel.loadNotificationsForUser(profileViewModel.profile.value.fsUid)
},
onFailure = {
chosen()
Expand Down

0 comments on commit d862d89

Please sign in to comment.