From a47578f13805729ba11727a5259bfe4402b98dfa Mon Sep 17 00:00:00 2001 From: Jackson Harper Date: Fri, 15 Dec 2023 21:57:28 +0800 Subject: [PATCH] Observe changes on library item objects --- .../Views/Home/Components/LibraryItemFetcher.swift | 1 - .../Components/LibraryItemListNavigationLink.swift | 5 +++-- .../Sources/App/Views/Home/HomeFeedViewIOS.swift | 14 ++++---------- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/apple/OmnivoreKit/Sources/App/Views/Home/Components/LibraryItemFetcher.swift b/apple/OmnivoreKit/Sources/App/Views/Home/Components/LibraryItemFetcher.swift index 3e1501ea0..60be5b5e0 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Home/Components/LibraryItemFetcher.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Home/Components/LibraryItemFetcher.swift @@ -246,7 +246,6 @@ import Views predicate: filter.predicate, sort: filter.sortDescriptor ) - print("FEATURE ITEMS: ", featureItems) } } else { featureItems = [] diff --git a/apple/OmnivoreKit/Sources/App/Views/Home/Components/LibraryItemListNavigationLink.swift b/apple/OmnivoreKit/Sources/App/Views/Home/Components/LibraryItemListNavigationLink.swift index 97dcc7efa..b36c66a46 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Home/Components/LibraryItemListNavigationLink.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Home/Components/LibraryItemListNavigationLink.swift @@ -32,7 +32,7 @@ struct LibraryItemListNavigationLink: View { @EnvironmentObject var dataService: DataService @EnvironmentObject var audioController: AudioController - let item: Models.LibraryItem + @ObservedObject var item: Models.LibraryItem @ObservedObject var viewModel: HomeFeedViewModel var body: some View { @@ -67,7 +67,8 @@ struct LibraryItemGridCardNavigationLink: View { @State private var scale = 1.0 - let item: Models.LibraryItem + @ObservedObject var item: Models.LibraryItem + let actionHandler: (GridCardAction) -> Void @Binding var isContextMenuOpen: Bool diff --git a/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewIOS.swift b/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewIOS.swift index a24141112..5acb17d8e 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewIOS.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewIOS.swift @@ -929,17 +929,11 @@ struct AnimatingCellHeight: AnimatableModifier { ScrollView { LazyVGrid(columns: [GridItem(.adaptive(minimum: 325, maximum: 400), spacing: 16)], alignment: .center, spacing: 30) { if viewModel.showLoadingBar { - // JACKSON TODO + ForEach(Array(fakeLibraryItems(dataService: dataService).enumerated()), id: \.1.id) { _, item in + GridCard(item: item, isContextMenuOpen: $isContextMenuOpen, actionHandler: { _ in - EmptyView() -// ForEach(fakeLibraryItems(dataService: dataService)) { item in -// GridCardNavigationLink( -// item: item, -// actionHandler: { contextMenuActionHandler(item: item, action: $0) }, -// isContextMenuOpen: $isContextMenuOpen, -// viewModel: viewModel -// ) -// }.redacted(reason: .placeholder) + }) + }.redacted(reason: .placeholder) } else { ForEach(viewModel.fetcher.items) { item in LibraryItemGridCardNavigationLink(