2021-09-25 13:48:22 +05:30
|
|
|
import Defaults
|
2021-07-19 04:02:46 +05:30
|
|
|
import SwiftUI
|
|
|
|
|
|
|
|
struct Player: UIViewControllerRepresentable {
|
2021-12-05 01:05:41 +05:30
|
|
|
@EnvironmentObject<CommentsModel> private var comments
|
2021-10-28 22:44:55 +05:30
|
|
|
@EnvironmentObject<NavigationModel> private var navigation
|
2021-10-06 01:50:09 +05:30
|
|
|
@EnvironmentObject<PlayerModel> private var player
|
2021-12-18 01:31:05 +05:30
|
|
|
@EnvironmentObject<SubscriptionsModel> private var subscriptions
|
2021-08-24 03:01:51 +05:30
|
|
|
|
2021-10-06 01:50:09 +05:30
|
|
|
var controller: PlayerViewController?
|
|
|
|
|
|
|
|
init(controller: PlayerViewController? = nil) {
|
|
|
|
self.controller = controller
|
|
|
|
}
|
2021-07-19 04:02:46 +05:30
|
|
|
|
|
|
|
func makeUIViewController(context _: Context) -> PlayerViewController {
|
2021-10-06 01:50:09 +05:30
|
|
|
if self.controller != nil {
|
|
|
|
return self.controller!
|
|
|
|
}
|
|
|
|
|
2021-07-19 04:02:46 +05:30
|
|
|
let controller = PlayerViewController()
|
2021-08-23 00:43:33 +05:30
|
|
|
|
2021-12-05 01:05:41 +05:30
|
|
|
controller.commentsModel = comments
|
2021-10-28 22:44:55 +05:30
|
|
|
controller.navigationModel = navigation
|
2021-10-06 01:50:09 +05:30
|
|
|
controller.playerModel = player
|
2021-12-18 01:31:05 +05:30
|
|
|
controller.subscriptionsModel = subscriptions
|
2021-10-17 04:18:58 +05:30
|
|
|
player.controller = controller
|
2021-07-19 04:02:46 +05:30
|
|
|
|
|
|
|
return controller
|
|
|
|
}
|
|
|
|
|
2021-10-25 03:56:25 +05:30
|
|
|
func updateUIViewController(_: PlayerViewController, context _: Context) {
|
|
|
|
player.rebuildTVMenu()
|
|
|
|
}
|
2021-07-19 04:02:46 +05:30
|
|
|
}
|