2021-09-29 11:45:00 +00:00
import Foundation
import SwiftUI
struct FixtureEnvironmentObjectsModifier : ViewModifier {
func body ( content : Content ) -> some View {
content
2021-10-17 23:06:00 +00:00
. environmentObject ( AccountsModel ( ) )
2022-07-01 21:28:32 +00:00
. environmentObject ( InstancesManifest ( ) )
2021-10-17 23:06:00 +00:00
. environmentObject ( invidious )
2021-09-29 11:45:00 +00:00
. environmentObject ( NavigationModel ( ) )
2022-06-18 12:39:49 +00:00
. environmentObject ( NetworkStateModel ( ) )
2021-10-17 23:06:00 +00:00
. environmentObject ( PipedAPI ( ) )
2021-10-05 20:20:09 +00:00
. environmentObject ( player )
2022-06-18 12:39:49 +00:00
. environmentObject ( playerControls )
. environmentObject ( PlayerTimeModel ( ) )
2021-09-29 11:45:00 +00:00
. environmentObject ( PlaylistsModel ( ) )
. environmentObject ( RecentsModel ( ) )
2022-07-03 20:22:57 +00:00
. environmentObject ( SettingsModel ( ) )
2021-10-05 20:20:09 +00:00
. environmentObject ( subscriptions )
2021-11-01 21:56:18 +00:00
. environmentObject ( ThumbnailsModel ( ) )
2021-09-29 12:36:52 +00:00
}
2021-10-17 23:06:00 +00:00
private var invidious : InvidiousAPI {
2021-09-29 12:36:52 +00:00
let api = InvidiousAPI ( )
api . validInstance = true
return api
2021-09-29 11:45:00 +00:00
}
2021-10-05 20:20:09 +00:00
private var player : PlayerModel {
let player = PlayerModel ( )
2022-08-19 21:55:02 +00:00
player . currentItem = PlayerQueueItem (
Video (
2022-12-09 00:15:19 +00:00
app : . invidious ,
2022-11-10 17:11:28 +00:00
videoID : " https://a/b/c " ,
2022-08-28 22:21:12 +00:00
title : " Video Name " ,
2022-08-19 21:55:02 +00:00
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 ,
2022-08-20 21:05:40 +00:00
keywords : [ " Video " , " Computer " , " Long Long Keyword " ] ,
chapters : [
. init (
title : " Abc " ,
image : URL ( string : " https://pipedproxy.kavin.rocks/vi/rr2XfL_df3o/hqdefault_29633.jpg?sqp=-oaymwEcCNACELwBSFXyq4qpAw4IARUAAIhCGAFwAcABBg%3D%3D&rs=AOn4CLDFDm9D5SvsIA7D3v5n5KZahLs_UA&host=i.ytimg.com " ) ! ,
start : 3
) ,
. init (
title : " Def " ,
image : URL ( string : " https://pipedproxy.kavin.rocks/vi/rr2XfL_df3o/hqdefault_98900.jpg?sqp=-oaymwEcCNACELwBSFXyq4qpAw4IARUAAIhCGAFwAcABBg%3D%3D&rs=AOn4CLCfjXJBJb2O2q0jT0RHIi7hARVahw&host=i.ytimg.com " ) ! ,
start : 33
)
]
2022-08-19 21:55:02 +00:00
)
)
#if os ( iOS )
player . playerSize = . init ( width : UIScreen . main . bounds . width , height : UIScreen . main . bounds . height )
#endif
2022-11-13 17:52:15 +00:00
let local = ( 1 . . . 10 ) . map { Video . local ( URL ( string : " https:// \( $0 ) " ) ! ) }
let videos = Video . allFixtures + local
player . queue = videos . map { PlayerQueueItem ( $0 ) }
2021-10-05 20:20:09 +00:00
return player
}
2022-06-18 12:39:49 +00:00
private var playerControls : PlayerControlsModel {
2022-09-01 23:05:31 +00:00
PlayerControlsModel ( presentingControls : true )
2022-06-18 12:39:49 +00:00
}
2021-10-05 20:20:09 +00:00
private var subscriptions : SubscriptionsModel {
let subscriptions = SubscriptionsModel ( )
subscriptions . channels = Video . allFixtures . map { $0 . channel }
return subscriptions
}
2021-09-29 11:45:00 +00:00
}
extension View {
func injectFixtureEnvironmentObjects ( ) -> some View {
modifier ( FixtureEnvironmentObjectsModifier ( ) )
}
}