fixing notification bug

This commit is contained in:
talksik
2021-12-25 23:12:40 -08:00
parent 2ab546097a
commit ee4cedf986
2 changed files with 4 additions and 4 deletions
@@ -146,7 +146,7 @@ struct CircleGridView: View {
self.selectedFriendIndex = nil
self.innerCircleVM.stopRecording(senderId: self.authSessionStore.user!.id!, receiver: self.authSessionStore.relevantUsersDict[friendId]!)
self.innerCircleVM.stopRecording(sender: self.authSessionStore.user!, receiver: self.authSessionStore.relevantUsersDict[friendId]!)
// self.recordingGestureDeactived()
}
@@ -65,7 +65,7 @@ extension InnerCircleViewModel {
// sender should be current user
// receiver is the person we are sending to
func stopRecording(senderId:String, receiver: User) {
func stopRecording(sender:User, receiver: User) {
audioRecorder.stop()
isRecording = false
@@ -77,7 +77,7 @@ extension InnerCircleViewModel {
return
}
let newMessage = Message(sendId: senderId, receivId: receiver.id!, audioDUrl: audioDataUrl!.absoluteString)
let newMessage = Message(sendId: sender.id!, receivId: receiver.id!, audioDUrl: audioDataUrl!.absoluteString)
// create a new message in firestore with the url for receiving user to automatically get notified
self?.firestoreService.createMessage(message: newMessage) {[weak self] res in
@@ -85,7 +85,7 @@ extension InnerCircleViewModel {
// sending push notification if there was a device token
if receiver.deviceToken != nil && receiver.nickname != nil {
self?.pushNotificationService.sendPushNotification(to: receiver.deviceToken!, title: "🌱Nirvana", body: "continue your conversation with \(receiver.nickname ?? "your friend")")
self?.pushNotificationService.sendPushNotification(to: receiver.deviceToken!, title: "🌱Nirvana", body: "continue your conversation with \(sender.nickname ?? "your friend")")
}
// delete local audio file from user's phone so that it doesn't get crazy