mirror of
https://github.com/yattee/yattee.git
synced 2024-12-13 05:40:32 +05:30
Model improvements
This commit is contained in:
parent
b220f212df
commit
0d3ccc00ce
@ -145,10 +145,10 @@ extension VideosAPI {
|
||||
let startRange = line.range(withName: "start")
|
||||
|
||||
guard let titleSubstringRange = Range(titleRange, in: description),
|
||||
let startSubstringRange = Range(startRange, in: description),
|
||||
let titleCapture = String(description[titleSubstringRange]),
|
||||
let startCapture = String(description[startSubstringRange]) else { return nil }
|
||||
let startSubstringRange = Range(startRange, in: description) else { return nil }
|
||||
|
||||
let titleCapture = String(description[titleSubstringRange])
|
||||
let startCapture = String(description[startSubstringRange])
|
||||
let startComponents = startCapture.components(separatedBy: ":")
|
||||
guard startComponents.count <= 3 else { return nil }
|
||||
|
||||
|
@ -79,7 +79,7 @@ final class AVPlayerBackend: PlayerBackend {
|
||||
init(model: PlayerModel, controls: PlayerControlsModel?, playerTime: PlayerTimeModel?) {
|
||||
self.model = model
|
||||
self.controls = controls
|
||||
self.playerTime = playerTime
|
||||
self.playerTime = playerTime ?? PlayerTimeModel.shared
|
||||
|
||||
addFrequentTimeObserver()
|
||||
addInfrequentTimeObserver()
|
||||
@ -582,6 +582,7 @@ final class AVPlayerBackend: PlayerBackend {
|
||||
}
|
||||
|
||||
if player.timeControlStatus == .playing {
|
||||
self.model.objectWillChange.send()
|
||||
if player.rate != self.model.currentRate {
|
||||
player.rate = self.model.currentRate
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ final class MPVBackend: PlayerBackend {
|
||||
) {
|
||||
self.model = model
|
||||
self.controls = controls
|
||||
self.playerTime = playerTime
|
||||
self.playerTime = playerTime ?? PlayerTimeModel.shared
|
||||
self.networkState = networkState
|
||||
|
||||
clientTimer = .init(interval: .seconds(Self.timeUpdateInterval), mode: .infinite) { [weak self] _ in
|
||||
|
@ -272,7 +272,11 @@ final class MPVClient: ObservableObject {
|
||||
UIView.animate(withDuration: 0.2, animations: {
|
||||
let aspectRatio = self.aspectRatio > 0 && self.aspectRatio < VideoPlayerView.defaultAspectRatio ? self.aspectRatio : VideoPlayerView.defaultAspectRatio
|
||||
let height = [self.backend.model.playerSize.height, self.backend.model.playerSize.width / aspectRatio].min()!
|
||||
let offsetY = self.backend.model.playingFullScreen ? ((self.backend.model.playerSize.height / 2.0) - (height / 2)) : 0
|
||||
var insets = 0.0
|
||||
#if os(iOS)
|
||||
insets = OrientationTracker.shared.currentInterfaceOrientation.isPortrait ? SafeArea.insets.bottom : 0
|
||||
#endif
|
||||
let offsetY = self.backend.model.playingFullScreen ? ((self.backend.model.playerSize.height / 2.0) - ((height + insets) / 2)) : 0
|
||||
self.glView?.frame = CGRect(x: 0, y: offsetY, width: roundedWidth, height: height)
|
||||
}) { completion in
|
||||
if completion {
|
||||
|
@ -130,8 +130,8 @@ extension PlayerBackend {
|
||||
return
|
||||
}
|
||||
#endif
|
||||
self.playerTime.currentTime = self.currentTime ?? .zero
|
||||
self.playerTime.duration = self.playerItemDuration ?? .zero
|
||||
PlayerTimeModel.shared.currentTime = self.currentTime ?? .zero
|
||||
PlayerTimeModel.shared.duration = self.playerItemDuration ?? .zero
|
||||
completionHandler?()
|
||||
}
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ final class PlayerModel: ObservableObject {
|
||||
|
||||
var mpvPlayerView = MPVPlayerView()
|
||||
|
||||
@Published var presentingPlayer = false
|
||||
@Published var presentingPlayer = false { didSet { handlePresentationChange() } }
|
||||
@Published var activeBackend = PlayerBackendType.mpv
|
||||
|
||||
var avPlayerBackend: AVPlayerBackend!
|
||||
@ -324,11 +324,7 @@ final class PlayerModel: ObservableObject {
|
||||
}
|
||||
|
||||
var playerItemDurationWithoutSponsorSegments: CMTime? {
|
||||
guard let playerItemDuration = playerItemDuration, !playerItemDuration.seconds.isZero else {
|
||||
return nil
|
||||
}
|
||||
|
||||
return playerItemDuration - .secondsInDefaultTimescale(
|
||||
PlayerTimeModel.shared.duration - .secondsInDefaultTimescale(
|
||||
sponsorBlock.segments.reduce(0) { $0 + $1.duration }
|
||||
)
|
||||
}
|
||||
@ -496,18 +492,7 @@ final class PlayerModel: ObservableObject {
|
||||
}
|
||||
|
||||
private func handlePresentationChange() {
|
||||
var delay = 0.0
|
||||
|
||||
#if os(iOS)
|
||||
if presentingPlayer {
|
||||
delay = 0.2
|
||||
}
|
||||
#endif
|
||||
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + delay) { [weak self] in
|
||||
guard let self = self else { return }
|
||||
self.backend.setNeedsDrawing(self.presentingPlayer)
|
||||
}
|
||||
backend.setNeedsDrawing(presentingPlayer)
|
||||
|
||||
controls.hide()
|
||||
|
||||
|
@ -3,6 +3,7 @@ import Foundation
|
||||
import SwiftUI
|
||||
|
||||
final class PlayerTimeModel: ObservableObject {
|
||||
static let shared = PlayerTimeModel()
|
||||
static let timePlaceholder = "--:--"
|
||||
|
||||
@Published var currentTime = CMTime.zero
|
||||
|
@ -24,17 +24,12 @@ final class SearchModel: ObservableObject {
|
||||
func changeQuery(_ changeHandler: @escaping (SearchQuery) -> Void = { _ in }) {
|
||||
changeHandler(query)
|
||||
|
||||
let newResource = accounts.api.search(query, page: nil)
|
||||
guard newResource != resource else {
|
||||
return
|
||||
}
|
||||
|
||||
page = nil
|
||||
|
||||
resource = newResource
|
||||
if !query.isEmpty {
|
||||
resource = accounts.api.search(query, page: nil)
|
||||
resource.addObserver(store)
|
||||
|
||||
if !query.isEmpty {
|
||||
loadResource()
|
||||
}
|
||||
}
|
||||
|
@ -278,6 +278,14 @@ enum VisibleSection: String, CaseIterable, Comparable, Defaults.Serializable {
|
||||
|
||||
enum WatchedVideoStyle: String, Defaults.Serializable {
|
||||
case nothing, badge, decreasedOpacity, both
|
||||
|
||||
var isShowingBadge: Bool {
|
||||
self == .badge || self == .both
|
||||
}
|
||||
|
||||
var isDecreasingOpacity: Bool {
|
||||
self == .decreasedOpacity || self == .both
|
||||
}
|
||||
}
|
||||
|
||||
enum WatchedVideoBadgeColor: String, Defaults.Serializable {
|
||||
|
@ -12,10 +12,8 @@ struct ContentView: View {
|
||||
@EnvironmentObject<CommentsModel> private var comments
|
||||
@EnvironmentObject<InstancesModel> private var instances
|
||||
@EnvironmentObject<NavigationModel> private var navigation
|
||||
@EnvironmentObject<NetworkStateModel> private var networkState
|
||||
@EnvironmentObject<PlayerModel> private var player
|
||||
@EnvironmentObject<PlayerControlsModel> private var playerControls
|
||||
@EnvironmentObject<PlayerTimeModel> private var playerTime
|
||||
@EnvironmentObject<PlaylistsModel> private var playlists
|
||||
@EnvironmentObject<RecentsModel> private var recents
|
||||
@EnvironmentObject<SearchModel> private var search
|
||||
@ -60,9 +58,7 @@ struct ContentView: View {
|
||||
.environmentObject(comments)
|
||||
.environmentObject(instances)
|
||||
.environmentObject(navigation)
|
||||
.environmentObject(networkState)
|
||||
.environmentObject(player)
|
||||
.environmentObject(playerTime)
|
||||
.environmentObject(playlists)
|
||||
.environmentObject(recents)
|
||||
.environmentObject(search)
|
||||
|
@ -31,19 +31,28 @@ struct ChapterView: View {
|
||||
}
|
||||
|
||||
@ViewBuilder func smallImage(_ chapter: Chapter) -> some View {
|
||||
if #available(iOS 15, macOS 12, *) {
|
||||
AsyncImage(url: chapter.image) { image in
|
||||
image
|
||||
.resizable()
|
||||
} placeholder: {
|
||||
Rectangle().foregroundColor(Color("PlaceholderColor"))
|
||||
}
|
||||
} else {
|
||||
WebImage(url: chapter.image)
|
||||
.resizable()
|
||||
.placeholder {
|
||||
ProgressView()
|
||||
}
|
||||
.indicator(.activity)
|
||||
#if os(tvOS)
|
||||
#if os(tvOS)
|
||||
.frame(width: thumbnailWidth, height: 140)
|
||||
.mask(RoundedRectangle(cornerRadius: 12))
|
||||
#else
|
||||
#else
|
||||
.frame(width: thumbnailWidth, height: 60)
|
||||
.mask(RoundedRectangle(cornerRadius: 6))
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
private var thumbnailWidth: Double {
|
||||
|
@ -72,7 +72,7 @@ struct PlayerControls: View {
|
||||
}
|
||||
.offset(y: playerControlsLayout.osdVerticalOffset + 5)
|
||||
|
||||
if model.presentingControls, !model.presentingOverlays {
|
||||
Section {
|
||||
#if !os(tvOS)
|
||||
HStack {
|
||||
seekBackwardButton
|
||||
@ -160,7 +160,8 @@ struct PlayerControls: View {
|
||||
.offset(y: -playerControlsLayout.timelineHeight - 5)
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}.opacity(model.presentingControls && !model.presentingOverlays ? 1 : 0)
|
||||
|
||||
}
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
@ -219,6 +220,14 @@ struct PlayerControls: View {
|
||||
let video = item.video,
|
||||
let url = thumbnails.best(video)
|
||||
{
|
||||
if #available(iOS 15, macOS 12, *) {
|
||||
AsyncImage(url: url) { image in
|
||||
image
|
||||
.resizable()
|
||||
} placeholder: {
|
||||
Rectangle().foregroundColor(Color("PlaceholderColor"))
|
||||
}
|
||||
} else {
|
||||
WebImage(url: url)
|
||||
.resizable()
|
||||
.placeholder {
|
||||
@ -229,6 +238,7 @@ struct PlayerControls: View {
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var timeline: some View {
|
||||
TimelineView(context: .player).foregroundColor(.primary)
|
||||
|
@ -60,7 +60,7 @@ enum PlayerControlsLayout: String, CaseIterable, Defaults.Serializable {
|
||||
case .veryLarge:
|
||||
return 40
|
||||
case .large:
|
||||
return 30
|
||||
return 25
|
||||
case .medium:
|
||||
return 25
|
||||
case .small:
|
||||
|
@ -44,9 +44,10 @@ struct TimelineView: View {
|
||||
@Environment(\.verticalSizeClass) private var verticalSizeClass
|
||||
#endif
|
||||
|
||||
@ObservedObject private var playerTime = PlayerTimeModel.shared
|
||||
|
||||
@EnvironmentObject<PlayerModel> private var player
|
||||
@EnvironmentObject<PlayerControlsModel> private var controls
|
||||
@EnvironmentObject<PlayerTimeModel> private var playerTime
|
||||
|
||||
@Default(.playerControlsLayout) private var regularPlayerControlsLayout
|
||||
@Default(.fullScreenPlayerControlsLayout) private var fullScreenPlayerControlsLayout
|
||||
@ -392,7 +393,7 @@ struct TimelineView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
let playerModel = PlayerModel()
|
||||
playerModel.currentItem = .init(Video.fixture)
|
||||
let playerTimeModel = PlayerTimeModel()
|
||||
let playerTimeModel = PlayerTimeModel.shared
|
||||
playerTimeModel.player = playerModel
|
||||
playerTimeModel.currentTime = .secondsInDefaultTimescale(33)
|
||||
playerTimeModel.duration = .secondsInDefaultTimescale(100)
|
||||
@ -400,7 +401,6 @@ struct TimelineView_Previews: PreviewProvider {
|
||||
TimelineView()
|
||||
}
|
||||
.environmentObject(playerModel)
|
||||
.environmentObject(playerTimeModel)
|
||||
.environmentObject(PlayerControlsModel())
|
||||
.padding()
|
||||
}
|
||||
|
@ -50,6 +50,8 @@ extension VideoPlayerView {
|
||||
return
|
||||
}
|
||||
|
||||
orientationDebouncer.callback = {
|
||||
DispatchQueue.main.async {
|
||||
if orientation.isLandscape {
|
||||
playerControls.presentingControls = false
|
||||
player.enterFullScreen(showControls: false)
|
||||
@ -60,6 +62,10 @@ extension VideoPlayerView {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
orientationDebouncer.call()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func stopOrientationUpdates() {
|
||||
|
@ -3,6 +3,7 @@ import AVKit
|
||||
import CoreMotion
|
||||
#endif
|
||||
import Defaults
|
||||
import Repeat
|
||||
import Siesta
|
||||
import SwiftUI
|
||||
|
||||
@ -41,6 +42,7 @@ struct VideoPlayerView: View {
|
||||
|
||||
@State internal var orientation = UIInterfaceOrientation.portrait
|
||||
@State internal var lastOrientation: UIInterfaceOrientation?
|
||||
@State internal var orientationDebouncer = Debouncer(.milliseconds(300))
|
||||
#elseif os(macOS)
|
||||
var hoverThrottle = Throttle(interval: 0.5)
|
||||
var mouseLocation: CGPoint { NSEvent.mouseLocation }
|
||||
|
@ -27,6 +27,7 @@ struct SearchView: View {
|
||||
@EnvironmentObject<SearchModel> private var state
|
||||
private var favorites = FavoritesModel.shared
|
||||
|
||||
@Default(.recentlyOpened) private var recentlyOpened
|
||||
@Default(.saveRecents) private var saveRecents
|
||||
|
||||
private var videos = [Video]()
|
||||
@ -287,11 +288,11 @@ struct SearchView: View {
|
||||
VStack {
|
||||
List {
|
||||
Section(header: Text("Recents")) {
|
||||
if recentItems.isEmpty {
|
||||
if recentlyOpened.isEmpty {
|
||||
Text("Search history is empty")
|
||||
.foregroundColor(.secondary)
|
||||
}
|
||||
ForEach(recentItems) { item in
|
||||
ForEach(recentlyOpened, id: \.tag) { item in
|
||||
recentItemButton(item)
|
||||
}
|
||||
}
|
||||
@ -347,7 +348,6 @@ struct SearchView: View {
|
||||
item.type == .channel ? RecentsModel.symbolSystemImage(item.title) :
|
||||
"list.and.film"
|
||||
Label(item.title, systemImage: systemImage)
|
||||
.lineLimit(1)
|
||||
}
|
||||
.contextMenu {
|
||||
removeButton(item)
|
||||
@ -391,10 +391,6 @@ struct SearchView: View {
|
||||
searchDate != .any || searchDuration != .any
|
||||
}
|
||||
|
||||
private var recentItems: [RecentItem] {
|
||||
Defaults[.recentlyOpened].reversed()
|
||||
}
|
||||
|
||||
private var searchSortOrderPicker: some View {
|
||||
Picker("Sort", selection: $searchSortOrder) {
|
||||
ForEach(SearchQuery.SortOrder.allCases) { sortOrder in
|
||||
|
@ -70,20 +70,37 @@ struct VideoBanner: View {
|
||||
#endif
|
||||
}
|
||||
|
||||
private var smallThumbnail: some View {
|
||||
WebImage(url: video?.thumbnailURL(quality: .medium))
|
||||
@ViewBuilder private var smallThumbnail: some View {
|
||||
let url = video?.thumbnailURL(quality: .medium)
|
||||
if #available(iOS 15, macOS 12, *) {
|
||||
AsyncImage(url: url) { image in
|
||||
image
|
||||
.resizable()
|
||||
} placeholder: {
|
||||
Rectangle().foregroundColor(Color("PlaceholderColor"))
|
||||
}
|
||||
#if os(tvOS)
|
||||
.frame(width: thumbnailWidth, height: 140)
|
||||
.mask(RoundedRectangle(cornerRadius: 12))
|
||||
#else
|
||||
.frame(width: thumbnailWidth, height: 60)
|
||||
.mask(RoundedRectangle(cornerRadius: 6))
|
||||
#endif
|
||||
} else {
|
||||
WebImage(url: url)
|
||||
.resizable()
|
||||
.placeholder {
|
||||
ProgressView()
|
||||
}
|
||||
.indicator(.activity)
|
||||
#if os(tvOS)
|
||||
#if os(tvOS)
|
||||
.frame(width: thumbnailWidth, height: 140)
|
||||
.mask(RoundedRectangle(cornerRadius: 12))
|
||||
#else
|
||||
#else
|
||||
.frame(width: thumbnailWidth, height: 60)
|
||||
.mask(RoundedRectangle(cornerRadius: 6))
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
private var thumbnailWidth: Double {
|
||||
|
@ -382,7 +382,7 @@ struct VideoCell: View {
|
||||
|
||||
HStack(alignment: .center) {
|
||||
if saveHistory,
|
||||
watchedVideoStyle == .badge || watchedVideoStyle == .both,
|
||||
watchedVideoStyle.isShowingBadge,
|
||||
watch?.finished ?? false
|
||||
{
|
||||
Image(systemName: "checkmark.circle.fill")
|
||||
@ -419,27 +419,32 @@ struct VideoCell: View {
|
||||
|
||||
private var thumbnailImage: some View {
|
||||
Group {
|
||||
if let url = thumbnails.best(video) {
|
||||
let url = thumbnails.best(video)
|
||||
if #available(iOS 15, macOS 12, *) {
|
||||
AsyncImage(url: url) { image in
|
||||
image
|
||||
.resizable()
|
||||
} placeholder: {
|
||||
Rectangle().foregroundColor(Color("PlaceholderColor"))
|
||||
}
|
||||
#if os(tvOS)
|
||||
.frame(minHeight: 320)
|
||||
#endif
|
||||
} else {
|
||||
WebImage(url: url)
|
||||
.resizable()
|
||||
.placeholder {
|
||||
Rectangle().fill(Color("PlaceholderColor"))
|
||||
Rectangle().foregroundColor(Color("PlaceholderColor"))
|
||||
}
|
||||
.retryOnAppear(true)
|
||||
.onFailure { _ in
|
||||
guard let url = url else { return }
|
||||
thumbnails.insertUnloadable(url)
|
||||
}
|
||||
.indicator(.activity)
|
||||
|
||||
#if os(tvOS)
|
||||
#if os(tvOS)
|
||||
.frame(minHeight: 320)
|
||||
#endif
|
||||
} else {
|
||||
ZStack {
|
||||
Color("PlaceholderColor")
|
||||
Image(systemName: "exclamationmark.triangle")
|
||||
}
|
||||
.font(.system(size: 30))
|
||||
#endif
|
||||
}
|
||||
}
|
||||
.mask(RoundedRectangle(cornerRadius: thumbnailRoundingCornerRadius))
|
||||
|
@ -37,7 +37,14 @@ struct ChannelCell: View {
|
||||
.opacity(0.6)
|
||||
}
|
||||
.foregroundColor(.secondary)
|
||||
|
||||
if #available(iOS 15, macOS 12, *) {
|
||||
AsyncImage(url: channel.thumbnailURL) { image in
|
||||
image
|
||||
.resizable()
|
||||
} placeholder: {
|
||||
Rectangle().foregroundColor(Color("PlaceholderColor"))
|
||||
}
|
||||
} else {
|
||||
WebImage(url: channel.thumbnailURL)
|
||||
.resizable()
|
||||
.placeholder {
|
||||
@ -46,6 +53,7 @@ struct ChannelCell: View {
|
||||
.indicator(.activity)
|
||||
.frame(width: 88, height: 88)
|
||||
.clipShape(Circle())
|
||||
}
|
||||
|
||||
DetailBadge(text: channel.name, style: .prominent)
|
||||
|
||||
|
@ -37,6 +37,14 @@ struct ChannelPlaylistCell: View {
|
||||
}
|
||||
.foregroundColor(.secondary)
|
||||
|
||||
if #available(iOS 15, macOS 12, *) {
|
||||
AsyncImage(url: playlist.thumbnailURL) { image in
|
||||
image
|
||||
.resizable()
|
||||
} placeholder: {
|
||||
Rectangle().foregroundColor(Color("PlaceholderColor"))
|
||||
}
|
||||
} else {
|
||||
WebImage(url: playlist.thumbnailURL)
|
||||
.resizable()
|
||||
.placeholder {
|
||||
@ -45,7 +53,7 @@ struct ChannelPlaylistCell: View {
|
||||
.indicator(.activity)
|
||||
.frame(width: 165, height: 88)
|
||||
.clipShape(RoundedRectangle(cornerRadius: 10))
|
||||
|
||||
}
|
||||
Group {
|
||||
DetailBadge(text: playlist.title, style: .prominent)
|
||||
.lineLimit(2)
|
||||
|
@ -12,7 +12,6 @@ struct ControlsBar: View {
|
||||
|
||||
@EnvironmentObject<AccountsModel> private var accounts
|
||||
@EnvironmentObject<NavigationModel> private var navigation
|
||||
@EnvironmentObject<PlayerControlsModel> private var playerControls
|
||||
@EnvironmentObject<PlayerModel> private var model
|
||||
@EnvironmentObject<PlaylistsModel> private var playlists
|
||||
@EnvironmentObject<RecentsModel> private var recents
|
||||
@ -63,8 +62,8 @@ struct ControlsBar: View {
|
||||
}
|
||||
} else if detailsToggleFullScreen {
|
||||
Button {
|
||||
playerControls.presentingControlsOverlay = false
|
||||
playerControls.presentingControls = false
|
||||
model.controls.presentingControlsOverlay = false
|
||||
model.controls.presentingControls = false
|
||||
withAnimation {
|
||||
fullScreen.toggle()
|
||||
}
|
||||
@ -83,7 +82,7 @@ struct ControlsBar: View {
|
||||
var controls: some View {
|
||||
HStack(spacing: 4) {
|
||||
Group {
|
||||
if playerControls.isPlaying {
|
||||
if model.controls.isPlaying {
|
||||
Button(action: {
|
||||
model.pause()
|
||||
}) {
|
||||
@ -103,7 +102,7 @@ struct ControlsBar: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
.disabled(playerControls.isLoadingVideo || model.currentItem.isNil)
|
||||
.disabled(model.controls.isLoadingVideo || model.currentItem.isNil)
|
||||
|
||||
Button(action: { model.advanceToNextItem() }) {
|
||||
Label("Next", systemImage: "forward.fill")
|
||||
@ -268,6 +267,14 @@ struct ControlsBar: View {
|
||||
private var authorAvatar: some View {
|
||||
Group {
|
||||
if let video = model.currentItem?.video, let url = video.channel.thumbnailURL {
|
||||
if #available(iOS 15, macOS 12, *) {
|
||||
AsyncImage(url: url) { image in
|
||||
image
|
||||
.resizable()
|
||||
} placeholder: {
|
||||
Rectangle().foregroundColor(Color("PlaceholderColor"))
|
||||
}
|
||||
} else {
|
||||
WebImage(url: url)
|
||||
.resizable()
|
||||
.placeholder {
|
||||
@ -275,6 +282,7 @@ struct ControlsBar: View {
|
||||
}
|
||||
.retryOnAppear(true)
|
||||
.indicator(.activity)
|
||||
}
|
||||
} else {
|
||||
ZStack {
|
||||
Color(white: 0.6)
|
||||
|
@ -40,7 +40,6 @@ struct YatteeApp: App {
|
||||
@StateObject private var networkState = NetworkStateModel()
|
||||
@StateObject private var player = PlayerModel()
|
||||
@StateObject private var playerControls = PlayerControlsModel()
|
||||
@StateObject private var playerTime = PlayerTimeModel()
|
||||
@StateObject private var playlists = PlaylistsModel()
|
||||
@StateObject private var recents = RecentsModel()
|
||||
@StateObject private var search = SearchModel()
|
||||
@ -63,7 +62,6 @@ struct YatteeApp: App {
|
||||
.environmentObject(networkState)
|
||||
.environmentObject(player)
|
||||
.environmentObject(playerControls)
|
||||
.environmentObject(playerTime)
|
||||
.environmentObject(playlists)
|
||||
.environmentObject(recents)
|
||||
.environmentObject(seek)
|
||||
@ -137,7 +135,6 @@ struct YatteeApp: App {
|
||||
.environmentObject(networkState)
|
||||
.environmentObject(player)
|
||||
.environmentObject(playerControls)
|
||||
.environmentObject(playerTime)
|
||||
.environmentObject(playlists)
|
||||
.environmentObject(recents)
|
||||
.environmentObject(search)
|
||||
@ -205,9 +202,10 @@ struct YatteeApp: App {
|
||||
player.controls = playerControls
|
||||
player.navigation = navigation
|
||||
player.networkState = networkState
|
||||
player.playerTime = playerTime
|
||||
player.seek = seek
|
||||
|
||||
PlayerTimeModel.shared.player = player
|
||||
|
||||
if !accounts.current.isNil {
|
||||
player.restoreQueue()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user