Skip to content

Commit

Permalink
chore: add show progress param to web browser
Browse files Browse the repository at this point in the history
  • Loading branch information
eyatsenkoperpetio committed Dec 14, 2023
1 parent 7196b2b commit fec2fc2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
16 changes: 9 additions & 7 deletions Core/Core/View/Base/WebBrowser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,25 @@ import Theme

public struct WebBrowser: View {

var url: String
var pageTitle: String

@State private var isShowProgress: Bool = true
@State private var isLoading: Bool = true
@Environment(\.presentationMode) var presentationMode

private var url: String
private var pageTitle: String
private var showProgress: Bool

public init(url: String, pageTitle: String) {
public init(url: String, pageTitle: String, showProgress: Bool = false) {
self.url = url
self.pageTitle = pageTitle
self.showProgress = showProgress
}

public var body: some View {
GeometryReader { proxy in
ZStack(alignment: .center) {
Theme.Colors.background.ignoresSafeArea()
webView(proxy: proxy)
if isShowProgress {
if isLoading, showProgress {
HStack(alignment: .center) {
ProgressBar(
size: 40,
Expand All @@ -52,7 +54,7 @@ public struct WebBrowser: View {
)
WebView(
viewModel: .init(url: url, baseURL: ""),
isLoading: $isShowProgress,
isLoading: $isLoading,
refreshCookies: {}
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ struct ProfileSupportInfoView: View {
NavigationLink {
WebBrowser(
url: viewModel.url.absoluteString,
pageTitle: viewModel.title
pageTitle: viewModel.title,
showProgress: true
)
} label: {
HStack {
Expand Down

0 comments on commit fec2fc2

Please sign in to comment.