mirror of
https://github.com/yattee/yattee.git
synced 2024-12-22 21:43:41 +00:00
Shared seek model
This commit is contained in:
parent
6643208579
commit
02617a7c42
@ -3,6 +3,8 @@ import Foundation
|
||||
import SwiftUI
|
||||
|
||||
final class SeekModel: ObservableObject {
|
||||
static let shared = SeekModel()
|
||||
|
||||
@Published var currentTime = CMTime.zero
|
||||
@Published var duration = CMTime.zero
|
||||
|
||||
|
@ -12,7 +12,6 @@ struct ContentView: View {
|
||||
@EnvironmentObject<CommentsModel> private var comments
|
||||
@EnvironmentObject<InstancesModel> private var instances
|
||||
@EnvironmentObject<NavigationModel> private var navigation
|
||||
@EnvironmentObject<PlayerModel> private var player
|
||||
@EnvironmentObject<PlayerControlsModel> private var playerControls
|
||||
@EnvironmentObject<PlaylistsModel> private var playlists
|
||||
@EnvironmentObject<RecentsModel> private var recents
|
||||
@ -29,6 +28,8 @@ struct ContentView: View {
|
||||
|
||||
@State private var playerInitialized = false
|
||||
|
||||
private var player = PlayerModel.shared
|
||||
|
||||
let persistenceController = PersistenceController.shared
|
||||
|
||||
var body: some View {
|
||||
|
@ -7,7 +7,7 @@ struct Seek: View {
|
||||
#endif
|
||||
|
||||
@EnvironmentObject<PlayerControlsModel> private var controls
|
||||
@EnvironmentObject<SeekModel> private var model
|
||||
@StateObject private var model = SeekModel.shared
|
||||
|
||||
private var updateThrottle = Throttle(interval: 2)
|
||||
|
||||
|
@ -461,7 +461,6 @@ struct VideoPlayerView: View {
|
||||
struct VideoPlayerView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
VideoPlayerView()
|
||||
.environmentObject(SeekModel())
|
||||
.injectFixtureEnvironmentObjects()
|
||||
}
|
||||
}
|
||||
|
@ -43,7 +43,6 @@ struct YatteeApp: App {
|
||||
@StateObject private var playlists = PlaylistsModel()
|
||||
@StateObject private var recents = RecentsModel()
|
||||
@StateObject private var search = SearchModel()
|
||||
@StateObject private var seek = SeekModel()
|
||||
@StateObject private var settings = SettingsModel()
|
||||
@StateObject private var subscriptions = SubscriptionsModel()
|
||||
@StateObject private var thumbnails = ThumbnailsModel()
|
||||
@ -64,7 +63,6 @@ struct YatteeApp: App {
|
||||
.environmentObject(playerControls)
|
||||
.environmentObject(playlists)
|
||||
.environmentObject(recents)
|
||||
.environmentObject(seek)
|
||||
.environmentObject(settings)
|
||||
.environmentObject(subscriptions)
|
||||
.environmentObject(thumbnails)
|
||||
@ -204,7 +202,7 @@ struct YatteeApp: App {
|
||||
player.controls = playerControls
|
||||
player.navigation = navigation
|
||||
player.networkState = networkState
|
||||
player.seek = seek
|
||||
player.seek = .shared
|
||||
|
||||
PlayerTimeModel.shared.player = player
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user