From 4ee2b7cf546fb1fe363a6b8b07450383a36152aa Mon Sep 17 00:00:00 2001 From: Terry Mancey Date: Fri, 12 Feb 2021 18:27:16 +0000 Subject: [PATCH] Decouple RPill from Brave Ads --- components/brave_ads/browser/BUILD.gn | 34 +++--- .../brave_ads/browser/ads_service_impl.cc | 15 +-- .../brave_ads/browser/ads_service_impl.h | 5 +- components/brave_ads/test/BUILD.gn | 1 - components/rpill/common/BUILD.gn | 8 ++ components/rpill/common/rpill.cc | 79 +++++++++++++ components/rpill/common/rpill.h | 21 ++++ .../services/bat_ads/bat_ads_service_impl.cc | 3 +- vendor/bat-native-ads/BUILD.gn | 2 - .../bat/ads/public/interfaces/ads.mojom | 3 +- .../src/bat/ads/internal/rpill/rpill.cc | 47 -------- .../src/bat/ads/internal/rpill/rpill.h | 15 --- .../bat/ads/internal/rpill/rpill_unittest.cc | 105 ------------------ ...quest_signed_tokens_url_request_builder.cc | 4 +- ...ned_tokens_url_request_builder_unittest.cc | 6 +- .../src/bat/ads/internal/unittest_util.cc | 3 +- vendor/brave-ios/Ads/BATBraveAds.mm | 6 +- 17 files changed, 142 insertions(+), 215 deletions(-) create mode 100644 components/rpill/common/BUILD.gn create mode 100644 components/rpill/common/rpill.cc create mode 100644 components/rpill/common/rpill.h delete mode 100644 vendor/bat-native-ads/src/bat/ads/internal/rpill/rpill.cc delete mode 100644 vendor/bat-native-ads/src/bat/ads/internal/rpill/rpill.h delete mode 100644 vendor/bat-native-ads/src/bat/ads/internal/rpill/rpill_unittest.cc diff --git a/components/brave_ads/browser/BUILD.gn b/components/brave_ads/browser/BUILD.gn index b6e30eeeef9d..40d9e1f5918d 100644 --- a/components/brave_ads/browser/BUILD.gn +++ b/components/brave_ads/browser/BUILD.gn @@ -5,9 +5,7 @@ import("//brave/components/brave_rewards/browser/buildflags/buildflags.gni") source_set("browser") { # Remove when https://github.com/brave/brave-browser/issues/10639 is resolved check_includes = false - public_deps = [ - "buildflags", - ] + public_deps = [ "buildflags" ] sources = [ "ads_service.cc", @@ -23,21 +21,23 @@ source_set("browser") { "//base", "//brave/common", "//brave/components/brave_ads/common", - "//brave/components/brave_rewards/common", "//brave/components/brave_rewards/browser", + "//brave/components/brave_rewards/common", "//brave/components/l10n/browser", + "//brave/components/rpill/common", "//chrome/common:buildflags", "//components/dom_distiller/content/browser", "//components/dom_distiller/core", + + # for profile.h + "//components/domain_reliability", "//components/keyed_service/content", "//components/keyed_service/core", - "//components/prefs", "//components/pref_registry", + "//components/prefs", "//components/sessions", - "//url", - # for profile.h - "//components/domain_reliability", "//content/public/browser", + "//url", ] if (brave_ads_enabled) { @@ -60,10 +60,10 @@ source_set("browser") { deps += [ "//brave/app:brave_generated_resources_grit", - "//brave/vendor/bat-native-ads", "//brave/browser/notifications", "//brave/components/brave_ads/resources", "//brave/components/services/bat_ads/public/cpp", + "//brave/vendor/bat-native-ads", "//components/history/core/browser", "//components/history/core/common", "//components/wifi", @@ -76,12 +76,12 @@ source_set("browser") { if (is_android) { sources += [ + "//brave/browser/brave_ads/android/brave_ads_native_helper.cc", + "//brave/browser/brave_ads/android/brave_ads_native_helper.h", "background_helper_android.cc", "background_helper_android.h", "notification_helper_android.cc", "notification_helper_android.h", - "//brave/browser/brave_ads/android/brave_ads_native_helper.cc", - "//brave/browser/brave_ads/android/brave_ads_native_helper.h", ] deps += [ "//brave/browser/brave_ads/android:jni_headers", @@ -117,8 +117,8 @@ source_set("browser") { "notification_helper_win.h", ] deps += [ - "//ui/views", "//ui/gfx", + "//ui/views", ] } } @@ -131,19 +131,15 @@ source_set("testutil") { ":browser", "//base", "//brave/components/brave_rewards/browser:browser", - "//content/public/browser", "//chrome/test:test_support", + "//content/public/browser", "//testing/gtest", ] if (brave_ads_enabled) { - deps += [ - "//brave/vendor/bat-native-ads", - ] + deps += [ "//brave/vendor/bat-native-ads" ] - configs += [ - "//brave/vendor/bat-native-ads:internal_config" - ] + configs += [ "//brave/vendor/bat-native-ads:internal_config" ] } sources = [ diff --git a/components/brave_ads/browser/ads_service_impl.cc b/components/brave_ads/browser/ads_service_impl.cc index c08ea1fa1bad..539669f92aaf 100644 --- a/components/brave_ads/browser/ads_service_impl.cc +++ b/components/brave_ads/browser/ads_service_impl.cc @@ -54,6 +54,7 @@ #include "brave/components/brave_rewards/common/pref_names.h" #include "brave/components/l10n/browser/locale_helper.h" #include "brave/components/l10n/common/locale_util.h" +#include "brave/components/rpill/common/rpill.h" #include "brave/components/services/bat_ads/public/cpp/ads_client_mojo_bridge.h" #include "brave/components/services/bat_ads/public/interfaces/bat_ads.mojom.h" #include "brave/grit/brave_generated_resources.h" @@ -728,7 +729,7 @@ void AdsServiceImpl::MaybeStart(const bool should_restart) { } void AdsServiceImpl::Start() { - GetHardwareInfo(); + DetectUncertainFuture(); } void AdsServiceImpl::Stop() { @@ -782,15 +783,15 @@ void AdsServiceImpl::OnResetAllState(const bool success) { VLOG(1) << "Successfully reset ads state"; } -void AdsServiceImpl::GetHardwareInfo() { - base::SysInfo::GetHardwareInfo(base::BindOnce( - &AdsServiceImpl::OnGetHardwareInfo, base::Unretained(this))); +void AdsServiceImpl::DetectUncertainFuture() { + auto callback = + base::BindOnce(&AdsServiceImpl::OnDetectUncertainFuture, AsWeakPtr()); + brave_rpill::DetectUncertainFuture(base::BindOnce(std::move(callback))); } -void AdsServiceImpl::OnGetHardwareInfo(base::SysInfo::HardwareInfo hardware) { +void AdsServiceImpl::OnDetectUncertainFuture(const bool is_uncertain_future) { ads::SysInfoPtr sys_info = ads::SysInfo::New(); - sys_info->manufacturer = hardware.manufacturer; - sys_info->model = hardware.model; + sys_info->is_uncertain_future = is_uncertain_future; bat_ads_service_->SetSysInfo(std::move(sys_info), base::NullCallback()); diff --git a/components/brave_ads/browser/ads_service_impl.h b/components/brave_ads/browser/ads_service_impl.h index 6eaa23d840c2..88c48d4155cb 100644 --- a/components/brave_ads/browser/ads_service_impl.h +++ b/components/brave_ads/browser/ads_service_impl.h @@ -17,7 +17,6 @@ #include "base/containers/flat_set.h" #include "base/files/file_path.h" #include "base/memory/weak_ptr.h" -#include "base/system/sys_info.h" #include "base/timer/timer.h" #include "bat/ads/ads.h" #include "bat/ads/ads_client.h" @@ -185,8 +184,8 @@ class AdsServiceImpl : public AdsService, void OnShutdownAndResetBatAds(const int32_t result); void OnResetAllState(const bool success); - void GetHardwareInfo(); - void OnGetHardwareInfo(base::SysInfo::HardwareInfo hardware); + void DetectUncertainFuture(); + void OnDetectUncertainFuture(const bool is_uncertain_future); void EnsureBaseDirectoryExists(); void OnEnsureBaseDirectoryExists(const bool success); diff --git a/components/brave_ads/test/BUILD.gn b/components/brave_ads/test/BUILD.gn index 6b1fb8d0097d..bf321a3030f4 100644 --- a/components/brave_ads/test/BUILD.gn +++ b/components/brave_ads/test/BUILD.gn @@ -105,7 +105,6 @@ source_set("brave_ads_unit_tests") { "//brave/vendor/bat-native-ads/src/bat/ads/internal/privacy/unblinded_tokens/unblinded_tokens_unittest.cc", "//brave/vendor/bat-native-ads/src/bat/ads/internal/privacy/unblinded_tokens/unblinded_tokens_unittest_util.cc", "//brave/vendor/bat-native-ads/src/bat/ads/internal/privacy/unblinded_tokens/unblinded_tokens_unittest_util.h", - "//brave/vendor/bat-native-ads/src/bat/ads/internal/rpill/rpill_unittest.cc", "//brave/vendor/bat-native-ads/src/bat/ads/internal/security/security_util_unittest.cc", "//brave/vendor/bat-native-ads/src/bat/ads/internal/server/ads_serve_server_util_unittest.cc", "//brave/vendor/bat-native-ads/src/bat/ads/internal/server/ads_server_util_unittest.cc", diff --git a/components/rpill/common/BUILD.gn b/components/rpill/common/BUILD.gn new file mode 100644 index 000000000000..3b05bc73b38b --- /dev/null +++ b/components/rpill/common/BUILD.gn @@ -0,0 +1,8 @@ +source_set("common") { + deps = [ "//base" ] + + sources = [ + "rpill.cc", + "rpill.h", + ] +} diff --git a/components/rpill/common/rpill.cc b/components/rpill/common/rpill.cc new file mode 100644 index 000000000000..d8f8008d7e08 --- /dev/null +++ b/components/rpill/common/rpill.cc @@ -0,0 +1,79 @@ +/* Copyright (c) 2020 The Brave Authors. All rights reserved. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "brave/components/rpill/common/rpill.h" + +#include +#include +#include + +#include "base/barrier_closure.h" +#include "base/callback.h" +#include "base/callback_helpers.h" +#include "base/strings/string_util.h" +#include "base/system/sys_info.h" + +namespace brave_rpill { + +namespace { + +struct DeviceInfo { + std::string manufacturer_name; + std::string model_name; + + std::string id() const { + return base::ToLowerASCII(manufacturer_name + model_name); + } +}; + +bool IsUncertainFuture(DeviceInfo* device_info_ptr) { + DCHECK(device_info_ptr); + + const std::string device_id = device_info_ptr->id(); + + static const char* const kKeywords[] = {"amazon", "virtualbox", "vmware", + "xen"}; + + for (const char* keyword : kKeywords) { + if (device_id.find(keyword) != std::string::npos) { + return true; + } + } + + return false; +} + +void OnDeviceInfoReady(IsUncertainFutureCallback callback, + std::unique_ptr device_info) { + const bool is_uncertain_future = IsUncertainFuture(device_info.get()); + std::move(callback).Run(is_uncertain_future); +} + +void OnHardwareInfoReady(DeviceInfo* device_info_ptr, + base::ScopedClosureRunner done_closure, + base::SysInfo::HardwareInfo hardware_info) { + DCHECK(device_info_ptr); + + device_info_ptr->manufacturer_name = std::move(hardware_info.manufacturer); + device_info_ptr->model_name = std::move(hardware_info.model); +} + +} // namespace + +void DetectUncertainFuture(IsUncertainFutureCallback callback) { + std::unique_ptr device_info = std::make_unique(); + DeviceInfo* device_info_ptr = device_info.get(); + + base::RepeatingClosure done_closure = base::BarrierClosure( + /*num_closures=*/1, + base::BindOnce(&OnDeviceInfoReady, std::move(callback), + std::move(device_info))); + + base::SysInfo::GetHardwareInfo( + base::BindOnce(&OnHardwareInfoReady, device_info_ptr, + base::ScopedClosureRunner(done_closure))); +} + +} // namespace brave_rpill diff --git a/components/rpill/common/rpill.h b/components/rpill/common/rpill.h new file mode 100644 index 000000000000..4b4dffc44aee --- /dev/null +++ b/components/rpill/common/rpill.h @@ -0,0 +1,21 @@ +/* Copyright (c) 2020 The Brave Authors. All rights reserved. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef BRAVE_COMPONENTS_RPILL_COMMON_RPILL_H_ +#define BRAVE_COMPONENTS_RPILL_COMMON_RPILL_H_ + +#include "base/callback_forward.h" + +namespace brave_rpill { + +using IsUncertainFutureCallback = base::OnceCallback; + +// Detects if the future is uncertain or bright. The specified |callback| wil be +// run upon completion with the result. +void DetectUncertainFuture(IsUncertainFutureCallback callback); + +} // namespace brave_rpill + +#endif // BRAVE_COMPONENTS_RPILL_COMMON_RPILL_H_ diff --git a/components/services/bat_ads/bat_ads_service_impl.cc b/components/services/bat_ads/bat_ads_service_impl.cc index 4eb86d45a1f4..ea5173df4b5e 100644 --- a/components/services/bat_ads/bat_ads_service_impl.cc +++ b/components/services/bat_ads/bat_ads_service_impl.cc @@ -44,8 +44,7 @@ void BatAdsServiceImpl::SetSysInfo( ads::SysInfoPtr sys_info, SetSysInfoCallback callback) { DCHECK(!is_initialized_); - ads::g_sys_info.manufacturer = sys_info->manufacturer; - ads::g_sys_info.model = sys_info->model; + ads::g_sys_info.is_uncertain_future = sys_info->is_uncertain_future; std::move(callback).Run(); } diff --git a/vendor/bat-native-ads/BUILD.gn b/vendor/bat-native-ads/BUILD.gn index 6d939e89d838..4c92a971b2aa 100644 --- a/vendor/bat-native-ads/BUILD.gn +++ b/vendor/bat-native-ads/BUILD.gn @@ -494,8 +494,6 @@ source_set("ads") { "src/bat/ads/internal/privacy/unblinded_tokens/unblinded_token_info.h", "src/bat/ads/internal/privacy/unblinded_tokens/unblinded_tokens.cc", "src/bat/ads/internal/privacy/unblinded_tokens/unblinded_tokens.h", - "src/bat/ads/internal/rpill/rpill.cc", - "src/bat/ads/internal/rpill/rpill.h", "src/bat/ads/internal/search_engine/search_provider_info.cc", "src/bat/ads/internal/search_engine/search_provider_info.h", "src/bat/ads/internal/search_engine/search_providers.cc", diff --git a/vendor/bat-native-ads/include/bat/ads/public/interfaces/ads.mojom b/vendor/bat-native-ads/include/bat/ads/public/interfaces/ads.mojom index 73f7a6d92bb5..76a2fe8bd659 100644 --- a/vendor/bat-native-ads/include/bat/ads/public/interfaces/ads.mojom +++ b/vendor/bat-native-ads/include/bat/ads/public/interfaces/ads.mojom @@ -11,8 +11,7 @@ enum BraveAdsEnvironment { }; struct BraveAdsSysInfo { - string manufacturer; - string model; + bool is_uncertain_future; }; struct BraveAdsBuildChannel { diff --git a/vendor/bat-native-ads/src/bat/ads/internal/rpill/rpill.cc b/vendor/bat-native-ads/src/bat/ads/internal/rpill/rpill.cc deleted file mode 100644 index a591826e7639..000000000000 --- a/vendor/bat-native-ads/src/bat/ads/internal/rpill/rpill.cc +++ /dev/null @@ -1,47 +0,0 @@ -/* Copyright (c) 2020 The Brave Authors. All rights reserved. - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "bat/ads/internal/rpill/rpill.h" - -#include -#include - -#include "base/strings/string_util.h" -#include "bat/ads/ads.h" - -namespace ads { - -namespace { - -std::string GetHardware() { - const std::string manufacturer = base::ToLowerASCII(g_sys_info.manufacturer); - const std::string model = base::ToLowerASCII(g_sys_info.model); - return manufacturer + model; -} - -std::vector GetKeywords() { - return {"amazon", "virtualbox", "vmware", "xen"}; -} - -bool IsVirtualMachine() { - const std::string hardware = GetHardware(); - const std::vector keywords = GetKeywords(); - - for (const auto& keyword : keywords) { - if (hardware.find(keyword) != std::string::npos) { - return true; - } - } - - return false; -} - -} // namespace - -bool IsUncertainFuture() { - return IsVirtualMachine(); -} - -} // namespace ads diff --git a/vendor/bat-native-ads/src/bat/ads/internal/rpill/rpill.h b/vendor/bat-native-ads/src/bat/ads/internal/rpill/rpill.h deleted file mode 100644 index f0cba97b1317..000000000000 --- a/vendor/bat-native-ads/src/bat/ads/internal/rpill/rpill.h +++ /dev/null @@ -1,15 +0,0 @@ -/* Copyright (c) 2020 The Brave Authors. All rights reserved. - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifndef BRAVE_VENDOR_BAT_NATIVE_ADS_SRC_BAT_ADS_INTERNAL_RPILL_RPILL_H_ -#define BRAVE_VENDOR_BAT_NATIVE_ADS_SRC_BAT_ADS_INTERNAL_RPILL_RPILL_H_ - -namespace ads { - -bool IsUncertainFuture(); - -} // namespace ads - -#endif // BRAVE_VENDOR_BAT_NATIVE_ADS_SRC_BAT_ADS_INTERNAL_RPILL_RPILL_H_ diff --git a/vendor/bat-native-ads/src/bat/ads/internal/rpill/rpill_unittest.cc b/vendor/bat-native-ads/src/bat/ads/internal/rpill/rpill_unittest.cc deleted file mode 100644 index 23786b9e4959..000000000000 --- a/vendor/bat-native-ads/src/bat/ads/internal/rpill/rpill_unittest.cc +++ /dev/null @@ -1,105 +0,0 @@ -/* Copyright (c) 2020 The Brave Authors. All rights reserved. - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "bat/ads/internal/rpill/rpill.h" - -#include "bat/ads/internal/unittest_base.h" -#include "bat/ads/internal/unittest_util.h" -#include "testing/gtest/include/gtest/gtest.h" - -// npm run test -- brave_unit_tests --filter=BatAds* - -namespace ads { - -class BatAdsRPillTest : public UnitTestBase { - protected: - BatAdsRPillTest() = default; - - ~BatAdsRPillTest() override = default; -}; - -TEST_F(BatAdsRPillTest, IsUncertainFutureForAmazon) { - // Arrange - SysInfo sys_info; - sys_info.manufacturer = "Amazon"; - sys_info.model = "Virtual Platform"; - SetSysInfo(sys_info); - - // Act - const bool is_uncertain_future = IsUncertainFuture(); - - // Assert - EXPECT_TRUE(is_uncertain_future); -} - -TEST_F(BatAdsRPillTest, IsUncertainFutureForVirtualBox) { - // Arrange - SysInfo sys_info; - sys_info.manufacturer = "VirtualBox"; - sys_info.model = "innotek GmbH"; - SetSysInfo(sys_info); - - // Act - const bool is_uncertain_future = IsUncertainFuture(); - - // Assert - EXPECT_TRUE(is_uncertain_future); -} - -TEST_F(BatAdsRPillTest, IsUncertainFutureForVMWare) { - // Arrange - SysInfo sys_info; - sys_info.manufacturer = "VMWare"; - sys_info.model = "Virtual Platform"; - SetSysInfo(sys_info); - - // Act - const bool is_uncertain_future = IsUncertainFuture(); - - // Assert - EXPECT_TRUE(is_uncertain_future); -} - -TEST_F(BatAdsRPillTest, IsUncertainFutureForXen) { - // Arrange - SysInfo sys_info; - sys_info.manufacturer = "Xen"; - sys_info.model = "HVM domU"; - SetSysInfo(sys_info); - - // Act - const bool is_uncertain_future = IsUncertainFuture(); - - // Assert - EXPECT_TRUE(is_uncertain_future); -} - -TEST_F(BatAdsRPillTest, IsCertainFuture) { - // Arrange - SysInfo sys_info; - sys_info.manufacturer = "SAMSUNG ELECTRONICS CO., LTD."; - sys_info.model = "900X3N"; - SetSysInfo(sys_info); - - // Act - const bool is_uncertain_future = IsUncertainFuture(); - - // Assert - EXPECT_FALSE(is_uncertain_future); -} - -TEST_F(BatAdsRPillTest, IsCertainFutureForMissingSysInfo) { - // Arrange - SysInfo sys_info; - SetSysInfo(sys_info); - - // Act - const bool is_uncertain_future = IsUncertainFuture(); - - // Assert - EXPECT_FALSE(is_uncertain_future); -} - -} // namespace ads diff --git a/vendor/bat-native-ads/src/bat/ads/internal/tokens/refill_unblinded_tokens/request_signed_tokens_url_request_builder.cc b/vendor/bat-native-ads/src/bat/ads/internal/tokens/refill_unblinded_tokens/request_signed_tokens_url_request_builder.cc index e5f7fafca4ad..7d0f73971aa1 100644 --- a/vendor/bat-native-ads/src/bat/ads/internal/tokens/refill_unblinded_tokens/request_signed_tokens_url_request_builder.cc +++ b/vendor/bat-native-ads/src/bat/ads/internal/tokens/refill_unblinded_tokens/request_signed_tokens_url_request_builder.cc @@ -12,8 +12,8 @@ #include "base/strings/string_number_conversions.h" #include "base/strings/stringprintf.h" #include "base/values.h" +#include "bat/ads/ads.h" #include "bat/ads/internal/logging.h" -#include "bat/ads/internal/rpill/rpill.h" #include "bat/ads/internal/security/security_util.h" #include "bat/ads/internal/server/confirmations_server_util.h" @@ -99,7 +99,7 @@ std::string RequestSignedTokensUrlRequestBuilder::BuildSignatureHeaderValue( } std::string RequestSignedTokensUrlRequestBuilder::BuildViaHeader() const { - if (IsUncertainFuture()) { + if (g_sys_info.is_uncertain_future) { return "Via: 1.1 brave, 1.1 ads-serve.brave.com (Apache/1.1)"; } diff --git a/vendor/bat-native-ads/src/bat/ads/internal/tokens/refill_unblinded_tokens/request_signed_tokens_url_request_builder_unittest.cc b/vendor/bat-native-ads/src/bat/ads/internal/tokens/refill_unblinded_tokens/request_signed_tokens_url_request_builder_unittest.cc index 490a2f54a674..4d138b2bc6e2 100644 --- a/vendor/bat-native-ads/src/bat/ads/internal/tokens/refill_unblinded_tokens/request_signed_tokens_url_request_builder_unittest.cc +++ b/vendor/bat-native-ads/src/bat/ads/internal/tokens/refill_unblinded_tokens/request_signed_tokens_url_request_builder_unittest.cc @@ -74,8 +74,7 @@ class BatAdsRequestSignedTokensUrlRequestBuilderTest : public UnitTestBase { TEST_F(BatAdsRequestSignedTokensUrlRequestBuilderTest, BuildUrlForRPill) { // Arrange SysInfo sys_info; - sys_info.manufacturer = "VirtualBox"; - sys_info.model = "innotek GmbH"; + sys_info.is_uncertain_future = true; SetSysInfo(sys_info); WalletInfo wallet; @@ -114,8 +113,7 @@ TEST_F(BatAdsRequestSignedTokensUrlRequestBuilderTest, BuildUrlForRPill) { TEST_F(BatAdsRequestSignedTokensUrlRequestBuilderTest, BuildUrlForBPill) { // Arrange SysInfo sys_info; - sys_info.manufacturer = "SAMSUNG ELECTRONICS CO., LTD."; - sys_info.model = "900X3N"; + sys_info.is_uncertain_future = false; SetSysInfo(sys_info); WalletInfo wallet; diff --git a/vendor/bat-native-ads/src/bat/ads/internal/unittest_util.cc b/vendor/bat-native-ads/src/bat/ads/internal/unittest_util.cc index 78da0be79c43..53a44c6bb628 100644 --- a/vendor/bat-native-ads/src/bat/ads/internal/unittest_util.cc +++ b/vendor/bat-native-ads/src/bat/ads/internal/unittest_util.cc @@ -459,8 +459,7 @@ void SetEnvironment(const Environment environment) { } void SetSysInfo(const SysInfo& sys_info) { - g_sys_info.manufacturer = sys_info.manufacturer; - g_sys_info.model = sys_info.model; + g_sys_info.is_uncertain_future = sys_info.is_uncertain_future; } void SetBuildChannel(const bool is_release, const std::string& name) { diff --git a/vendor/brave-ios/Ads/BATBraveAds.mm b/vendor/brave-ios/Ads/BATBraveAds.mm index 9478d04df7f2..bc67f756a5b8 100644 --- a/vendor/brave-ios/Ads/BATBraveAds.mm +++ b/vendor/brave-ios/Ads/BATBraveAds.mm @@ -195,16 +195,14 @@ + (void)setEnvironment:(int)environment + (BATBraveAdsSysInfo *)sysInfo { auto sys_info = [[BATBraveAdsSysInfo alloc] init]; - sys_info.manufacturer = [NSString stringWithUTF8String: ads::g_sys_info.manufacturer.c_str()]; - sys_info.model = [NSString stringWithUTF8String: ads::g_sys_info.model.c_str()]; + sys_info.isUncertainFuture = ads::g_sys_info.is_uncertain_future; return sys_info; } + (void)setSysInfo:(BATBraveAdsSysInfo *)sysInfo { - ads::g_sys_info.manufacturer = sysInfo.manufacturer.UTF8String; - ads::g_sys_info.model = sysInfo.model.UTF8String; + ads::g_sys_info.is_uncertain_future = sysInfo.isUncertainFuture; } + (BATBraveAdsBuildChannel *)buildChannel