diff --git a/apple/OmnivoreKit/Sources/App/Views/Home/Components/LibraryFeatureCardNavigationLink.swift b/apple/OmnivoreKit/Sources/App/Views/Home/Components/LibraryFeatureCardNavigationLink.swift index 4f7cb2537..05c9d4b50 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Home/Components/LibraryFeatureCardNavigationLink.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Home/Components/LibraryFeatureCardNavigationLink.swift @@ -17,11 +17,12 @@ struct LibraryFeatureCardNavigationLink: View { let item: LinkedItem @ObservedObject var viewModel: HomeFeedViewModel - let onLongPress: (LinkedItem) -> Void + @State var showFeatureActions = false var body: some View { ZStack { Button { + showFeatureActions = false viewModel.selectedItem = item viewModel.linkIsActive = true } label: { @@ -32,8 +33,35 @@ struct LibraryFeatureCardNavigationLink: View { .buttonStyle(PlainButtonStyle()) LibraryFeatureCard(item: item, viewer: dataService.currentViewer) } + .confirmationDialog("", isPresented: $showFeatureActions) { + if FeaturedItemFilter(rawValue: viewModel.featureFilter) == .pinned { + Button("Unpin", action: { + viewModel.unpinItem(dataService: dataService, item: item) + }) + } + Button("Pin", action: { + viewModel.pinItem(dataService: dataService, item: item) + }) + Button("Archive", action: { + viewModel.setLinkArchived(dataService: dataService, objectID: item.objectID, archived: true) + }) + Button("Remove", action: { + viewModel.removeLink(dataService: dataService, objectID: item.objectID) + }) + if FeaturedItemFilter(rawValue: viewModel.featureFilter) != .pinned { + Button("Mark Read", action: { + viewModel.markRead(dataService: dataService, item: item) + }) + Button("Mark Unread", action: { + viewModel.markUnread(dataService: dataService, item: item) + }) + } + Button("Dismiss", role: .cancel, action: { + showFeatureActions = false + }) + } .delayedGesture(LongPressGesture().onEnded { _ in - onLongPress(item) + showFeatureActions = true }) } } diff --git a/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewIOS.swift b/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewIOS.swift index 9fd2b8ab4..325e015a8 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewIOS.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewIOS.swift @@ -261,8 +261,6 @@ struct AnimatingCellHeight: AnimatableModifier { @State private var itemToRemove: LinkedItem? @State private var confirmationShown = false @State private var showHideFeatureAlert = false - @State var showFeatureActions = false - @State var selectedFeatureItem: LinkedItem? @ObservedObject var viewModel: HomeFeedViewModel @@ -413,13 +411,10 @@ struct AnimatingCellHeight: AnimatableModifier { GeometryReader { geo in ScrollView(.horizontal, showsIndicators: false) { if viewModel.featureItems.count > 0 { - LazyHStack(alignment: .top, spacing: 15) { + HStack(alignment: .top, spacing: 15) { Spacer(minLength: 1).frame(width: 1) ForEach(viewModel.featureItems) { item in - LibraryFeatureCardNavigationLink(item: item, viewModel: viewModel, onLongPress: { item in - self.selectedFeatureItem = item - self.showFeatureActions = true - }) + LibraryFeatureCardNavigationLink(item: item, viewModel: viewModel) } Spacer(minLength: 1).frame(width: 1) } @@ -435,7 +430,7 @@ struct AnimatingCellHeight: AnimatableModifier { } } } - .background(Color.isDarkMode ? Color(hex: "#2A2A2A") : Color.systemBackground) + .background(Color.isDarkMode ? Color(hex: "#1C1C1C") : Color.systemBackground) .frame(height: 190) if !Color.isDarkMode { @@ -530,36 +525,6 @@ struct AnimatingCellHeight: AnimatableModifier { } Button(LocalText.cancelGeneric, role: .cancel) { self.showHideFeatureAlert = false } } - .confirmationDialog("", isPresented: $showFeatureActions) { - if let item = selectedFeatureItem { - if FeaturedItemFilter(rawValue: viewModel.featureFilter) == .pinned { - Button("Unpin", action: { - viewModel.unpinItem(dataService: dataService, item: item) - }) - } - Button("Pin", action: { - viewModel.pinItem(dataService: dataService, item: item) - }) - Button("Archive", action: { - viewModel.setLinkArchived(dataService: dataService, objectID: item.objectID, archived: true) - }) - Button("Remove", action: { - itemToRemove = item - confirmationShown = true - }) - if FeaturedItemFilter(rawValue: viewModel.featureFilter) != .pinned { - Button("Mark Read", action: { - viewModel.markRead(dataService: dataService, item: item) - }) - Button("Mark Unread", action: { - viewModel.markUnread(dataService: dataService, item: item) - }) - } - Button("Dismiss", role: .cancel, action: { - showFeatureActions = false - }) - } - } } func swipeActionButton(action: SwipeAction, item: LinkedItem) -> AnyView {