1
0
mirror of https://github.com/yattee/yattee.git synced 2024-12-15 23:00:32 +05:30
yattee/Fixtures/View+Fixtures.swift

53 lines
1.4 KiB
Swift
Raw Normal View History

2021-09-29 17:15:00 +05:30
import Foundation
import SwiftUI
struct FixtureEnvironmentObjectsModifier: ViewModifier {
func body(content: Content) -> some View {
content
2021-10-18 04:36:00 +05:30
.environmentObject(AccountsModel())
2021-12-05 01:05:41 +05:30
.environmentObject(CommentsModel())
2021-09-29 17:15:00 +05:30
.environmentObject(InstancesModel())
2021-10-18 04:36:00 +05:30
.environmentObject(invidious)
2021-09-29 17:15:00 +05:30
.environmentObject(NavigationModel())
2021-10-18 04:36:00 +05:30
.environmentObject(PipedAPI())
.environmentObject(player)
2021-09-29 17:15:00 +05:30
.environmentObject(PlaylistsModel())
.environmentObject(RecentsModel())
.environmentObject(SearchModel())
.environmentObject(subscriptions)
2021-11-02 03:26:18 +05:30
.environmentObject(ThumbnailsModel())
2021-09-29 18:06:52 +05:30
}
2021-10-18 04:36:00 +05:30
private var invidious: InvidiousAPI {
2021-09-29 18:06:52 +05:30
let api = InvidiousAPI()
api.validInstance = true
api.signedIn = true
return api
2021-09-29 17:15:00 +05:30
}
private var player: PlayerModel {
let player = PlayerModel()
player.currentItem = PlayerQueueItem(Video.fixture)
player.queue = Video.allFixtures.map { PlayerQueueItem($0) }
return player
}
private var subscriptions: SubscriptionsModel {
let subscriptions = SubscriptionsModel()
subscriptions.channels = Video.allFixtures.map { $0.channel }
return subscriptions
}
2021-09-29 17:15:00 +05:30
}
extension View {
func injectFixtureEnvironmentObjects() -> some View {
modifier(FixtureEnvironmentObjectsModifier())
}
}