- Created BookmarkDetailView2 with native SwiftUI WebView (iOS 26+) - Refactored BookmarkDetailView as version router - Renamed original implementation to BookmarkDetailLegacyView - Moved Archive/Favorite buttons to bottom toolbar using ToolbarItemGroup - Added toggle button to switch between native and legacy views - Implemented onScrollPhaseChange for optimized reading progress tracking - Added NativeWebView component with improved JavaScript height detection - All changes preserve existing functionality while adding modern alternatives
31 lines
1019 B
Swift
31 lines
1019 B
Swift
import SwiftUI
|
|
|
|
/// Container view that routes to the appropriate BookmarkDetail implementation
|
|
/// based on iOS version availability or user preference
|
|
struct BookmarkDetailView: View {
|
|
let bookmarkId: String
|
|
|
|
@AppStorage("useNativeWebView") private var useNativeWebView: Bool = true
|
|
|
|
var body: some View {
|
|
if #available(iOS 26.0, *) {
|
|
if useNativeWebView {
|
|
// Use modern SwiftUI-native implementation on iOS 26+
|
|
BookmarkDetailView2(bookmarkId: bookmarkId, useNativeWebView: $useNativeWebView)
|
|
} else {
|
|
// Use legacy WKWebView-based implementation
|
|
BookmarkDetailLegacyView(bookmarkId: bookmarkId, useNativeWebView: $useNativeWebView)
|
|
}
|
|
} else {
|
|
// iOS < 26: always use Legacy
|
|
BookmarkDetailLegacyView(bookmarkId: bookmarkId, useNativeWebView: .constant(false))
|
|
}
|
|
}
|
|
}
|
|
|
|
#Preview {
|
|
NavigationView {
|
|
BookmarkDetailView(bookmarkId: "123")
|
|
}
|
|
}
|