no need for NotificationCenter

This commit is contained in:
Toni Förster
2023-12-05 00:07:36 +01:00
parent 4ca8adc4dd
commit 721a97dc41
4 changed files with 4 additions and 24 deletions

View File

@@ -182,6 +182,7 @@ final class MPVBackend: PlayerBackend {
}
init() {
// swiftlint:disable shorthand_optional_binding
clientTimer = .init(interval: .seconds(Self.timeUpdateInterval), mode: .infinite) { [weak self] _ in
guard let self = self, self.model.activeBackend == .mpv else {
return
@@ -195,10 +196,7 @@ final class MPVBackend: PlayerBackend {
}
self.updateNetworkState()
}
}
deinit {
NotificationCenter.default.removeObserver(self, name: .getTimeUpdatesNotification, object: self.currentTime)
// swiftlint:enable shorthand_optional_binding
}
typealias AreInIncreasingOrder = (Stream, Stream) -> Bool
@@ -443,7 +441,7 @@ final class MPVBackend: PlayerBackend {
self.model.updateWatch(time: self.currentTime)
}
NotificationCenter.default.post(name: .getTimeUpdatesNotification, object: self.currentTime)
self.model.updateTime(self.currentTime!)
}
private func stopClientUpdates() {