Fix observation of items for the grid
This commit is contained in:
@ -530,8 +530,13 @@ struct AnimatingCellHeight: AnimatableModifier {
|
||||
)
|
||||
} else {
|
||||
HomeFeedGridView(
|
||||
listTitle: $listTitle,
|
||||
isListScrolled: $isListScrolled,
|
||||
prefersListLayout: $prefersListLayout,
|
||||
isEditMode: $isEditMode,
|
||||
selection: $selection,
|
||||
viewModel: viewModel,
|
||||
isListScrolled: $isListScrolled
|
||||
showFeatureCards: showFeatureCards
|
||||
)
|
||||
}
|
||||
}.sheet(isPresented: $viewModel.showLabelsSheet) {
|
||||
@ -574,10 +579,6 @@ struct AnimatingCellHeight: AnimatableModifier {
|
||||
.dynamicTypeSize(.small ... .accessibility1)
|
||||
}
|
||||
|
||||
func menuItems(for item: Models.LibraryItem) -> some View {
|
||||
libraryItemMenu(dataService: dataService, viewModel: viewModel, item: item)
|
||||
}
|
||||
|
||||
var featureCard: some View {
|
||||
VStack(spacing: 0) {
|
||||
if Color.isDarkMode {
|
||||
@ -745,7 +746,7 @@ struct AnimatingCellHeight: AnimatableModifier {
|
||||
.listRowSeparatorTint(Color.thBorderColor)
|
||||
.listRowInsets(.init(top: 0, leading: horizontalInset, bottom: 10, trailing: horizontalInset))
|
||||
.contextMenu {
|
||||
menuItems(for: item)
|
||||
libraryItemMenu(dataService: dataService, viewModel: viewModel, item: item)
|
||||
}
|
||||
.swipeActions(edge: .leading, allowsFullSwipe: true) {
|
||||
if let listConfig = viewModel.currentListConfig {
|
||||
@ -938,11 +939,20 @@ struct AnimatingCellHeight: AnimatableModifier {
|
||||
@EnvironmentObject var dataService: DataService
|
||||
@EnvironmentObject var audioController: AudioController
|
||||
|
||||
@State var isContextMenuOpen = false
|
||||
@Binding var listTitle: String
|
||||
@Binding var isListScrolled: Bool
|
||||
@Binding var prefersListLayout: Bool
|
||||
@Binding var isEditMode: EditMode
|
||||
@State private var showHideFeatureAlert = false
|
||||
|
||||
@Binding var selection: Set<String>
|
||||
@ObservedObject var viewModel: HomeFeedViewModel
|
||||
|
||||
@Binding var isListScrolled: Bool
|
||||
let showFeatureCards: Bool
|
||||
|
||||
@State var shouldScrollToTop = false
|
||||
@State var topItem: Models.LibraryItem?
|
||||
@ObservedObject var networkMonitor = NetworkMonitor()
|
||||
|
||||
func contextMenuActionHandler(item: Models.LibraryItem, action: GridCardAction) {
|
||||
switch action {
|
||||
@ -972,10 +982,6 @@ struct AnimatingCellHeight: AnimatableModifier {
|
||||
.dynamicTypeSize(.small ... .accessibility1)
|
||||
}
|
||||
|
||||
func menuItems(for item: Models.LibraryItem) -> some View {
|
||||
libraryItemMenu(dataService: dataService, viewModel: viewModel, item: item)
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading) {
|
||||
Color.systemBackground.frame(height: 1)
|
||||
@ -1018,7 +1024,7 @@ struct AnimatingCellHeight: AnimatableModifier {
|
||||
viewModel: viewModel
|
||||
)
|
||||
.contextMenu {
|
||||
menuItems(for: item)
|
||||
libraryItemMenu(dataService: dataService, viewModel: viewModel, item: item)
|
||||
}
|
||||
.onAppear {
|
||||
if idx >= viewModel.fetcher.items.count - 5 {
|
||||
|
||||
@ -13,7 +13,7 @@ enum LoadingBarStyle {
|
||||
|
||||
@MainActor final class HomeFeedViewModel: NSObject, ObservableObject {
|
||||
let filterKey: String
|
||||
@Published var fetcher: LibraryItemFetcher
|
||||
@ObservedObject var fetcher: LibraryItemFetcher
|
||||
let folderConfigs: [String: LibraryListConfig]
|
||||
|
||||
@Published var isLoading = false
|
||||
|
||||
Reference in New Issue
Block a user