Improve history, resume videos, mark watched videos (fixes #42)

This commit is contained in:
Arkadiusz Fal
2021-12-26 22:14:46 +01:00
parent adcebb77a5
commit ac1c6685a1
31 changed files with 775 additions and 344 deletions

View File

@@ -5,9 +5,9 @@
"color-space" : "display-p3",
"components" : {
"alpha" : "1.000",
"blue" : "0.781",
"green" : "0.781",
"red" : "0.781"
"blue" : "0.757",
"green" : "0.761",
"red" : "0.757"
}
},
"idiom" : "universal"
@@ -23,9 +23,9 @@
"color-space" : "display-p3",
"components" : {
"alpha" : "1.000",
"blue" : "0.311",
"green" : "0.311",
"red" : "0.311"
"blue" : "0.259",
"green" : "0.259",
"red" : "0.259"
}
},
"idiom" : "universal"

View File

@@ -1,36 +0,0 @@
{
"colors" : [
{
"color" : {
"color-space" : "extended-gray",
"components" : {
"alpha" : "1.000",
"white" : "0.724"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "display-p3",
"components" : {
"alpha" : "1.000",
"blue" : "0.328",
"green" : "0.328",
"red" : "0.325"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@@ -1,38 +0,0 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.537",
"green" : "0.522",
"red" : "1.000"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.537",
"green" : "0.522",
"red" : "1.000"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@@ -1,38 +0,0 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.824",
"green" : "0.659",
"red" : "0.455"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.824",
"green" : "0.659",
"red" : "0.455"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@@ -1,38 +0,0 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.329",
"green" : "0.224",
"red" : "0.043"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.329",
"green" : "0.224",
"red" : "0.043"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@@ -5,9 +5,9 @@
"color-space" : "display-p3",
"components" : {
"alpha" : "1.000",
"blue" : "0.638",
"green" : "0.638",
"red" : "0.638"
"blue" : "0.263",
"green" : "0.290",
"red" : "0.859"
}
},
"idiom" : "universal"
@@ -23,9 +23,9 @@
"color-space" : "display-p3",
"components" : {
"alpha" : "1.000",
"blue" : "0.256",
"green" : "0.256",
"red" : "0.253"
"blue" : "0.263",
"green" : "0.290",
"red" : "0.859"
}
},
"idiom" : "universal"

View File

@@ -54,10 +54,12 @@ extension Defaults.Keys {
static let recentlyOpened = Key<[RecentItem]>("recentlyOpened", default: [])
static let queue = Key<[PlayerQueueItem]>("queue", default: [])
static let history = Key<[PlayerQueueItem]>("history", default: [])
static let lastPlayed = Key<PlayerQueueItem?>("lastPlayed")
static let saveHistory = Key<Bool>("saveHistory", default: true)
static let showWatchingProgress = Key<Bool>("showWatchingProgress", default: true)
static let watchedThreshold = Key<Int>("watchedThreshold", default: 90)
static let watchedVideoStyle = Key<WatchedVideoStyle>("watchedVideoStyle", default: .badge)
static let watchedVideoPlayNowBehavior = Key<WatchedVideoPlayNowBehavior>("watchedVideoPlayNowBehavior", default: .continue)
static let saveRecents = Key<Bool>("saveRecents", default: true)
static let trendingCategory = Key<TrendingCategory>("trendingCategory", default: .default)
@@ -146,6 +148,14 @@ enum VisibleSection: String, CaseIterable, Comparable, Defaults.Serializable {
}
}
enum WatchedVideoStyle: String, Defaults.Serializable {
case nothing, badge, decreasedOpacity
}
enum WatchedVideoPlayNowBehavior: String, Defaults.Serializable {
case `continue`, restart
}
#if !os(tvOS)
enum CommentsPlacement: String, CaseIterable, Defaults.Serializable {
case info, separate

View File

@@ -84,6 +84,7 @@ struct ContentView: View {
SettingsView()
.environmentObject(accounts)
.environmentObject(instances)
.environmentObject(player)
}
)
#endif
@@ -132,10 +133,6 @@ struct ContentView: View {
player.accounts = accounts
player.comments = comments
if !accounts.current.isNil {
player.loadHistoryDetails()
}
if !Defaults[.saveRecents] {
recents.clear()
}

View File

@@ -80,7 +80,7 @@ struct PlaybackBar: View {
private var closeButton: some View {
Button {
presentationMode.wrappedValue.dismiss()
player.hide()
} label: {
Label(
"Close",

View File

@@ -14,7 +14,7 @@ struct PlayerQueueRow: View {
var body: some View {
Group {
Button {
player.addCurrentItemToHistory()
player.prepareCurrentItemForHistory()
if history {
player.playHistory(item)

View File

@@ -6,6 +6,10 @@ struct PlayerQueueView: View {
@Binding var sidebarQueue: Bool
@Binding var fullScreen: Bool
@FetchRequest(sortDescriptors: [.init(key: "watchedAt", ascending: false)])
var watches: FetchedResults<Watch>
@EnvironmentObject<AccountsModel> private var accounts
@EnvironmentObject<PlayerModel> private var player
@Default(.saveHistory) private var saveHistory
@@ -46,23 +50,33 @@ struct PlayerQueueView: View {
ForEach(player.queue) { item in
PlayerQueueRow(item: item, fullScreen: $fullScreen)
.contextMenu {
removeButton(item, history: false)
removeAllButton(history: false)
removeButton(item)
removeAllButton()
}
}
}
}
private var visibleWatches: [Watch] {
watches.filter { $0.videoID != player.currentVideo?.videoID }
}
var playedPreviously: some View {
Group {
if !player.history.isEmpty {
if !visibleWatches.isEmpty {
Section(header: Text("Played Previously")) {
ForEach(player.history) { item in
PlayerQueueRow(item: item, history: true, fullScreen: $fullScreen)
.contextMenu {
removeButton(item, history: true)
removeAllButton(history: true)
}
ForEach(visibleWatches, id: \.videoID) { watch in
PlayerQueueRow(
item: PlayerQueueItem.from(watch, video: player.historyVideo(watch.videoID)),
history: true,
fullScreen: $fullScreen
)
.onAppear {
player.loadHistoryVideoDetails(watch.videoID)
}
.contextMenu {
removeHistoryButton(watch)
}
}
}
}
@@ -94,28 +108,28 @@ struct PlayerQueueView: View {
}
}
private func removeButton(_ item: PlayerQueueItem, history: Bool) -> some View {
private func removeButton(_ item: PlayerQueueItem) -> some View {
Button {
removeButtonAction(item, history: history)
player.remove(item)
} label: {
Label("Remove", systemImage: "trash")
}
}
private func removeButtonAction(_ item: PlayerQueueItem, history: Bool) {
_ = history ? player.removeHistory(item) : player.remove(item)
}
private func removeAllButton(history: Bool) -> some View {
private func removeAllButton() -> some View {
Button {
removeAllButtonAction(history: history)
player.removeQueueItems()
} label: {
Label("Remove All", systemImage: "trash.fill")
}
}
private func removeAllButtonAction(history: Bool) {
_ = history ? player.removeHistoryItems() : player.removeQueueItems()
private func removeHistoryButton(_ watch: Watch) -> some View {
Button {
player.removeWatch(watch)
} label: {
Label("Remove", systemImage: "trash")
}
}
}

View File

@@ -41,7 +41,7 @@ struct VideoDetails: View {
}
var video: Video? {
player.currentItem?.video
player.currentVideo
}
var body: some View {
@@ -423,7 +423,7 @@ struct VideoDetails: View {
var detailsPage: some View {
Group {
Group {
if let video = player.currentItem?.video {
if let video = player.currentVideo {
Group {
HStack {
publishedDateSection

View File

@@ -4,8 +4,6 @@ import SwiftUI
struct BrowsingSettings: View {
@Default(.channelOnThumbnail) private var channelOnThumbnail
@Default(.timeOnThumbnail) private var timeOnThumbnail
@Default(.saveRecents) private var saveRecents
@Default(.saveHistory) private var saveHistory
@Default(.visibleSections) private var visibleSections
var body: some View {
@@ -13,8 +11,6 @@ struct BrowsingSettings: View {
Section(header: SettingsHeader(text: "Browsing")) {
Toggle("Show channel name on thumbnail", isOn: $channelOnThumbnail)
Toggle("Show video length on thumbnail", isOn: $timeOnThumbnail)
Toggle("Save recent queries and channels", isOn: $saveRecents)
Toggle("Save history of played videos", isOn: $saveHistory)
}
Section(header: SettingsHeader(text: "Sections")) {
#if os(macOS)

View File

@@ -0,0 +1,142 @@
import Defaults
import SwiftUI
struct HistorySettings: View {
static let watchedThresholds = [50, 60, 70, 80, 90, 95, 100]
@State private var presentingClearHistoryConfirmation = false
@EnvironmentObject<PlayerModel> private var player
@Default(.saveRecents) private var saveRecents
@Default(.saveHistory) private var saveHistory
@Default(.showWatchingProgress) private var showWatchingProgress
@Default(.watchedThreshold) private var watchedThreshold
@Default(.watchedVideoStyle) private var watchedVideoStyle
@Default(.watchedVideoPlayNowBehavior) private var watchedVideoPlayNowBehavior
var body: some View {
Group {
Section(header: SettingsHeader(text: "History")) {
Toggle("Save recent queries and channels", isOn: $saveRecents)
Toggle("Save history of played videos", isOn: $saveHistory)
Toggle("Show progress of watching on thumbnails", isOn: $showWatchingProgress)
.disabled(!saveHistory)
#if !os(tvOS)
watchedThresholdPicker
watchedVideoStylePicker
watchedVideoPlayNowBehaviorPicker
#endif
}
#if os(tvOS)
watchedThresholdPicker
watchedVideoStylePicker
watchedVideoPlayNowBehaviorPicker
#endif
#if os(macOS)
Spacer()
#endif
clearHistoryButton
}
}
private var watchedThresholdPicker: some View {
Section(header: header("Mark video as watched after playing")) {
Picker("Mark video as watched after playing", selection: $watchedThreshold) {
ForEach(Self.watchedThresholds, id: \.self) { threshold in
Text("\(threshold)%").tag(threshold)
}
}
.disabled(!saveHistory)
.labelsHidden()
#if os(iOS)
.pickerStyle(.automatic)
#elseif os(tvOS)
.pickerStyle(.inline)
#endif
}
}
private var watchedVideoStylePicker: some View {
Section(header: header("Mark watched videos with")) {
Picker("Mark watched videos with", selection: $watchedVideoStyle) {
Text("Nothing").tag(WatchedVideoStyle.nothing)
Text("Badge").tag(WatchedVideoStyle.badge)
Text("Decreased opacity").tag(WatchedVideoStyle.decreasedOpacity)
}
.disabled(!saveHistory)
.labelsHidden()
#if os(iOS)
.pickerStyle(.automatic)
#elseif os(tvOS)
.pickerStyle(.inline)
#endif
}
}
private var watchedVideoPlayNowBehaviorPicker: some View {
Section(header: header("When partially watched video is played")) {
Picker("When partially watched video is played", selection: $watchedVideoPlayNowBehavior) {
Text("Continue").tag(WatchedVideoPlayNowBehavior.continue)
Text("Restart").tag(WatchedVideoPlayNowBehavior.restart)
}
.disabled(!saveHistory)
.labelsHidden()
#if os(iOS)
.pickerStyle(.automatic)
#elseif os(tvOS)
.pickerStyle(.inline)
#endif
}
}
private var clearHistoryButton: some View {
Button("Clear History") {
presentingClearHistoryConfirmation = true
}
.alert(isPresented: $presentingClearHistoryConfirmation) {
Alert(
title: Text(
"Are you sure you want to clear history of watched videos?"
),
message: Text(
"This cannot be undone. You might need to switch between views or restart the app to see changes."
),
primaryButton: .destructive(Text("Clear All")) {
player.removeAllWatches()
presentingClearHistoryConfirmation = false
},
secondaryButton: .cancel()
)
}
.foregroundColor(.red)
.disabled(!saveHistory)
}
private func header(_ text: String) -> some View {
#if os(iOS)
return EmptyView()
#elseif os(macOS)
return Text(text)
.opacity(saveHistory ? 1 : 0.3)
#else
return Text(text)
.foregroundColor(.secondary)
.opacity(saveHistory ? 1 : 0.2)
#endif
}
}
struct HistorySettings_Previews: PreviewProvider {
static var previews: some View {
HistorySettings()
.injectFixtureEnvironmentObjects()
}
}

View File

@@ -5,7 +5,7 @@ import SwiftUI
struct SettingsView: View {
#if os(macOS)
private enum Tabs: Hashable {
case instances, browsing, playback, services, updates
case instances, browsing, history, playback, services, updates
}
#endif
@@ -42,6 +42,14 @@ struct SettingsView: View {
}
.tag(Tabs.browsing)
Form {
HistorySettings()
}
.tabItem {
Label("History", systemImage: "clock.arrow.circlepath")
}
.tag(Tabs.history)
Form {
PlaybackSettings()
}
@@ -89,6 +97,7 @@ struct SettingsView: View {
}
BrowsingSettings()
HistorySettings()
PlaybackSettings()
ServicesSettings()
}

View File

@@ -96,7 +96,7 @@ struct VideoBanner: View {
private var progressView: some View {
Group {
if !playbackTime.isNil {
if !playbackTime.isNil, !(video?.live ?? false) {
ProgressView(value: progressViewValue, total: progressViewTotal)
.progressViewStyle(.linear)
.frame(maxWidth: thumbnailWidth)

View File

@@ -3,7 +3,7 @@ import SDWebImageSwiftUI
import SwiftUI
struct VideoCell: View {
var video: Video
private var video: Video
@Environment(\.inNavigationView) private var inNavigationView
@@ -18,25 +18,25 @@ struct VideoCell: View {
@Default(.channelOnThumbnail) private var channelOnThumbnail
@Default(.timeOnThumbnail) private var timeOnThumbnail
@Default(.saveHistory) private var saveHistory
@Default(.showWatchingProgress) private var showWatchingProgress
@Default(.watchedVideoStyle) private var watchedVideoStyle
@Default(.watchedVideoPlayNowBehavior) private var watchedVideoPlayNowBehavior
@FetchRequest private var watchRequest: FetchedResults<Watch>
init(video: Video) {
self.video = video
_watchRequest = video.watchFetchRequest
}
var body: some View {
Group {
Button(action: {
player.playNow(video)
guard !player.playingInPictureInPicture else {
return
}
if inNavigationView {
player.playerNavigationLinkActive = true
} else {
player.show()
}
}) {
Button(action: playAction) {
content
}
}
.opacity(contentOpacity)
.buttonStyle(.plain)
.contentShape(RoundedRectangle(cornerRadius: 12))
.contextMenu {
@@ -48,7 +48,50 @@ struct VideoCell: View {
}
}
var content: some View {
private func playAction() {
if watchingNow {
if !player.playingInPictureInPicture {
player.show()
}
if !playNowContinues {
player.player.seek(to: .zero)
}
player.play()
return
}
var playAt: TimeInterval?
if playNowContinues,
!watch.isNil,
!watch!.finished
{
playAt = watch!.stoppedAt
}
player.play(video, at: playAt, inNavigationView: inNavigationView)
}
private var playNowContinues: Bool {
watchedVideoPlayNowBehavior == .continue
}
private var watch: Watch? {
watchRequest.first
}
private var finished: Bool {
watch?.finished ?? false
}
private var watchingNow: Bool {
player.currentVideo == video
}
private var content: some View {
VStack {
#if os(iOS)
if verticalSizeClass == .compact, !horizontalCells {
@@ -66,8 +109,19 @@ struct VideoCell: View {
#endif
}
private var contentOpacity: Double {
guard saveHistory,
!watch.isNil,
watchedVideoStyle == .decreasedOpacity
else {
return 1
}
return watch!.finished ? 0.5 : 1
}
#if os(iOS)
var horizontalRow: some View {
private var horizontalRow: some View {
HStack(alignment: .top, spacing: 2) {
Section {
#if os(tvOS)
@@ -151,7 +205,7 @@ struct VideoCell: View {
}
#endif
var verticalRow: some View {
private var verticalRow: some View {
VStack(alignment: .leading, spacing: 0) {
thumbnail
@@ -201,7 +255,7 @@ struct VideoCell: View {
}
}
if let time = video.length.formattedAsPlaybackTime(), !timeOnThumbnail {
if let time = time, !timeOnThumbnail {
Spacer()
HStack(spacing: 2) {
@@ -225,13 +279,30 @@ struct VideoCell: View {
}
}
var additionalDetailsAvailable: Bool {
video.publishedDate != nil || video.views != 0 || (!timeOnThumbnail && !video.length.formattedAsPlaybackTime().isNil)
private var additionalDetailsAvailable: Bool {
video.publishedDate != nil || video.views != 0 ||
(!timeOnThumbnail && !video.length.formattedAsPlaybackTime().isNil)
}
var thumbnail: some View {
private var thumbnail: some View {
ZStack(alignment: .leading) {
thumbnailImage
ZStack(alignment: .bottomLeading) {
thumbnailImage
if saveHistory, showWatchingProgress, watch?.progress ?? 0 > 0 {
ProgressView(value: watch!.progress, total: 100)
.progressViewStyle(LinearProgressViewStyle(tint: Color("WatchProgressBarColor")))
#if os(tvOS)
.padding(.horizontal, 16)
#else
.padding(.horizontal, 10)
#endif
#if os(macOS)
.offset(x: 0, y: 4)
#else
.offset(x: 0, y: -3)
#endif
}
}
VStack {
HStack(alignment: .top) {
@@ -247,24 +318,49 @@ struct VideoCell: View {
DetailBadge(text: video.author, style: .prominent)
}
}
#if os(tvOS)
.padding(16)
#else
.padding(10)
#endif
Spacer()
HStack(alignment: .top) {
HStack(alignment: .center) {
if saveHistory,
watchedVideoStyle == .badge,
watch?.finished ?? false
{
Image(systemName: "checkmark.circle.fill")
.foregroundColor(Color("WatchProgressBarColor"))
.background(Color.white)
.clipShape(Circle())
#if os(tvOS)
.font(.system(size: 40))
#else
.font(.system(size: 30))
#endif
}
Spacer()
if timeOnThumbnail, let time = video.length.formattedAsPlaybackTime() {
if timeOnThumbnail,
!video.live,
let time = time
{
DetailBadge(text: time, style: .prominent)
}
}
#if os(tvOS)
.padding(16)
#else
.padding(10)
#endif
}
.lineLimit(1)
}
}
var thumbnailImage: some View {
private var thumbnailImage: some View {
Group {
if let url = thumbnails.best(video) {
WebImage(url: url)
@@ -293,7 +389,29 @@ struct VideoCell: View {
.modifier(AspectRatioModifier())
}
func videoDetail(_ text: String, lineLimit: Int = 1) -> some View {
private var time: String? {
guard var videoTime = video.length.formattedAsPlaybackTime() else {
return nil
}
if !saveHistory || !showWatchingProgress || watch?.finished ?? false {
return videoTime
}
if let stoppedAt = watch?.stoppedAt,
stoppedAt.isFinite,
let stoppedAtFormatted = stoppedAt.formattedAsPlaybackTime()
{
if watch?.videoDuration ?? 0 > 0 {
videoTime = watch!.videoDuration.formattedAsPlaybackTime() ?? "?"
}
return "\(stoppedAtFormatted) / \(videoTime)"
}
return videoTime
}
private func videoDetail(_ text: String, lineLimit: Int = 1) -> some View {
Text(text)
.fontWeight(.bold)
.lineLimit(lineLimit)
@@ -309,7 +427,10 @@ struct VideoCell: View {
content
} else {
content
.aspectRatio(1.777, contentMode: .fill)
.aspectRatio(
VideoPlayerView.defaultAspectRatio,
contentMode: .fill
)
}
}
}

View File

@@ -31,12 +31,12 @@ struct PlayerControlsView<Content: View>: View {
}) {
HStack {
VStack(alignment: .leading, spacing: 3) {
Text(model.currentItem?.video?.title ?? "Not playing")
Text(model.currentVideo?.title ?? "Not playing")
.font(.system(size: 14).bold())
.foregroundColor(model.currentItem.isNil ? .secondary : .accentColor)
.lineLimit(1)
Text(model.currentItem?.video?.author ?? "Yattee v\(appVersion) (build \(appBuild))")
Text(model.currentVideo?.author ?? "Yattee v\(appVersion) (build \(appBuild))")
.fontWeight(model.currentItem.isNil ? .light : .bold)
.font(.system(size: 10))
.foregroundColor(.secondary)

View File

@@ -1,3 +1,4 @@
import CoreData
import Defaults
import SwiftUI
@@ -19,7 +20,35 @@ struct VideoContextMenuView: View {
@EnvironmentObject<RecentsModel> private var recents
@EnvironmentObject<SubscriptionsModel> private var subscriptions
@FetchRequest private var watchRequest: FetchedResults<Watch>
@Default(.saveHistory) private var saveHistory
private var viewContext: NSManagedObjectContext = PersistenceController.shared.container.viewContext
init(video: Video, playerNavigationLinkActive: Binding<Bool>) {
self.video = video
_playerNavigationLinkActive = playerNavigationLinkActive
_watchRequest = video.watchFetchRequest
}
var body: some View {
if saveHistory {
Section {
if let watchedAtString = watchedAtString {
Text(watchedAtString)
}
if !watch.isNil, !watch!.finished, !watchingNow {
continueButton
}
if !watch.isNil, !watchingNow {
removeFromHistoryButton
}
}
}
Section {
playNowButton
}
@@ -54,19 +83,49 @@ struct VideoContextMenuView: View {
#endif
}
private var playNowButton: some View {
Button {
player.playNow(video)
private var watch: Watch? {
watchRequest.first
}
guard !player.playingInPictureInPicture else {
private var watchingNow: Bool {
player.currentVideo == video
}
private var watchedAtString: String? {
if watchingNow {
return "Watching now"
}
if let watch = watch, let watchedAtString = watch.watchedAtString {
return "Watched \(watchedAtString)"
}
return nil
}
private var continueButton: some View {
Button {
player.play(video, at: watch!.stoppedAt, inNavigationView: inNavigationView)
} label: {
Label("Continue from \(watch!.stoppedAt.formattedAsPlaybackTime() ?? "where I left off")", systemImage: "playpause")
}
}
var removeFromHistoryButton: some View {
Button {
guard let watch = watch else {
return
}
if inNavigationView {
playerNavigationLinkActive = true
} else {
player.show()
}
player.removeWatch(watch)
} label: {
Label("Remove from history", systemImage: "delete.left.fill")
}
}
private var playNowButton: some View {
Button {
player.play(video, inNavigationView: inNavigationView)
} label: {
Label("Play Now", systemImage: "play")
}

View File

@@ -20,9 +20,12 @@ struct YatteeApp: App {
@StateObject private var subscriptions = SubscriptionsModel()
@StateObject private var thumbnails = ThumbnailsModel()
let persistenceController = PersistenceController.shared
var body: some Scene {
WindowGroup {
ContentView()
.environment(\.managedObjectContext, persistenceController.container.viewContext)
.environmentObject(accounts)
.environmentObject(comments)
.environmentObject(instances)
@@ -70,6 +73,7 @@ struct YatteeApp: App {
VideoPlayerView()
.onAppear { player.presentingPlayer = true }
.onDisappear { player.presentingPlayer = false }
.environment(\.managedObjectContext, persistenceController.container.viewContext)
.environment(\.navigationStyle, .sidebar)
.environmentObject(accounts)
.environmentObject(comments)
@@ -86,8 +90,10 @@ struct YatteeApp: App {
Settings {
SettingsView()
.environment(\.managedObjectContext, persistenceController.container.viewContext)
.environmentObject(accounts)
.environmentObject(instances)
.environmentObject(player)
.environmentObject(updater)
}
#endif