fixing other bugs with silent mode and such
This commit is contained in:
@@ -96,8 +96,8 @@ struct CircleFooterView: View {
|
|||||||
if newValue != nil && myId != nil {
|
if newValue != nil && myId != nil {
|
||||||
self.selectedFriend = self.authSessionStore.friendsArr[newValue!]
|
self.selectedFriend = self.authSessionStore.friendsArr[newValue!]
|
||||||
|
|
||||||
// get the last message's sent timestamp
|
// get the latest message's timestamp...will be the first in list now
|
||||||
let lastMessage = self.authSessionStore.friendMessagesDict[self.selectedFriend!.id!]?.last
|
let lastMessage = self.authSessionStore.friendMessagesDict[self.selectedFriend!.id!]?.first
|
||||||
if lastMessage != nil {
|
if lastMessage != nil {
|
||||||
// figure out whose turn it is
|
// figure out whose turn it is
|
||||||
self.myTurn = lastMessage!.receiverId == myId! ? true : false
|
self.myTurn = lastMessage!.receiverId == myId! ? true : false
|
||||||
|
|||||||
@@ -14,22 +14,25 @@ class InnerCircleViewModel: ObservableObject {
|
|||||||
|
|
||||||
@Published var isRecording : Bool = false
|
@Published var isRecording : Bool = false
|
||||||
|
|
||||||
|
let audioSession = AVAudioSession.sharedInstance()
|
||||||
|
|
||||||
private var audioLocalUrl: URL?
|
private var audioLocalUrl: URL?
|
||||||
|
|
||||||
let cloudStorageService = CloudStorageService()
|
let cloudStorageService = CloudStorageService()
|
||||||
let firestoreService = FirestoreService()
|
let firestoreService = FirestoreService()
|
||||||
|
|
||||||
func startRecording() {
|
init() {
|
||||||
let recordingSession = AVAudioSession.sharedInstance()
|
|
||||||
|
|
||||||
do {
|
do {
|
||||||
try recordingSession.setAllowHapticsAndSystemSoundsDuringRecording(true)
|
try audioSession.setAllowHapticsAndSystemSoundsDuringRecording(true)
|
||||||
try recordingSession.setCategory(.playAndRecord, mode: .default)
|
try audioSession.setCategory(.playAndRecord, mode: .default)
|
||||||
try recordingSession.setActive(true)
|
try audioSession.setActive(true)
|
||||||
|
try audioSession.overrideOutputAudioPort(AVAudioSession.PortOverride.speaker) // allow playing in silent mode
|
||||||
} catch {
|
} catch {
|
||||||
print("Can not setup the Recording")
|
print("Can not setup the Recording")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func startRecording() {
|
||||||
let filePath = getTemporaryDirectory().appendingPathComponent("\(UUID().uuidString).m4a")
|
let filePath = getTemporaryDirectory().appendingPathComponent("\(UUID().uuidString).m4a")
|
||||||
|
|
||||||
print("file name of recording will be : \(filePath)")
|
print("file name of recording will be : \(filePath)")
|
||||||
|
|||||||
Reference in New Issue
Block a user