Some checks failed
CI / UI / Build (pull_request) Failing after 7s
CI / Scraper / Test (pull_request) Failing after 10s
CI / Scraper / Lint (pull_request) Failing after 10s
CI / Scraper / Build (pull_request) Has been skipped
iOS CI / Build (push) Has been cancelled
iOS CI / Test (push) Has been cancelled
iOS CI / Build (pull_request) Failing after 2s
iOS CI / Test (pull_request) Has been skipped
- Remove swift-markdown-ui dependency (project.yml, pbxproj, Package.resolved) - Remove all debug print() statements (APIClient, BrowseViewModel, ChapterReaderViewModel, ChapterReaderView) - Remove dead UI stubs: isFavorited/isLiked state, heart/star buttons, empty Share/Add to Library menu items in FullPlayerView - Remove unused audioToolbarButton toolbar builder in ChapterReaderView - Remove unused model types: NovelListing, BookDetailData, ChapterContent - Remove amberLight color (never referenced) - Remove mini player interactive seek (horizontal drag/tap to seek) — progress bar is now display-only - Fix AccentColor asset to amber #f59e0b (was orange-pink mismatch) - Fix Discover tab icon: globe → globe.americas.fill - Fix speed slider max: 3.0 → 2.0 in ProfileView - Fix yearText: use static DateFormatter instead of allocating on every access - Fix ChangePasswordView.save(): DispatchQueue.main.asyncAfter → Task.sleep - Deduplicate navigationDestination blocks via .appNavigationDestination() View extension - Deduplicate .alert(Error) pattern via .errorAlert() View extension
37 lines
1.3 KiB
Swift
37 lines
1.3 KiB
Swift
import SwiftUI
|
|
|
|
// MARK: - Navigation destination enum used across all tabs
|
|
|
|
enum NavDestination: Hashable {
|
|
case book(String) // slug
|
|
case chapter(String, Int) // slug + chapter number
|
|
}
|
|
|
|
// MARK: - View extensions for shared navigation + error alert patterns
|
|
|
|
extension View {
|
|
/// Registers the app-wide navigation destinations for NavDestination values.
|
|
/// Apply once per NavigationStack instead of repeating the switch in every tab.
|
|
func appNavigationDestination() -> some View {
|
|
navigationDestination(for: NavDestination.self) { dest in
|
|
switch dest {
|
|
case .book(let slug): BookDetailView(slug: slug)
|
|
case .chapter(let slug, let n): ChapterReaderView(slug: slug, chapterNumber: n)
|
|
}
|
|
}
|
|
}
|
|
|
|
/// Presents a standard "Error" alert driven by an optional String binding.
|
|
/// Dismissing the alert sets the binding back to nil.
|
|
func errorAlert(_ error: Binding<String?>) -> some View {
|
|
alert("Error", isPresented: Binding(
|
|
get: { error.wrappedValue != nil },
|
|
set: { if !$0 { error.wrappedValue = nil } }
|
|
)) {
|
|
Button("OK") { error.wrappedValue = nil }
|
|
} message: {
|
|
Text(error.wrappedValue ?? "")
|
|
}
|
|
}
|
|
}
|