Skip to content

Commit

Permalink
brave_stats: Add walletActive to stats ping
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Kuehler committed Jul 21, 2021
1 parent e00d80a commit d5ff96c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions browser/brave_stats/brave_stats_updater.cc
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ GURL GetUpdateURL(
update_url, "adsEnabled", stats_updater_params.GetAdsEnabledParam());
update_url = net::AppendQueryParameter(
update_url, "arch", stats_updater_params.GetProcessArchParam());
update_url = net::AppendQueryParameter(
update_url, "walletActive", stats_updater_params.GetWalletEnabledParam());
return update_url;
}

Expand Down
8 changes: 8 additions & 0 deletions browser/brave_stats/brave_stats_updater_params.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "bat/ads/pref_names.h"
#include "brave/common/pref_names.h"
#include "brave/components/brave_referrals/common/pref_names.h"
#include "brave/components/brave_wallet/browser/pref_names.h"
#include "chrome/browser/first_run/first_run.h"
#include "components/prefs/pref_service.h"

Expand Down Expand Up @@ -100,6 +101,13 @@ std::string BraveStatsUpdaterParams::GetProcessArchParam() const {
}
}

std::string BraveStatsUpdaterParams::GetWalletEnabledParam() const {
base::Time wallet_last_unlocked =
profile_pref_service_->GetTime(kBraveWalletLastUnlockTime);
uint8_t usage_bitset = UsageBitstringFromTimestamp(wallet_last_unlocked);
return std::to_string(usage_bitset);
}

// This is a helper method for dealing with timestamps set by other services in
// the browser. This method makes the assumption that enabling the service
// required a user interaction, and thus the uasge ping for the current day has
Expand Down
1 change: 1 addition & 0 deletions browser/brave_stats/brave_stats_updater_params.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class BraveStatsUpdaterParams {
std::string GetReferralCodeParam() const;
std::string GetAdsEnabledParam() const;
std::string GetProcessArchParam() const;
std::string GetWalletEnabledParam() const;
uint8_t UsageBitstringFromTimestamp(const base::Time& time) const;

void SavePrefs();
Expand Down
1 change: 1 addition & 0 deletions browser/brave_stats/sources.gni
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ brave_browser_brave_stats_updater_deps = [
"//brave/common:pref_names",
"//brave/components/brave_referrals/buildflags",
"//brave/components/brave_stats/browser",
"//brave/components/brave_wallet/browser",
"//brave/components/rpill/common",
"//brave/components/version_info",
"//brave/vendor/bat-native-ads",
Expand Down

0 comments on commit d5ff96c

Please sign in to comment.