trying to fix bugs

This commit is contained in:
talksik
2022-01-04 17:12:56 -08:00
parent 9219315228
commit 03ae6535c1
4 changed files with 15 additions and 6 deletions
@@ -10,6 +10,7 @@ import SwiftUI
struct ConvoFooterView: View {
@EnvironmentObject var convoVM: ConvoViewModel
@EnvironmentObject var authSessionStore: AuthSessionStore
@EnvironmentObject var innerCircleVM: InnerCircleViewModel
@State private var convoRelativeTime = ""
@State private var selectedConvo: Convo? = nil
@@ -94,8 +95,11 @@ struct ConvoFooterView: View {
Button {
print("disconnecting user now ")
self.innerCircleVM.setupMessagingAudioSession()
self.convoVM.leaveConvo()
// show success or failure toast
} label: {
Label("Call", systemImage: "powerplug.fill")
@@ -121,7 +121,7 @@ struct CircleGridView: View {
x: honeycombOffSetX(value),
y: 0
)
.id("\(value)") // id for scrollviewreader
// .id("\(value)") // id for scrollviewreader
.frame(height: Self.size)
.onTapGesture {
// if not in a call already
@@ -105,6 +105,7 @@ struct InnerCircleView: View {
ConvoFooterView()
.environmentObject(self.convoViewModel)
.environmentObject(self.innerCircleVM)
}
.alert(self.alertText, isPresented: self.$alertActive) {
@@ -97,6 +97,13 @@ class InnerCircleViewModel: NSObject, ObservableObject {
override init() {
super.init()
self.setupMessagingAudioSession()
}
}
// audio stuff
extension InnerCircleViewModel {
func setupMessagingAudioSession() {
// separate set up for listening vs recording
do {
try audioSession.setCategory(.playAndRecord, mode: .default, options: [.duckOthers, .allowBluetooth, .allowBluetoothA2DP])
@@ -108,10 +115,7 @@ class InnerCircleViewModel: NSObject, ObservableObject {
print("Can not setup the Recording")
}
}
}
// audio stuff
extension InnerCircleViewModel {
func startRecording() {
let filePath = getTemporaryDirectory().appendingPathComponent("\(UUID().uuidString).m4a")