From f5016cc961595d953d75ae9bf749e503ed2eccf3 Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Thu, 1 Sep 2022 00:00:28 +0200 Subject: [PATCH] Model improvements --- Model/Player/PlayerModel.swift | 2 ++ Shared/Videos/VideoCell.swift | 5 +++-- Shared/YatteeApp.swift | 2 ++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Model/Player/PlayerModel.swift b/Model/Player/PlayerModel.swift index 3383cbc0..2d22098f 100644 --- a/Model/Player/PlayerModel.swift +++ b/Model/Player/PlayerModel.swift @@ -45,6 +45,8 @@ final class PlayerModel: ObservableObject { } } + static var shared: PlayerModel! + static let availableRates: [Float] = [0.5, 0.67, 0.8, 1, 1.25, 1.5, 2] let logger = Logger(label: "stream.yattee.app") diff --git a/Shared/Videos/VideoCell.swift b/Shared/Videos/VideoCell.swift index 95d88b80..8ff9d58d 100644 --- a/Shared/Videos/VideoCell.swift +++ b/Shared/Videos/VideoCell.swift @@ -15,8 +15,6 @@ struct VideoCell: View { #endif @EnvironmentObject private var accounts - @EnvironmentObject private var navigation - @EnvironmentObject private var player @EnvironmentObject private var recents @EnvironmentObject private var thumbnails @@ -29,6 +27,9 @@ struct VideoCell: View { @Default(.watchedVideoBadgeColor) private var watchedVideoBadgeColor @Default(.watchedVideoPlayNowBehavior) private var watchedVideoPlayNowBehavior + private var navigation: NavigationModel { .shared } + private var player: PlayerModel { .shared } + @FetchRequest private var watchRequest: FetchedResults init(video: Video) { diff --git a/Shared/YatteeApp.swift b/Shared/YatteeApp.swift index bbe7f6dd..52bffeb0 100644 --- a/Shared/YatteeApp.swift +++ b/Shared/YatteeApp.swift @@ -185,6 +185,8 @@ struct YatteeApp: App { InstancesManifest.shared.setPublicAccount(countryOfPublicInstances!, accounts: accounts, asCurrent: accounts.current.isNil) } + PlayerModel.shared = player + playlists.accounts = accounts search.accounts = accounts subscriptions.accounts = accounts