Update split view to also handle sync manager

This commit is contained in:
Jackson Harper
2023-12-15 15:29:37 +08:00
parent 13ca5cff0d
commit c4c9d6762b
2 changed files with 7 additions and 5 deletions

View File

@ -4,7 +4,7 @@ import SwiftUI
@MainActor
public struct LibrarySplitView: View {
@EnvironmentObject var audioController: AudioController
@EnvironmentObject var dataService: DataService
@StateObject private var inboxViewModel = HomeFeedViewModel(
folder: "inbox",
@ -28,7 +28,7 @@ public struct LibrarySplitView: View {
)
)
@State var selected = "home"
private let syncManager = LibrarySyncManager()
#if os(iOS)
public var body: some View {
@ -47,6 +47,11 @@ public struct LibrarySplitView: View {
$0.preferredPrimaryColumnWidth = 230
$0.displayModeButtonVisibility = .always
}
.onReceive(NSNotification.performSyncPublisher) { _ in
Task {
await syncManager.syncItems(dataService: dataService)
}
}
}
#endif

View File

@ -92,9 +92,6 @@ struct LibraryTabView: View {
ExpandedAudioPlayer()
}
.navigationBarHidden(true)
.task {
await syncManager.syncItems(dataService: dataService)
}
.onReceive(NSNotification.performSyncPublisher) { _ in
Task {
await syncManager.syncItems(dataService: dataService)