good enough fix for the problems
This commit is contained in:
@@ -386,7 +386,6 @@ extension AuthSessionStore {
|
|||||||
let currMessage = try queryDocumentSnapshot.data(as: Message.self)
|
let currMessage = try queryDocumentSnapshot.data(as: Message.self)
|
||||||
// print("new message received! \(currMessage!.sentTimestamp)")
|
// print("new message received! \(currMessage!.sentTimestamp)")
|
||||||
|
|
||||||
DispatchQueue.main.async {
|
|
||||||
if currMessage != nil { // not really possible but just check
|
if currMessage != nil { // not really possible but just check
|
||||||
// if the user doesn't exist for the dictionary, then add it
|
// if the user doesn't exist for the dictionary, then add it
|
||||||
// this means it's most likely someone new (never had user_friend relationship before) messaging for the user's inbox
|
// this means it's most likely someone new (never had user_friend relationship before) messaging for the user's inbox
|
||||||
@@ -407,7 +406,6 @@ extension AuthSessionStore {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return currMessage
|
return currMessage
|
||||||
} catch {
|
} catch {
|
||||||
|
|||||||
@@ -282,8 +282,6 @@ extension InnerCircleViewModel {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
print("current state of cached audio files: \(self.cachedPlayerItemsDict)")
|
|
||||||
|
|
||||||
// start playing if there are messages to listen to
|
// start playing if there are messages to listen to
|
||||||
print("have \(AVPlayerItems.count) messages to play")
|
print("have \(AVPlayerItems.count) messages to play")
|
||||||
|
|
||||||
@@ -308,6 +306,11 @@ extension InnerCircleViewModel {
|
|||||||
totalDuration = CMTimeAdd(totalDuration, item.asset.duration)
|
totalDuration = CMTimeAdd(totalDuration, item.asset.duration)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: not hitting the last one/100%
|
||||||
|
// it either plays on time or there is a little lag on multiple items...
|
||||||
|
// offset this by adding 1 when it reaches the totalDuration as it's longer
|
||||||
|
totalDuration = CMTimeSubtract(totalDuration, CMTimeMakeWithSeconds(1, preferredTimescale: 1))
|
||||||
|
|
||||||
var times = [NSValue]()
|
var times = [NSValue]()
|
||||||
// Set initial time to zero
|
// Set initial time to zero
|
||||||
var currentTime = CMTime.zero
|
var currentTime = CMTime.zero
|
||||||
@@ -320,8 +323,9 @@ extension InnerCircleViewModel {
|
|||||||
times.append(NSValue(time: currentTime))
|
times.append(NSValue(time: currentTime))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Add time observer. Observe boundary time changes on the main queue.
|
// Add time observer. Observe boundary time changes on the main queue.
|
||||||
// TODO: not hitting the last one/100%
|
|
||||||
self.queuePlayer.addBoundaryTimeObserver(forTimes: times, queue: .main) { [weak self] in
|
self.queuePlayer.addBoundaryTimeObserver(forTimes: times, queue: .main) { [weak self] in
|
||||||
// Update UI
|
// Update UI
|
||||||
self?.messagesListeningProgress += Float(Self.multiplier)
|
self?.messagesListeningProgress += Float(Self.multiplier)
|
||||||
|
|||||||
Reference in New Issue
Block a user