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

Commit

Permalink
Fix #7728: Bump BraveCore to 1.56.6
Browse files Browse the repository at this point in the history
  • Loading branch information
kylehickinson committed Jul 17, 2023
1 parent e8e37a8 commit 265b411
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 18 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 @@ -335,7 +335,7 @@ public class BrowserViewController: UIViewController {
if rewards.isEnabled {
rewards.startLedgerService(nil)
} else {
rewards.ads.initialize { _ in }
rewards.ads.initialize(walletInfo: .init()) { _ in }
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ class NewTabPageViewController: UIViewController {
Preferences.BraveNews.userOptedIn.value = true
Preferences.BraveNews.isShowingOptIn.value = false
Preferences.BraveNews.isEnabled.value = true
rewards.ads.initialize { [weak self] _ in
rewards.ads.initialize(walletInfo: .init()) { [weak self] _ in
// Initialize ads if it hasn't already been done
self?.loadFeedContents()
}
Expand Down
11 changes: 6 additions & 5 deletions Sources/Brave/Frontend/Rewards/BraveRewards.swift
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,15 @@ public class BraveRewards: NSObject {
isAdsInitialized = true
guard let ledger = ledger else { return }
ledger.currentWalletInfo { wallet in
var walletInfo: BraveAds.WalletInfo?
if let wallet = wallet {
let seed = wallet.recoverySeed.map(\.uint8Value)
self.ads.updateWalletInfo(
wallet.paymentId,
base64Seed: Data(seed).base64EncodedString()
walletInfo = .init(
paymentId: wallet.paymentId,
recoverySeed: Data(seed).base64EncodedString()
)
}
self.ads.initialize() { success in
self.ads.initialize(walletInfo: walletInfo ?? .init()) { success in
if !success {
self.isAdsInitialized = false
}
Expand Down Expand Up @@ -163,7 +164,7 @@ public class BraveRewards: NSObject {
at: configuration.storageURL.appendingPathComponent("ads")
)
if ads.isEnabled {
ads.initialize { _ in }
ads.initialize(walletInfo: .init()) { _ 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()
await dataSource.ads?.initialize(walletInfo: .init())
if dataSource.isSourcesExpired {
await withCheckedContinuation { c in
dataSource.load {
Expand Down
7 changes: 4 additions & 3 deletions Sources/BraveShared/Extensions/BraveAdsExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,22 @@ import Shared
import UIKit

extension BraveAds {
public func initialize(_ completion: @escaping (Bool) -> Void) {
public func initialize(walletInfo: BraveAds.WalletInfo, completion: @escaping (Bool) -> Void) {
self.initialize(
with: .init(deviceId: UIDevice.current.identifierForVendor?.uuidString ?? ""),
buildChannelInfo: .init(
isRelease: AppConstants.buildChannel == .release,
name: AppConstants.buildChannel.rawValue
),
walletInfo: walletInfo,
completion: completion
)
}

@discardableResult
@MainActor public func initialize() async -> Bool {
@MainActor public func initialize(walletInfo: BraveAds.WalletInfo) async -> Bool {
await withCheckedContinuation { c in
self.initialize { success in
self.initialize(walletInfo: walletInfo) { success in
c.resume(returning: success)
}
}
Expand Down
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.56.5/brave-core-ios-1.56.5.tgz",
"brave-core-ios": "https://github.com/brave/brave-browser/releases/download/v1.56.6/brave-core-ios-1.56.6.tgz",
"leo-sf-symbols": "github:brave/leo-sf-symbols#60a41d77d4e58bd48284848a04ad3f9b79bf7daa",
"page-metadata-parser": "^1.1.3",
"webpack-cli": "^4.8.0"
Expand Down

0 comments on commit 265b411

Please sign in to comment.