Skip to content

Commit

Permalink
updated the terms of service and privacy policy links to open in-app
Browse files Browse the repository at this point in the history
  • Loading branch information
aboedo authored and NachoSoto committed Dec 8, 2023
1 parent 27138c4 commit 8f82621
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions RevenueCatUI/Views/FooterView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

import RevenueCat
import SwiftUI
import WebKit

@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
struct FooterView: View {
Expand Down Expand Up @@ -240,11 +241,10 @@ private struct LinkButton: View {
}

private func link(for title: String, bundle: Bundle) -> some View {
Link(
Self.localizedString(title, bundle),
destination: self.url
)
.frame(minHeight: Constants.minimumButtonHeight)
NavigationLink(destination: WebView(url: self.url)) {
Text(Self.localizedString(title, bundle))
.frame(minHeight: Constants.minimumButtonHeight)
}
}

private static func localizedString(_ string: String, _ bundle: Bundle) -> String {
Expand All @@ -257,6 +257,23 @@ private struct LinkButton: View {

}

@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
@available(watchOS, unavailable)
@available(macOS, unavailable)
@available(tvOS, unavailable)
private struct WebView: UIViewRepresentable {
let url: URL

func makeUIView(context: Context) -> WKWebView {
return WKWebView()
}

func updateUIView(_ uiView: WKWebView, context: Context) {
let request = URLRequest(url: url)
uiView.load(request)
}
}

// MARK: - Previews

#if DEBUG && canImport(SwiftUI) && canImport(UIKit)
Expand Down

0 comments on commit 8f82621

Please sign in to comment.