You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.4 KiB
50 lines
1.4 KiB
import SwiftUI
|
|
import WebKit
|
|
|
|
struct PrivacyPolicyView: View {
|
|
@EnvironmentObject private var languageManager: LanguageManager
|
|
|
|
var body: some View {
|
|
NavigationView {
|
|
ZStack {
|
|
// 背景渐变
|
|
LinearGradient(
|
|
gradient: Gradient(colors: [
|
|
Color(.systemBackground),
|
|
Color(.systemGray6).opacity(0.2)
|
|
]),
|
|
startPoint: .top,
|
|
endPoint: .bottom
|
|
)
|
|
.ignoresSafeArea()
|
|
|
|
// WebView显示HTML隐私政策
|
|
WebView(url: Bundle.main.url(forResource: "privacy_policy", withExtension: "html")!)
|
|
.ignoresSafeArea(.container, edges: .bottom)
|
|
}
|
|
.navigationTitle("Privacy Policy")
|
|
.navigationBarTitleDisplayMode(.inline)
|
|
}
|
|
}
|
|
}
|
|
|
|
// MARK: - WebView
|
|
struct WebView: UIViewRepresentable {
|
|
let url: URL
|
|
|
|
func makeUIView(context: Context) -> WKWebView {
|
|
let webView = WKWebView()
|
|
webView.loadFileURL(url, allowingReadAccessTo: url.deletingLastPathComponent())
|
|
return webView
|
|
}
|
|
|
|
func updateUIView(_ uiView: WKWebView, context: Context) {
|
|
// 不需要更新
|
|
}
|
|
}
|
|
|
|
#Preview {
|
|
PrivacyPolicyView()
|
|
.environmentObject(LanguageManager.shared)
|
|
}
|