Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Commit

Permalink
Fix #7837: Don't initialize ads with wallet info when rewards is not …
Browse files Browse the repository at this point in the history
…enabled (#7884)

Bump brave-core to 1.57.47
Co-authored-by: Kyle Hickinson <[email protected]>
  • Loading branch information
iccub authored Aug 16, 2023
1 parent fea59db commit 8334b9a
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Sources/Brave/Frontend/Browser/BrowserViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ public class BrowserViewController: UIViewController {
if rewards.isEnabled {
rewards.startLedgerService(nil)
} else {
rewards.ads.initialize(walletInfo: .init()) { _ in }
rewards.ads.initialize() { _ in }
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ class NewTabPageViewController: UIViewController {
Preferences.BraveNews.userOptedIn.value = true
Preferences.BraveNews.isShowingOptIn.value = false
Preferences.BraveNews.isEnabled.value = true
rewards.ads.initialize(walletInfo: .init()) { [weak self] _ in
rewards.ads.initialize() { [weak self] _ in
// Initialize ads if it hasn't already been done
self?.loadFeedContents()
}
Expand Down
4 changes: 2 additions & 2 deletions Sources/Brave/Frontend/Rewards/BraveRewards.swift
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public class BraveRewards: NSObject {
recoverySeed: Data(seed).base64EncodedString()
)
}
self.ads.initialize(walletInfo: walletInfo ?? .init()) { success in
self.ads.initialize(walletInfo: walletInfo) { success in
if !success {
self.isAdsInitialized = false
} else {
Expand Down Expand Up @@ -168,7 +168,7 @@ public class BraveRewards: NSObject {
at: configuration.storageURL.appendingPathComponent("ads")
)
if ads.isEnabled {
ads.initialize(walletInfo: .init()) { _ in }
ads.initialize() { _ in }
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/BraveNews/Customize/NewsSettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ public struct NewsSettingsView: View {
OptInView { @MainActor in
Preferences.BraveNews.isShowingOptIn.value = false
// Initialize ads if it hasn't already been done
await dataSource.ads?.initialize(walletInfo: .init())
await dataSource.ads?.initialize()
if dataSource.isSourcesExpired {
await withCheckedContinuation { c in
dataSource.load {
Expand Down
4 changes: 2 additions & 2 deletions Sources/BraveShared/Extensions/BraveAdsExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Shared
import UIKit

extension BraveAds {
public func initialize(walletInfo: BraveAds.WalletInfo, completion: @escaping (Bool) -> Void) {
public func initialize(walletInfo: BraveAds.WalletInfo? = nil, completion: @escaping (Bool) -> Void) {
self.initialize(
with: .init(deviceId: UIDevice.current.identifierForVendor?.uuidString ?? ""),
buildChannelInfo: .init(
Expand All @@ -22,7 +22,7 @@ extension BraveAds {
}

@discardableResult
@MainActor public func initialize(walletInfo: BraveAds.WalletInfo) async -> Bool {
@MainActor public func initialize(walletInfo: BraveAds.WalletInfo? = nil) async -> Bool {
await withCheckedContinuation { c in
self.initialize(walletInfo: walletInfo) { success in
c.resume(returning: success)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,5 +239,9 @@ class MockBraveWalletService: BraveWalletBraveWalletService {
func discoverEthAllowances(_ completion: @escaping ([BraveWallet.AllowanceInfo]) -> Void) {
completion([])
}

func convertFevm(toFvmAddress isMainnet: Bool, fevmAddresses: [String], completion: @escaping ([String: String]) -> Void) {
completion([:])
}
}
#endif
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"license": "MPL-2.0",
"dependencies": {
"@mozilla/readability": "^0.4.2",
"brave-core-ios": "https://github.com/brave/brave-browser/releases/download/v1.57.42/brave-core-ios-1.57.42.tgz",
"brave-core-ios": "https://github.com/brave/brave-browser/releases/download/v1.57.47/brave-core-ios-1.57.47.tgz",
"leo-sf-symbols": "github:brave/leo-sf-symbols#992b64e89da8195041382804337bda9599cfdbf9",
"page-metadata-parser": "^1.1.3",
"webpack-cli": "^4.8.0"
Expand Down

0 comments on commit 8334b9a

Please sign in to comment.