Skip to content

Commit

Permalink
Merge pull request #17069 from brave/fix-wallet-reduce-duplicated-str…
Browse files Browse the repository at this point in the history
…ings

fix(wallet): Reduce Duplicated Strings
  • Loading branch information
Douglashdaniel authored Feb 7, 2023
2 parents 7d0d2ce + f65f052 commit fcf61c5
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 27 deletions.
7 changes: 3 additions & 4 deletions components/brave_wallet/browser/brave_wallet_constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -1099,10 +1099,9 @@ constexpr webui::LocalizedString kLocalizedStrings[] = {
{"braveSwapHelpCenter", IDS_BRAVE_SWAP_HELP_CENTER},
{"braveSwapPrivacyPolicy", IDS_BRAVE_SWAP_PRIVACY_POLICY},
{"braveSwapPrivacyDescription", IDS_BRAVE_SWAP_PRIVACY_DESCRIPTION},
{"braveSwapZeroXDisclaimer", IDS_BRAVE_SWAP_ZERO_EX_DISCLAIMER},
{"braveSwapJupiterDisclaimer", IDS_BRAVE_SWAP_JUPITER_DISCLAIMER},
{"braveSwapZeroXPrivacy", IDS_BRAVE_SWAP_ZERO_EX_PRIVACY},
{"braveSwapJupiterPrivacy", IDS_BRAVE_SWAP_JUPITER_PRIVACY}};
{"braveSwapV2Disclaimer", IDS_BRAVE_SWAP_V2_DISCLAIMER},
{"braveSwapV2Privacy", IDS_BRAVE_SWAP_V2_PRIVACY},
{"braveSwapChangeNetwork", IDS_BRAVE_SWAP_CHANGE_NETWORK}};

// 0x swap constants
constexpr char kGoerliSwapBaseAPIURL[] = "https://goerli.api.0x.org/";
Expand Down
2 changes: 1 addition & 1 deletion components/brave_wallet_ui/page/screens/swap/adapters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ export function makeNetworkInfo (network: BraveWallet.NetworkInfo): NetworkInfo

