Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion TestApp/Sources/OPDS/OPDSCatalogs/OPDSCatalog.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import Foundation

struct OPDSCatalog: Identifiable, Equatable {
struct OPDSCatalog: Identifiable, Equatable, Hashable {
let id: String
var title: String
var url: URL
Expand Down
5 changes: 0 additions & 5 deletions TestApp/Sources/OPDS/OPDSCatalogs/OPDSCatalogRow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@ struct OPDSCatalogRow: View {
Image(systemName: "books.vertical.fill")
.foregroundColor(.accentColor)
Text(title)

Spacer()

Image(systemName: "chevron.right")
.foregroundColor(.gray)
}
}
}
Expand Down
38 changes: 21 additions & 17 deletions TestApp/Sources/OPDS/OPDSCatalogs/OPDSCatalogsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,32 @@ import SwiftUI
struct OPDSCatalogsView: View {
@State private var viewModel: OPDSCatalogsViewModel

init(viewModel: OPDSCatalogsViewModel) {
private var delegate: OPDSModuleDelegate?

init(viewModel: OPDSCatalogsViewModel, delegate: OPDSModuleDelegate?) {
self.viewModel = viewModel
self.delegate = delegate
}

var body: some View {
List(viewModel.catalogs) { catalog in
OPDSCatalogRow(title: catalog.title)
.contentShape(Rectangle())
.onTapGesture {
viewModel.onCatalogTap(id: catalog.id)
NavigationLink(value: catalog) {
OPDSCatalogRow(title: catalog.title)
}
.contentShape(Rectangle())
.swipeActions(allowsFullSwipe: false) {
Button(role: .destructive) {
viewModel.onDeleteCatalogTap(id: catalog.id)
} label: {
Label("Delete", systemImage: "trash")
}
.swipeActions(allowsFullSwipe: false) {
Button(role: .destructive) {
viewModel.onDeleteCatalogTap(id: catalog.id)
} label: {
Label("Delete", systemImage: "trash")
}

Button {
viewModel.onEditCatalogTap(id: catalog.id)
} label: {
Label("Edit", systemImage: "pencil")
}
Button {
viewModel.onEditCatalogTap(id: catalog.id)
} label: {
Label("Edit", systemImage: "pencil")
}
}
}
.listStyle(.plain)
.onAppear {
Expand All @@ -56,5 +58,7 @@ struct OPDSCatalogsView: View {
}

#Preview {
OPDSCatalogsView(viewModel: OPDSCatalogsViewModel())
NavigationStack {
OPDSCatalogsView(viewModel: OPDSCatalogsViewModel(), delegate: nil)
}
}
222 changes: 0 additions & 222 deletions TestApp/Sources/OPDS/OPDSFacets/Feed+preview.swift

This file was deleted.

39 changes: 0 additions & 39 deletions TestApp/Sources/OPDS/OPDSFacets/OPDSFacetLink.swift

This file was deleted.

51 changes: 0 additions & 51 deletions TestApp/Sources/OPDS/OPDSFacets/OPDSFacetList.swift

This file was deleted.

Loading