adding call states based on connection
This commit is contained in:
@@ -29,6 +29,33 @@ struct ConvoFooterView: View {
|
|||||||
.font(.footnote)
|
.font(.footnote)
|
||||||
.foregroundColor(NirvanaColor.light)
|
.foregroundColor(NirvanaColor.light)
|
||||||
|
|
||||||
|
switch self.convoVM.connectionState {
|
||||||
|
case .connecting:
|
||||||
|
Label("connecting", systemImage: "chart.bar")
|
||||||
|
.foregroundColor(Color.orange)
|
||||||
|
.font(.caption)
|
||||||
|
case .connected:
|
||||||
|
Label("connected", systemImage: "chart.bar.fill")
|
||||||
|
.foregroundColor(Color.green)
|
||||||
|
.font(.caption)
|
||||||
|
case .reconnecting:
|
||||||
|
Label("reconnecting", systemImage: "chart.bar")
|
||||||
|
.foregroundColor(Color.orange)
|
||||||
|
.font(.caption)
|
||||||
|
case .failed:
|
||||||
|
Label("failed", systemImage: "chart.bar")
|
||||||
|
.foregroundColor(Color.red)
|
||||||
|
.font(.caption)
|
||||||
|
case .disconnected:
|
||||||
|
Label("disconnected", systemImage: "chart.bar")
|
||||||
|
.foregroundColor(Color.red)
|
||||||
|
.font(.caption)
|
||||||
|
default:
|
||||||
|
Label("disconnected", systemImage: "chart.bar")
|
||||||
|
.foregroundColor(Color.red)
|
||||||
|
.font(.caption)
|
||||||
|
}
|
||||||
|
|
||||||
Text(self.convoRelativeTime)
|
Text(self.convoRelativeTime)
|
||||||
.font(.caption2)
|
.font(.caption2)
|
||||||
.foregroundColor(.gray)
|
.foregroundColor(.gray)
|
||||||
|
|||||||
@@ -8,11 +8,11 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
import AgoraRtcKit
|
import AgoraRtcKit
|
||||||
|
|
||||||
|
|
||||||
class ConvoViewModel: NSObject, ObservableObject {
|
class ConvoViewModel: NSObject, ObservableObject {
|
||||||
private var testingUIMode = true
|
private var testingUIMode = true
|
||||||
|
|
||||||
@Published var selectedConvoId:String? = nil
|
@Published var selectedConvoId:String? = nil
|
||||||
|
@Published var connectionState: AgoraConnectionStateType? = nil
|
||||||
|
|
||||||
let firestoreService = FirestoreService()
|
let firestoreService = FirestoreService()
|
||||||
|
|
||||||
@@ -137,6 +137,10 @@ extension ConvoViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
extension ConvoViewModel: AgoraRtcEngineDelegate {
|
extension ConvoViewModel: AgoraRtcEngineDelegate {
|
||||||
|
func rtcEngine(_ engine: AgoraRtcEngineKit, connectionChangedTo state: AgoraConnectionStateType, reason: AgoraConnectionChangedReason) {
|
||||||
|
self.connectionState = state
|
||||||
|
}
|
||||||
|
|
||||||
func rtcEngine(_ engine: AgoraRtcEngineKit, didJoinChannel channel: String, withUid uid: UInt, elapsed: Int) {
|
func rtcEngine(_ engine: AgoraRtcEngineKit, didJoinChannel channel: String, withUid uid: UInt, elapsed: Int) {
|
||||||
print("I did join channel")
|
print("I did join channel")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user