export function makeWalletAccount (account: WalletAccountType): WalletAccount {
return {
id: account.address,
name: account.name,
address: account.address,
coin: account.coin
Expand Down Expand Up @@ -307,6 +306,7 @@ export function makeSwitchNetwork () {
async function switchNetwork (network: NetworkInfo) {
const { jsonRpcService } = getAPIProxy()
await jsonRpcService.setNetwork(network.chainId, network.coin)
return undefined
}

return switchNetwork
Expand Down
9 changes: 1 addition & 8 deletions components/brave_wallet_ui/page/screens/swap/swap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
// you can obtain one at https://mozilla.org/MPL/2.0/.

import * as React from 'react'
import { useHistory } from 'react-router-dom'

import { NetworkInfo, Swap as SwapInterface } from '@brave/swap-interface'
import '@brave/swap-interface/dist/style.css'
Expand All @@ -23,7 +22,7 @@ import {
import { useLib } from '../../../common/hooks'

// Types
import { BraveWallet, WalletAccountType, WalletRoutes } from '../../../constants/types'
import { BraveWallet, WalletAccountType } from '../../../constants/types'

// Components
import { BuySendSwapDepositNav } from '../../../components/desktop/buy-send-swap-deposit-nav/buy-send-swap-deposit-nav'
Expand Down Expand Up @@ -124,11 +123,6 @@ export const Swap = () => {
}
}, [])

let history = useHistory()
const goBack = React.useCallback(() => {
history.push(WalletRoutes.Portfolio)
}, [history])

return (
<div>
<BuySendSwapDepositNav isTab={true} isSwap={true} />
Expand Down Expand Up @@ -156,7 +150,6 @@ export const Swap = () => {
getTokenPrice={makeGetTokenPrice(defaultFiatCurrency)}
supportedNetworks={supportedNetworks}
defaultBaseCurrency={defaultFiatCurrency}
routeBackToWallet={goBack}
isWalletConnected={true}
isReady={!!selectedNetwork}
/>
Expand Down
7 changes: 3 additions & 4 deletions components/resources/wallet_strings.grdp
Original file line number Diff line number Diff line change
Expand Up @@ -820,10 +820,9 @@
<message name="IDS_BRAVE_SWAP_HELP_CENTER" desc="Help center">Help Center</message>
<message name="IDS_BRAVE_SWAP_PRIVACY_POLICY" desc="Privacy policy">Privacy Policy</message>
<message name="IDS_BRAVE_SWAP_PRIVACY_DESCRIPTION" desc="Privacy policy description">This app uses the following third-party APIs:</message>
<message name="IDS_BRAVE_SWAP_ZERO_EX_DISCLAIMER" desc="0x swap privacy policy disclaimer">Brave Swap uses 0x as a DEX aggregator for supported EVM networks. 0x will process the Ethereum wallet address and IP address to fulfill a transaction (including getting quotes). 0x will ONLY use this data for the purposes of processing transactions.</message>
<message name="IDS_BRAVE_SWAP_JUPITER_DISCLAIMER" desc="Jupiter swap privacy policy disclaimer">Brave Swap uses Jupiter as a DEX aggregator for Solana network. Jupiter will process the Solana wallet address and IP address to fulfill a transaction (including getting quotes). Jupiter will ONLY use this data for the purposes of processing transactions.</message>
<message name="IDS_BRAVE_SWAP_ZERO_EX_PRIVACY" desc="0x swap full privacy policy link text">Click here for 0x Privacy Policy.</message>
<message name="IDS_BRAVE_SWAP_JUPITER_PRIVACY" desc="Jupiter swap full privacy policy link text">Click here for Jupiter Privacy Policy.</message>
<message name="IDS_BRAVE_SWAP_V2_DISCLAIMER" desc="Swap V2 privacy policy disclaimer">Brave Swap uses <ph name="AGGREGATOR">$1<ex>0x</ex></ph> as a DEX aggregator for supported <ph name="NETWORKS">$2<ex>EVM</ex></ph> networks. <ph name="AGGREGATOR">$1<ex>0x</ex></ph> will process the <ph name="NETWORK">$3<ex>Ethereum</ex></ph> wallet address and IP address to fulfill a transaction (including getting quotes). <ph name="AGGREGATOR">$1<ex>0x</ex></ph> will ONLY use this data for the purposes of processing transactions.</message>
<message name="IDS_BRAVE_SWAP_V2_PRIVACY" desc="Swap V2 full privacy policy link text">Click here for <ph name="AGGREGATOR">$1<ex>0x</ex></ph> Privacy Policy.</message>
<message name="IDS_BRAVE_SWAP_CHANGE_NETWORK" desc="Swap change network dropdown">Change network</message>
<message name="IDS_BRAVE_WALLET_ACTIVITY" desc="Wallet activity and transactions">Activity</message>
<message name="IDS_BRAVE_WALLET_NETWORK_IS_REQUIRED_ERROR" desc="Error explaining that a network has not been selected">Network is required</message>
<message name="IDS_BRAVE_WALLET_TOKEN_NAME_IS_REQUIRED_ERROR" desc="Error explaining that a Token name value has not been entered">Token name is required</message>
Expand Down
38 changes: 29 additions & 9 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 @@ -274,7 +274,7 @@
"devDependencies": {
"@babel/core": "7.16.0",
"@babel/plugin-proposal-export-namespace-from": "7.16.0",
"@brave/swap-interface": "0.12.6",
"@brave/swap-interface": "0.14.2",
"@storybook/addon-essentials": "6.4.13",
"@storybook/addon-knobs": "6.4.0",
"@storybook/addons": "6.4.13",
Expand Down

0 comments on commit fcf61c5

Please sign in to comment.