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 ( ) )
2022-06-25 05:09:29 +05:30
. environmentObject ( comments )
2021-09-29 17:15:00 +05:30
. environmentObject ( InstancesModel ( ) )
2022-07-02 02:58:32 +05:30
. environmentObject ( InstancesManifest ( ) )
2021-10-18 04:36:00 +05:30
. environmentObject ( invidious )
2021-09-29 17:15:00 +05:30
. environmentObject ( NavigationModel ( ) )
2022-06-18 18:09:49 +05:30
. environmentObject ( NetworkStateModel ( ) )
2021-10-18 04:36:00 +05:30
. environmentObject ( PipedAPI ( ) )
2021-10-06 01:50:09 +05:30
. environmentObject ( player )
2022-06-18 18:09:49 +05:30
. environmentObject ( playerControls )
. environmentObject ( PlayerTimeModel ( ) )
2021-09-29 17:15:00 +05:30
. environmentObject ( PlaylistsModel ( ) )
. environmentObject ( RecentsModel ( ) )
. environmentObject ( SearchModel ( ) )
2022-07-04 01:52:57 +05:30
. environmentObject ( SettingsModel ( ) )
2021-10-06 01:50:09 +05:30
. environmentObject ( subscriptions )
2021-11-02 03:26:18 +05:30
. environmentObject ( ThumbnailsModel ( ) )
2021-09-29 18:06:52 +05:30
}
2022-06-25 05:09:29 +05:30
private var comments : CommentsModel {
let comments = CommentsModel ( )
comments . loaded = true
comments . all = [ . fixture ]
return comments
}
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
}
2021-10-06 01:50:09 +05:30
private var player : PlayerModel {
let player = PlayerModel ( )
2022-08-20 03:25:02 +05:30
player . currentItem = PlayerQueueItem (
Video (
videoID : " " ,
title : " " ,
author : " " ,
length : 0 ,
published : " 2 days ago " ,
views : 43434 ,
description : " The 14 \" and 16 \" MacBook Pros are incredible. I can finally retire the travel iMac. \n That shirt! http://shop.MKBHD.com \n MacBook Pro skins: https://dbrand.com/macbooks \n \n 0:00 Intro \n 1:38 Top Notch Design \n 2:27 Let's Talk Ports \n 7:11 RIP Touchbar \n 8:20 The new displays \n 10:12 Living with the notch \n 12:37 Performance \n 19:39 Battery \n 20:30 So should you get it? \n \n The Verge Review: https://youtu.be/ftU1HzBKd5Y \n Tyler Stalman Review: https://youtu.be/I10WMJV96ns \n Developer's tweet: https://twitter.com/softwarejameson/status/1455971162060697613?s=09&t=WbOkVKgDdcegIdyOdurSNQ&utm_source=pocket_mylist \n \n Tech I'm using right now: https://www.amazon.com/shop/MKBHD \n \n Intro Track: http://youtube.com/20syl \n Playlist of MKBHD Intro music: https://goo.gl/B3AWV5 \n \n Laptop provided by Apple for review. \n \n ~ \n http://twitter.com/MKBHD \n http://instagram.com/MKBHD \n http://facebook.com/MKBHD " ,
channel : . init ( id : " " , name : " Channel Name " ) ,
likes : 2332 ,
dislikes : 30 ,
keywords : [ " Video " , " Computer " , " Long Long Keyword " ]
)
)
#if os ( iOS )
player . playerSize = . init ( width : UIScreen . main . bounds . width , height : UIScreen . main . bounds . height )
#endif
2021-10-06 01:50:09 +05:30
player . queue = Video . allFixtures . map { PlayerQueueItem ( $0 ) }
return player
}
2022-06-18 18:09:49 +05:30
private var playerControls : PlayerControlsModel {
2022-08-14 23:28:46 +05:30
PlayerControlsModel ( presentingControls : false , presentingControlsOverlay : true , player : player )
2022-06-18 18:09:49 +05:30
}
2021-10-06 01:50:09 +05:30
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 ( ) )
}
}