Skip to content

Commit

Permalink
[iOS] - Already a Brave Premium User button works only sometimes (upl…
Browse files Browse the repository at this point in the history
…ift to 1.68.x) (#24489)

Uplift of #24483 (squashed) to beta
  • Loading branch information
brave-builds authored Jul 9, 2024
1 parent eb9eb12 commit f8507cc
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 6 deletions.
3 changes: 1 addition & 2 deletions ios/brave-ios/Sources/AIChat/Components/AIChatView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -302,9 +302,8 @@ public struct AIChatView: View {
await model.refreshPremiumStatus()
}
},
openPrivacyReportsUrl: {
refreshCredentials: {
openURL(.brave.braveLeoRefreshCredentials)

dismiss()
}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ struct AIChatPaywallView: View {

var premiumUpgrageSuccessful: ((AIChatSubscriptionTier) -> Void)?

var openPrivacyReportsUrl: (() -> Void)?
var refreshCredentials: (() -> Void)?

var body: some View {
NavigationView {
Expand Down Expand Up @@ -142,7 +142,8 @@ struct AIChatPaywallView: View {
}
}
.onChange(of: shouldRefreshCredentials) { shouldRefreshCredentials in
openPrivacyReportsUrl?()
dismiss()
refreshCredentials?()
}
}
.navigationViewStyle(.stack)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,12 @@ public struct AIChatAdvancedSettingsView: View {
await model.refreshPremiumStatus()
await viewModel.fetchCredentialSummary()
}
})
},
refreshCredentials: {
openURL(.brave.braveLeoRefreshCredentials)
dismiss()
}
)
}
.alert(isPresented: $appStoreConnectionErrorPresented) {
Alert(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ import SwiftUI

struct AIChatDefaultModelView: View {

@Environment(\.openURL)
private var openURL

@Environment(\.dismiss)
private var dismiss

Expand Down Expand Up @@ -84,7 +87,12 @@ struct AIChatDefaultModelView: View {
Task { @MainActor in
await aiModel.refreshPremiumStatus()
}
})
},
refreshCredentials: {
openURL(.brave.braveLeoRefreshCredentials)
dismiss()
}
)
}
}
}

0 comments on commit f8507cc

Please sign in to comment.