From 6c41de7264d2068d71c7058ff1ca39669c6716a3 Mon Sep 17 00:00:00 2001 From: talksik Date: Sun, 2 Jan 2022 00:29:47 -0800 Subject: [PATCH] adding connecting toast --- nirvana-ios/Views/Convos/ConvoViewModel.swift | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/nirvana-ios/Views/Convos/ConvoViewModel.swift b/nirvana-ios/Views/Convos/ConvoViewModel.swift index 8fdf6d2..44eef46 100644 --- a/nirvana-ios/Views/Convos/ConvoViewModel.swift +++ b/nirvana-ios/Views/Convos/ConvoViewModel.swift @@ -15,6 +15,8 @@ class ConvoViewModel: NSObject, ObservableObject { enum Toast: Identifiable { var id: Self { self } + case connecting + case newRelevantConvoFound case successfullyJoined case successfullyAddedThirdParty @@ -30,6 +32,8 @@ class ConvoViewModel: NSObject, ObservableObject { var view: AlertToast { switch self { + case .connecting: + return AlertToast(displayMode: .hud, type: .systemImage("sensor.tag.radiowaves.forward.fill", NirvanaColor.dimTeal), title: "Connecting") case .disconnected: return AlertToast(displayMode: .hud, type: .systemImage("hand.wave.fill", Color.orange), title: "disconnected") case .successfullyAddedThirdParty: @@ -202,7 +206,7 @@ class ConvoViewModel: NSObject, ObservableObject { @param: friendId: the second person in the convo...the receiver **/ func startConvo(friendId: String) { - // TODO: need to make sure the other user is online or already did in view + self.toast = .connecting // making sure this user is authenticated if let userId = AuthSessionStore.getCurrentUserId() { @@ -257,6 +261,8 @@ class ConvoViewModel: NSObject, ObservableObject { Allow user to join an active convo */ func joinConvo(convoId: String) { + self.toast = .connecting + // ensure the convo is active and includes 2 people in it currently...shouldn't be shown if not anyway // ensure that this user leaves all other channels