[iOS] [Origin] Dont show sponsored images when rewards is unavailable (#36613)

This also hides the option from the NTP settings page
This commit is contained in:
Kyle Hickinson
2026-05-21 15:36:45 -04:00
committed by GitHub
parent 4a6eadb36e
commit c51ef668da
3 changed files with 7 additions and 3 deletions
@@ -300,7 +300,8 @@ public class BrowserViewController: UIViewController {
feedDataSource.historyAPI = profileController.historyAPI
backgroundDataSource = .init(
service: profileController.backgroundImagesService,
rewards: rewards,
rewards: BraveRewards.isSupported(prefService: profileController.profile.prefs)
? rewards : nil,
privateBrowsingManager: privateBrowsingManager
)
@@ -9,6 +9,7 @@ import Preferences
import SwiftUI
struct NewTabPageSettingsView: View {
var isSponsoredBackgroundsSupported: Bool
var shouldShowSponsoredImagesAndVideosSetting: Bool
var linkTapped: ((URLRequest) -> Void)?
@@ -25,7 +26,7 @@ struct NewTabPageSettingsView: View {
Section {
Toggle(Strings.NTP.settingsBackgroundImages, isOn: $backgroundImages.value)
.listRowBackground(Color(.secondaryBraveGroupedBackground))
if backgroundImages.value {
if backgroundImages.value, isSponsoredBackgroundsSupported {
NavigationLink {
BackgroundMediaTypePicker(
shouldShowSponsoredImagesAndVideosSetting: shouldShowSponsoredImagesAndVideosSetting,
@@ -132,6 +133,7 @@ class NTPTableViewController: UIHostingController<NewTabPageSettingsView> {
init(rewards: BraveRewards?, linkTapped: ((URLRequest) -> Void)?) {
super.init(
rootView: .init(
isSponsoredBackgroundsSupported: rewards != nil,
shouldShowSponsoredImagesAndVideosSetting:
rewards?.ads.shouldShowSponsoredImagesAndVideosSetting() == true,
linkTapped: linkTapped
@@ -1167,7 +1167,8 @@ class SettingsViewController: TableViewController, BraveAccountAuthenticationObs
selection: { [unowned self] in
self.navigationController?.pushViewController(
NTPTableViewController(
rewards: rewards,
rewards: BraveRewards.isSupported(prefService: braveCore.profile.prefs)
? rewards : nil,
linkTapped: { [unowned self] request in
self.tabManager.addTabAndSelect(
request,