Skip to content

Commit

Permalink
Rename instances of together
Browse files Browse the repository at this point in the history
Originally done as separate commits (one at a time) and compiled/tested after each.

Fixes brave/brave-browser#17138

- Update component namespace (from `brave_together` to `brave_talk`)
- Update extension API (from `braveTogether` to `braveTalk`)
- Update strings (from `together`/`TOGETHER` to `braveTalk`/`BRAVE_TALK`)
- Rename `showTogether` => `showBraveTalk`
- Rename `togetherSupported` => `braveTalkSupported`
- Rename constant `kNewTabPageShowTogether` => `kNewTabPageShowBraveTalk`
  (Does not affect actual profile setting)
- Rename Widget (from `TogetherWidget` to `BraveTalkWidget`)
- Rename `togetherPromptDismissed` => `braveTalkPromptDismissed`
- Rename `supportsTogether` => `supportsBraveTalk`
- Rename `saveShowTogether` => `saveShowBraveTalk`
- Rename `toggleShowTogether` => `toggleShowBraveTalk`
- Rename `TogetherTooltip` => `BraveTalkTooltip`
- Rename `TogetherIcon` => `BraveTalkIcon`
- Rename `renderTogetherWidget` => `renderBraveTalkWidget`
- Rename `dismissTogetherPrompt` => `dismissBraveTalkPrompt`
- Rename `onDismissTogetherPrompt` => `onDismissBraveTalkPrompt`
- Rename `togetherBanner` => `braveTalkBanner`
- Rename `TogetherItem` => `BraveTalkItem`
- Rename `BraveTogetherIcon` as `BraveTalkSvg`
- Rename "widget stack" name from `together` to `braveTalk`
  • Loading branch information
bsclifton committed Aug 3, 2021
1 parent c738da8 commit 8b42deb
Show file tree
Hide file tree
Showing 37 changed files with 164 additions and 164 deletions.
2 changes: 1 addition & 1 deletion .storybook/locale.ts
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ let locale: Record<string, string> = {
showBackgroundImg: 'Show background image',
showBraveStats: 'Show Brave Stats',
showBinance: 'Show Binance',
togetherWidgetTitle: 'Brave Talk',
braveTalkWidgetTitle: 'Brave Talk',
showClock: 'Show Clock',
showTopSites: 'Show Top Sites',
showRewards: 'Show Rewards',
Expand Down
2 changes: 1 addition & 1 deletion browser/brave_profile_prefs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) {
brave_today_enabled_default);
registry->RegisterBooleanPref(kNewTabPageShowRewards, true);
registry->RegisterBooleanPref(kNewTabPageShowBinance, true);
registry->RegisterBooleanPref(kNewTabPageShowTogether, false);
registry->RegisterBooleanPref(kNewTabPageShowBraveTalk, false);
registry->RegisterBooleanPref(kNewTabPageShowGemini, true);
registry->RegisterBooleanPref(kNewTabPageHideAllWidgets, false);

