From 4d01726489da6336cfa223c86f1412951839861b Mon Sep 17 00:00:00 2001 From: Kyle Hickinson Date: Mon, 17 Jul 2023 10:54:13 -0400 Subject: [PATCH] [release] Fix #7728: Bump BraveCore to 1.56.6 (#7738) Fix #7728: Bump BraveCore to 1.56.6 --- .../Frontend/Browser/BrowserViewController.swift | 2 +- .../New Tab Page/NewTabPageViewController.swift | 2 +- Sources/Brave/Frontend/Rewards/BraveRewards.swift | 11 ++++++----- Sources/BraveNews/Customize/NewsSettingsView.swift | 2 +- .../BraveShared/Extensions/BraveAdsExtensions.swift | 7 ++++--- package-lock.json | 12 ++++++------ package.json | 2 +- 7 files changed, 20 insertions(+), 18 deletions(-) diff --git a/Sources/Brave/Frontend/Browser/BrowserViewController.swift b/Sources/Brave/Frontend/Browser/BrowserViewController.swift index 2281e612fc8..eed2740f21d 100644 --- a/Sources/Brave/Frontend/Browser/BrowserViewController.swift +++ b/Sources/Brave/Frontend/Browser/BrowserViewController.swift @@ -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 } } } diff --git a/Sources/Brave/Frontend/Browser/New Tab Page/NewTabPageViewController.swift b/Sources/Brave/Frontend/Browser/New Tab Page/NewTabPageViewController.swift index 46b2667563b..17c80a6ac40 100644 --- a/Sources/Brave/Frontend/Browser/New Tab Page/NewTabPageViewController.swift +++ b/Sources/Brave/Frontend/Browser/New Tab Page/NewTabPageViewController.swift @@ -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() } diff --git a/Sources/Brave/Frontend/Rewards/BraveRewards.swift b/Sources/Brave/Frontend/Rewards/BraveRewards.swift index cae52391eb1..d7bdc745e1d 100644 --- a/Sources/Brave/Frontend/Rewards/BraveRewards.swift +++ b/Sources/Brave/Frontend/Rewards/BraveRewards.swift @@ -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 } @@ -163,7 +164,7 @@ public class BraveRewards: NSObject { at: configuration.storageURL.appendingPathComponent("ads") ) if ads.isEnabled { - ads.initialize { _ in } + ads.initialize(walletInfo: .init()) { _ in } } } } diff --git a/Sources/BraveNews/Customize/NewsSettingsView.swift b/Sources/BraveNews/Customize/NewsSettingsView.swift index 43c544a33f5..32bfb7d9c46 100644 --- a/Sources/BraveNews/Customize/NewsSettingsView.swift +++ b/Sources/BraveNews/Customize/NewsSettingsView.swift @@ -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 { diff --git a/Sources/BraveShared/Extensions/BraveAdsExtensions.swift b/Sources/BraveShared/Extensions/BraveAdsExtensions.swift index ebc1a8ac8b2..49bbb9ab476 100644 --- a/Sources/BraveShared/Extensions/BraveAdsExtensions.swift +++ b/Sources/BraveShared/Extensions/BraveAdsExtensions.swift @@ -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) } } diff --git a/package-lock.json b/package-lock.json index 3cf8bb527d7..e49e1e87a30 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,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" @@ -356,9 +356,9 @@ } }, "node_modules/brave-core-ios": { - "version": "1.56.5", - "resolved": "https://github.com/brave/brave-browser/releases/download/v1.56.5/brave-core-ios-1.56.5.tgz", - "integrity": "sha512-O+E7G9peq74XTkvMaxSbN4+qc/wIKKIfRJyr3JeWg4BVJZaaBdv47H2SQSK5XX9gHDN6wMa1Edj5h0CW0bKmww==", + "version": "1.56.6", + "resolved": "https://github.com/brave/brave-browser/releases/download/v1.56.6/brave-core-ios-1.56.6.tgz", + "integrity": "sha512-5VTXhJ+KS0SoJNVOMSedHBL0raNhBbCXtDwoi9mwX8y73dHsbs/55726EXlh45WPlD5F/bpP8GPFRwnVie0s6w==", "license": "ISC" }, "node_modules/browserslist": { @@ -1738,8 +1738,8 @@ } }, "brave-core-ios": { - "version": "https://github.com/brave/brave-browser/releases/download/v1.56.5/brave-core-ios-1.56.5.tgz", - "integrity": "sha512-O+E7G9peq74XTkvMaxSbN4+qc/wIKKIfRJyr3JeWg4BVJZaaBdv47H2SQSK5XX9gHDN6wMa1Edj5h0CW0bKmww==" + "version": "https://github.com/brave/brave-browser/releases/download/v1.56.6/brave-core-ios-1.56.6.tgz", + "integrity": "sha512-5VTXhJ+KS0SoJNVOMSedHBL0raNhBbCXtDwoi9mwX8y73dHsbs/55726EXlh45WPlD5F/bpP8GPFRwnVie0s6w==" }, "browserslist": { "version": "4.17.1", diff --git a/package.json b/package.json index d457e27a675..0d0f8fc0453 100644 --- a/package.json +++ b/package.json @@ -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"