Expand Down
4 changes: 2 additions & 2 deletions browser/extensions/api/brave_talk_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ namespace extensions {
namespace api {

ExtensionFunction::ResponseAction
BraveTogetherIsSupportedFunction::Run() {
BraveTalkIsSupportedFunction::Run() {
Profile* profile = Profile::FromBrowserContext(browser_context());

if (profile->IsTor()) {
return RespondNow(Error("Not available in Tor profile"));
}

bool is_supported = ntp_widget_utils::IsRegionSupported(
profile->GetPrefs(), brave_together::unsupported_regions, false);
profile->GetPrefs(), brave_talk::unsupported_regions, false);
return RespondNow(OneArgument(base::Value(is_supported)));
}

Expand Down
6 changes: 3 additions & 3 deletions browser/extensions/api/brave_talk_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ class Profile;
namespace extensions {
namespace api {

class BraveTogetherIsSupportedFunction :
class BraveTalkIsSupportedFunction :
public ExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("braveTogether.isSupported", UNKNOWN)
DECLARE_EXTENSION_FUNCTION("braveTalk.isSupported", UNKNOWN)

protected:
~BraveTogetherIsSupportedFunction() override {}
~BraveTalkIsSupportedFunction() override {}
ResponseAction Run() override;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ const PrefsUtil::TypedPrefMap& BravePrefsUtil::GetAllowlistedKeys() {
settings_api::PrefType::PREF_TYPE_BOOLEAN;
(*s_brave_allowlist)[kNewTabPageShowBinance] =
settings_api::PrefType::PREF_TYPE_BOOLEAN;
(*s_brave_allowlist)[kNewTabPageShowTogether] =
(*s_brave_allowlist)[kNewTabPageShowBraveTalk] =
settings_api::PrefType::PREF_TYPE_BOOLEAN;
(*s_brave_allowlist)[kNewTabPageShowGemini] =
settings_api::PrefType::PREF_TYPE_BOOLEAN;
Expand Down
4 changes: 2 additions & 2 deletions browser/search/ntp_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ void ClearNewTabPageProfilePrefs(Profile* profile) {

const char* const kWidgetPrefNames[] = {
kNewTabPageShowRewards,
kNewTabPageShowTogether,
kNewTabPageShowBraveTalk,
kNewTabPageShowBinance,
#if BUILDFLAG(CRYPTO_DOT_COM_ENABLED)
kCryptoDotComNewTabPageShowCryptoDotCom,
Expand Down Expand Up @@ -82,7 +82,7 @@ void MigrateNewTabPagePrefs(Profile* profile) {
// take effect, whereby each widget's show/hide setting is remembered
// individually.
prefs->SetBoolean(kNewTabPageShowRewards, true);
prefs->SetBoolean(kNewTabPageShowTogether, true);
prefs->SetBoolean(kNewTabPageShowBraveTalk, true);
prefs->SetBoolean(kNewTabPageShowBinance, true);
#if BUILDFLAG(CRYPTO_DOT_COM_ENABLED)
prefs->SetBoolean(kCryptoDotComNewTabPageShowCryptoDotCom, true);
Expand Down
4 changes: 2 additions & 2 deletions browser/search/ntp_utils_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ TEST_F(NTPUtilsTest, MigratesHideWidgetTrue) {
// Manually turn all off
auto* prefs = profile()->GetPrefs();
prefs->SetBoolean(kNewTabPageShowRewards, false);
prefs->SetBoolean(kNewTabPageShowTogether, false);
prefs->SetBoolean(kNewTabPageShowBraveTalk, false);
prefs->SetBoolean(kNewTabPageShowBinance, false);
#if BUILDFLAG(CRYPTO_DOT_COM_ENABLED)
prefs->SetBoolean(kCryptoDotComNewTabPageShowCryptoDotCom, false);
Expand All @@ -57,7 +57,7 @@ TEST_F(NTPUtilsTest, MigratesHideWidgetFalse) {
// Manually turn some off
auto* prefs = profile()->GetPrefs();
prefs->SetBoolean(kNewTabPageShowRewards, false);
prefs->SetBoolean(kNewTabPageShowTogether, true);
prefs->SetBoolean(kNewTabPageShowBraveTalk, true);
prefs->SetBoolean(kNewTabPageShowBinance, false);
#if BUILDFLAG(CRYPTO_DOT_COM_ENABLED)
prefs->SetBoolean(kCryptoDotComNewTabPageShowCryptoDotCom, false);
Expand Down
18 changes: 9 additions & 9 deletions browser/ui/webui/brave_webui_source.cc
Original file line number Diff line number Diff line change
Expand Up @@ -244,10 +244,10 @@ void CustomizeWebUIHTMLSource(const std::string &name,
{ "torStatusInitializing", IDS_BRAVE_PRIVATE_NEW_TAB_TOR_STATUS_INITIALIZING }, // NOLINT
{ "torTip", IDS_BRAVE_PRIVATE_NEW_TAB_TOR_TIP},

// Together prompt
{ "togetherPromptTitle", IDS_BRAVE_TOGETHER_PROMPT_TITLE },
{ "togetherPromptDescription", IDS_BRAVE_TOGETHER_PROMPT_DESCRIPTION },
{ "togetherPromptAction", IDS_BRAVE_TOGETHER_PROMPT_ACTION },
// Brave Talk prompt
{ "braveTalkPromptTitle", IDS_BRAVE_TALK_PROMPT_TITLE },
{ "braveTalkPromptDescription", IDS_BRAVE_TALK_PROMPT_DESCRIPTION },
{ "braveTalkPromptAction", IDS_BRAVE_TALK_PROMPT_ACTION },

// Rewards widget
{ "rewardsWidgetBat", IDS_BRAVE_UI_BAT_REWARDS_TEXT },
Expand All @@ -273,11 +273,11 @@ void CustomizeWebUIHTMLSource(const std::string &name,
{ "tosAndPp", IDS_REWARDS_WIDGET_TOS_AND_PP}, // NOLINT
{ "rewardsWidgetStartUsing", IDS_REWARDS_WIDGET_START_USING}, // NOLINT
{ "pendingRewardsMessage", IDS_BRAVE_REWARDS_PENDING_REWARDS_MESSAGE },
// Together Widget
{ "togetherWidgetTitle", IDS_TOGETHER_WIDGET_TITLE },
{ "togetherWidgetWelcomeTitle", IDS_TOGETHER_WIDGET_WELCOME_TITLE },
{ "togetherWidgetStartButton", IDS_TOGETHER_WIDGET_START_BUTTON },
{ "togetherWidgetAboutData", IDS_TOGETHER_WIDGET_ABOUT_DATA },
// Brave Talk Widget
{ "braveTalkWidgetTitle", IDS_BRAVE_TALK_WIDGET_TITLE },
{ "braveTalkWidgetWelcomeTitle", IDS_BRAVE_TALK_WIDGET_WELCOME_TITLE },
{ "braveTalkWidgetStartButton", IDS_BRAVE_TALK_WIDGET_START_BUTTON },
{ "braveTalkWidgetAboutData", IDS_BRAVE_TALK_WIDGET_ABOUT_DATA },
// Binance Widget
{ "binanceWidgetBuy", IDS_BINANCE_WIDGET_BUY },
{ "binanceWidgetBuyCrypto", IDS_BINANCE_WIDGET_BUY_CRYPTO },
Expand Down
10 changes: 5 additions & 5 deletions browser/ui/webui/new_tab_page/brave_new_tab_message_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ base::DictionaryValue GetPreferencesDictionary(PrefService* prefs) {
"showBinance",
prefs->GetBoolean(kNewTabPageShowBinance));
pref_data.SetBoolean(
"showTogether",
prefs->GetBoolean(kNewTabPageShowTogether));
"showBraveTalk",
prefs->GetBoolean(kNewTabPageShowBraveTalk));
pref_data.SetBoolean(
"showGemini",
prefs->GetBoolean(kNewTabPageShowGemini));
Expand Down Expand Up @@ -393,7 +393,7 @@ void BraveNewTabMessageHandler::OnJavascriptAllowed() {
base::BindRepeating(&BraveNewTabMessageHandler::OnPreferencesChanged,
base::Unretained(this)));
pref_change_registrar_.Add(
kNewTabPageShowTogether,
kNewTabPageShowBraveTalk,
base::BindRepeating(&BraveNewTabMessageHandler::OnPreferencesChanged,
base::Unretained(this)));
pref_change_registrar_.Add(
Expand Down Expand Up @@ -528,8 +528,8 @@ void BraveNewTabMessageHandler::HandleSaveNewTabPagePref(
settingsKey = kNewTabPageHideAllWidgets;
} else if (settingsKeyInput == "showBinance") {
settingsKey = kNewTabPageShowBinance;
} else if (settingsKeyInput == "showTogether") {
settingsKey = kNewTabPageShowTogether;
} else if (settingsKeyInput == "showBraveTalk") {
settingsKey = kNewTabPageShowBraveTalk;
} else if (settingsKeyInput == "showGemini") {
settingsKey = kNewTabPageShowGemini;
#if BUILDFLAG(CRYPTO_DOT_COM_ENABLED)
Expand Down
4 changes: 2 additions & 2 deletions common/extensions/api/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ json_features("api_features") {
"//chrome/common/extensions/api/_api_features.json",
"//extensions/common/api/_api_features.json",
"_api_features.json",
"_brave_together_api_features.json",
"_brave_talk_api_features.json",
]

if (ethereum_remote_client_enabled) {
Expand Down Expand Up @@ -75,7 +75,7 @@ brave_extensions_api_schema_sources = [
"brave_today.json",
"greaselion.json",
"rewards_notifications.json",
"brave_together.json",
"brave_talk.json",
]

if (ipfs_enabled) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

{
"braveTogether": {
"braveTalk": {
"channel": "stable",
"contexts": ["webui"],
"dependencies": [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

[
{
"namespace": "braveTogether",
"description": "Use the <code>chrome.braveTogether</code> API to to receive info pertaining to the Brave Talk feature.",
"namespace": "braveTalk",
"description": "Use the <code>chrome.braveTalk</code> API to to receive info pertaining to the Brave Talk feature.",
"compiler_options": {
"implemented_in": "brave/browser/extensions/api/brave_talk_api.h"
},
Expand Down
2 changes: 1 addition & 1 deletion common/pref_names.cc
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const char kNewTabPageShowToday[] = "brave.new_tab_page.show_brave_today";
const char kNewTabPageShowRewards[] = "brave.new_tab_page.show_rewards";
const char kNewTabPageShowBinance[] = "brave.new_tab_page.show_binance";
const char kNewTabPageShowGemini[] = "brave.new_tab_page.show_gemini";
const char kNewTabPageShowTogether[] = "brave.new_tab_page.show_together";
const char kNewTabPageShowBraveTalk[] = "brave.new_tab_page.show_together";
const char kNewTabPageHideAllWidgets[] = "brave.new_tab_page.hide_all_widgets";
const char kNewTabPageShowsOptions[] = "brave.new_tab_page.shows_options";
const char kBraveTodaySources[] = "brave.today.sources";
Expand Down
2 changes: 1 addition & 1 deletion common/pref_names.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ extern const char kNewTabPageShowToday[];
extern const char kNewTabPageShowRewards[];
extern const char kNewTabPageShowBinance[];
extern const char kNewTabPageShowGemini[];
extern const char kNewTabPageShowTogether[];
extern const char kNewTabPageShowBraveTalk[];
extern const char kNewTabPageHideAllWidgets[];
extern const char kNewTabPageShowsOptions[];
// TODO(petemill): Move to brave_today component
Expand Down
2 changes: 1 addition & 1 deletion components/brave_new_tab_ui/actions/new_tab_actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const statsUpdated = (stats: Stats) =>

export const init = createAction<void>('page init')

export const dismissTogetherPrompt = createAction('dismiss together prompt')
export const dismissBraveTalkPrompt = createAction('dismiss brave talk prompt')

export const privateTabDataUpdated = (data: PrivateTabData) =>
action(types.NEW_TAB_PRIVATE_TAB_DATA_UPDATED, data)
Expand Down
10 changes: 5 additions & 5 deletions components/brave_new_tab_ui/api/initialData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export type InitialData = {
privateTabData: privateTabDataAPI.PrivateTabData
torTabData: torTabDataAPI.TorTabData
brandedWallpaperData: undefined | NewTab.BrandedWallpaper
togetherSupported: boolean
braveTalkSupported: boolean
geminiSupported: boolean
binanceSupported: boolean
cryptoDotComSupported: boolean
Expand Down Expand Up @@ -46,7 +46,7 @@ export async function getInitialData (): Promise<InitialData> {
privateTabData,
torTabData,
brandedWallpaperData,
togetherSupported,
braveTalkSupported,
geminiSupported,
cryptoDotComSupported,
ftxSupported,
Expand All @@ -58,12 +58,12 @@ export async function getInitialData (): Promise<InitialData> {
torTabDataAPI.getTorTabData(),
!isIncognito ? brandedWallpaper.getBrandedWallpaper() : Promise.resolve(undefined),
new Promise((resolve) => {
if (!('braveTogether' in chrome)) {
if (!('braveTalk' in chrome)) {
resolve(false)
return
}

chrome.braveTogether.isSupported((supported: boolean) => {
chrome.braveTalk.isSupported((supported: boolean) => {
resolve(supported)
})
}),
Expand Down Expand Up @@ -95,7 +95,7 @@ export async function getInitialData (): Promise<InitialData> {
privateTabData,
torTabData,
brandedWallpaperData,
togetherSupported,
braveTalkSupported,
geminiSupported,
cryptoDotComSupported,
ftxSupported,
Expand Down
4 changes: 2 additions & 2 deletions components/brave_new_tab_ui/api/preferences.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ export function saveShowRewards (value: boolean): void {
sendSavePref('showRewards', value)
}

export function saveShowTogether (value: boolean): void {
sendSavePref('showTogether', value)
export function saveShowBraveTalk (value: boolean): void {
sendSavePref('showBraveTalk', value)
}

export function saveShowBinance (value: boolean): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import * as React from 'react'

export default class BraveTogetherIcon extends React.PureComponent {
export default class BraveTalkSvg extends React.PureComponent {

render () {
return (
Expand Down
24 changes: 12 additions & 12 deletions components/brave_new_tab_ui/components/default/braveTalk/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ import {
WelcomeText,
ActionsWrapper,
CallButton,
TogetherIcon,
BraveTalkIcon,
StyledTitle,
Privacy,
PrivacyLink
} from './style'
import { StyledTitleTab } from '../widgetTitleTab'
import BraveTogetherIcon from './assets/brave-talk-svg'
import BraveTalkSvg from './assets/brave-talk-svg'
import { braveTalkWidgetUrl } from '../../../constants/new_tab_ui'

interface Props {
Expand All @@ -28,21 +28,21 @@ interface Props {
onShowContent: () => void
}

class Together extends React.PureComponent<Props, {}> {
class BraveTalk extends React.PureComponent<Props, {}> {

getButtonText = () => {
return getLocale('togetherWidgetStartButton')
return getLocale('braveTalkWidgetStartButton')
}

renderTitle () {
return (
<Header>
<StyledTitle>
<TogetherIcon>
<BraveTogetherIcon />
</TogetherIcon>
<BraveTalkIcon>
<BraveTalkSvg />
</BraveTalkIcon>
<>
{getLocale('togetherWidgetTitle')}
{getLocale('braveTalkWidgetTitle')}
</>
</StyledTitle>
</Header>
Expand Down Expand Up @@ -78,19 +78,19 @@ class Together extends React.PureComponent<Props, {}> {
{this.renderTitle()}
<Content>
<WelcomeText>
{getLocale('togetherWidgetWelcomeTitle')}
{getLocale('braveTalkWidgetWelcomeTitle')}
</WelcomeText>
<ActionsWrapper>
<CallButton onClick={this.shouldCreateCall}>
{getLocale('togetherWidgetStartButton')}
{getLocale('braveTalkWidgetStartButton')}
</CallButton>
<Privacy>
<PrivacyLink
rel={'noopener'}
target={'_blank'}
href={'https://brave.com/privacy/#brave-together-learn'}
>
{getLocale('togetherWidgetAboutData')}
{getLocale('braveTalkWidgetAboutData')}
</PrivacyLink>
</Privacy>
</ActionsWrapper>
Expand All @@ -100,4 +100,4 @@ class Together extends React.PureComponent<Props, {}> {
}
}

export const TogetherWidget = createWidget(Together)
export const BraveTalkWidget = createWidget(BraveTalk)
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export const CallButton = styled('button')<{}>`
}
`

export const TogetherIcon = styled('div')<{}>`
export const BraveTalkIcon = styled('div')<{}>`
width: 24px;
height: 24px;
margin-right: 7px;
Expand Down
Loading

0 comments on commit 8b42deb

Please sign in to comment.