Skip to content

Commit

Permalink
Revert "Introduce new web Wallet behind feature flag"
Browse files Browse the repository at this point in the history
This reverts commit eb57e1f.
  • Loading branch information
simoarpe committed Dec 4, 2023
1 parent 675614c commit 90f365b
Show file tree
Hide file tree
Showing 17 changed files with 45 additions and 197 deletions.
6 changes: 4 additions & 2 deletions android/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at https://mozilla.org/MPL/2.0/.

import("//brave/android/buildflags/buildflags.gni")
import("//brave/components/ai_chat/core/common/buildflags/buildflags.gni")
import("//brave/components/ipfs/buildflags/buildflags.gni")
import("//brave/components/p3a/buildflags.gni")
import("//brave/components/webcompat_reporter/buildflags/buildflags.gni")
import("//build/config/android/rules.gni")

declare_args() {
brave_android_developer_options_code = ""
}

java_cpp_enum("brave_android_java_enums_srcjar") {
sources = [
"//brave/chromium_src/chrome/browser/notifications/notification_handler_impl.h",
Expand All @@ -26,6 +29,5 @@ java_cpp_template("brave_config_java") {
"BRAVE_ANDROID_ENABLE_IPFS=$enable_ipfs",
"BRAVE_ANDROID_WEBCOMPAT_REPORT_ENDPOINT=\"$webcompat_report_api_endpoint\"",
"BRAVE_ANDROID_AI_CHAT_ENABLED=$enable_ai_chat",
"BRAVE_ANDROID_WEB_WALLET_ENABLED=$brave_android_web_wallet_enabled",
]
}
13 changes: 0 additions & 13 deletions android/buildflags/BUILD.gn

This file was deleted.

9 changes: 0 additions & 9 deletions android/buildflags/buildflags.gni

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@

package org.chromium.chrome.browser.crypto_wallet.activities;

import static org.chromium.chrome.browser.crypto_wallet.adapters.CryptoFragmentPageAdapter.ACCOUNTS_FRAGMENT_POSITION;
import static org.chromium.chrome.browser.crypto_wallet.adapters.CryptoFragmentPageAdapter.MARKET_FRAGMENT_POSITION;
import static org.chromium.chrome.browser.crypto_wallet.adapters.CryptoFragmentPageAdapter.PORTFOLIO_FRAGMENT_POSITION;
import static org.chromium.chrome.browser.crypto_wallet.adapters.CryptoFragmentPageAdapter.TRANSACTIONS_ACTIVITY_FRAGMENT_POSITION;
import static org.chromium.chrome.browser.crypto_wallet.util.Utils.ONBOARDING_ACTION;
import static org.chromium.chrome.browser.crypto_wallet.util.Utils.ONBOARDING_FIRST_PAGE_ACTION;
import static org.chromium.chrome.browser.crypto_wallet.util.Utils.RESTORE_WALLET_ACTION;
Expand Down Expand Up @@ -36,7 +32,6 @@
import org.chromium.brave_wallet.mojom.NetworkInfo;
import org.chromium.brave_wallet.mojom.OnboardingAction;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.BraveConfig;
import org.chromium.chrome.browser.app.BraveActivity;
import org.chromium.chrome.browser.app.domain.NetworkModel;
import org.chromium.chrome.browser.app.domain.WalletModel;
Expand Down Expand Up @@ -350,38 +345,7 @@ private void showMainLayout() {
addRemoveSecureFlag(false);

mCryptoOnboardingLayout.setVisibility(View.GONE);
if (BraveConfig.WEB_WALLET_ENABLED) {
WalletUtils.openWebWallet();
} else {
mCryptoLayout.setVisibility(View.VISIBLE);

mBottomNavigationView.setOnItemSelectedListener(
menuItem -> {
final int menuItemId = menuItem.getItemId();
if (menuItemId == R.id.action_wallet_portfolio) {
mViewPager.setCurrentItem(PORTFOLIO_FRAGMENT_POSITION, true);
} else if (menuItemId == R.id.action_wallet_activity) {
mViewPager.setCurrentItem(
TRANSACTIONS_ACTIVITY_FRAGMENT_POSITION, true);
} else if (menuItemId == R.id.action_wallet_accounts) {
mViewPager.setCurrentItem(ACCOUNTS_FRAGMENT_POSITION, true);
} else if (menuItemId == R.id.action_wallet_explore) {
mViewPager.setCurrentItem(MARKET_FRAGMENT_POSITION, true);
}
return true;
});

if (mKeyringService != null) {
mKeyringService.isWalletBackedUp(
backed_up -> {
if (!backed_up) {
showWalletBackupBanner();
} else {
findViewById(R.id.wallet_backup_banner).setVisibility(View.GONE);
}
});
}
}
WalletUtils.openWebWallet();
}

private void addBackupWalletSequence(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import org.chromium.brave_wallet.mojom.BraveWalletService;
import org.chromium.brave_wallet.mojom.JsonRpcService;
import org.chromium.brave_wallet.mojom.KeyringService;
import org.chromium.chrome.browser.BraveConfig;
import org.chromium.chrome.browser.app.BraveActivity;
import org.chromium.chrome.browser.crypto_wallet.AssetRatioServiceFactory;
import org.chromium.chrome.browser.crypto_wallet.BraveWalletServiceFactory;
Expand Down Expand Up @@ -141,9 +140,7 @@ public void showWalletPanel() {

private void createAndShowWalletPanel() {
boolean showExpandButton =
!BraveConfig.WEB_WALLET_ENABLED
|| (mVisibleUrl != null
&& !mVisibleUrl.getHost().equals(BRAVE_WALLET_HOST));
mVisibleUrl != null && !mVisibleUrl.getHost().equals(BRAVE_WALLET_HOST);
mBraveWalletPanel =
new BraveWalletPanel(
mAnchorViewHost, mDialogOrPanelDismissListener, this, showExpandButton);
Expand Down
43 changes: 14 additions & 29 deletions browser/ui/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at https://mozilla.org/MPL/2.0/.

import("//brave/android/buildflags/buildflags.gni")
import("//brave/browser/ethereum_remote_client/buildflags/buildflags.gni")
import("//brave/browser/shell_integrations/buildflags/buildflags.gni")
import("//brave/build/config.gni")
Expand Down Expand Up @@ -46,6 +45,12 @@ source_set("ui") {
"webui/brave_rewards_page_ui.h",
"webui/brave_rewards_source.cc",
"webui/brave_rewards_source.h",
"webui/brave_wallet/line_chart/line_chart_ui.cc",
"webui/brave_wallet/line_chart/line_chart_ui.h",
"webui/brave_wallet/market/market_ui.cc",
"webui/brave_wallet/market/market_ui.h",
"webui/brave_wallet/nft/nft_ui.cc",
"webui/brave_wallet/nft/nft_ui.h",
"webui/brave_web_ui_controller_factory.cc",
"webui/brave_web_ui_controller_factory.h",
"webui/brave_webui_source.cc",
Expand All @@ -54,24 +59,6 @@ source_set("ui") {
"webui/skus_internals_ui.h",
]

if (!is_android || brave_android_web_wallet_enabled) {
sources += [
"webui/brave_wallet/line_chart/line_chart_ui.cc",
"webui/brave_wallet/line_chart/line_chart_ui.h",
"webui/brave_wallet/market/market_ui.cc",
"webui/brave_wallet/market/market_ui.h",
"webui/brave_wallet/nft/nft_ui.cc",
"webui/brave_wallet/nft/nft_ui.h",
]

deps += [
"//brave/components/brave_wallet_ui/line_chart:line_chart_display_generated",
"//brave/components/brave_wallet_ui/market:market_display_generated",
"//brave/components/brave_wallet_ui/nft:nft_display_generated",
"//brave/components/brave_wallet_ui/page:brave_wallet_page_generated",
]
}

# It doesn't make sense to view the webcompat webui on iOS & Android.
if (!is_android && !is_ios) {
sources += [
Expand Down Expand Up @@ -504,7 +491,6 @@ source_set("ui") {

deps += [
"//base",
"//brave/android/buildflags",
"//brave/app:command_ids",
"//brave/app/vector_icons:vector_icons",
"//brave/browser:browser_process",
Expand Down Expand Up @@ -554,6 +540,10 @@ source_set("ui") {
"//brave/components/brave_wallet/browser:constants",
"//brave/components/brave_wallet/browser:pref_names",
"//brave/components/brave_wallet/browser:utils",
"//brave/components/brave_wallet_ui/line_chart:line_chart_display_generated",
"//brave/components/brave_wallet_ui/market:market_display_generated",
"//brave/components/brave_wallet_ui/nft:nft_display_generated",
"//brave/components/brave_wallet_ui/page:brave_wallet_page_generated",
"//brave/components/brave_wayback_machine/buildflags",
"//brave/components/constants",
"//brave/components/cosmetic_filters/resources/data:generated_resources",
Expand Down Expand Up @@ -1054,16 +1044,11 @@ source_set("ui") {
"//brave/components/brave_wallet/common",
"//brave/components/brave_wallet/common:mojom",
"//brave/components/brave_wallet_ui:resources",
"//brave/components/brave_wallet_ui/page/screens/android-buy/android:brave_wallet_fund_wallet_page_generated",
"//brave/components/brave_wallet_ui/page/screens/fund-wallet/android:brave_wallet_deposit_page_generated",
"//brave/components/brave_wallet_ui/page/screens/send/android:brave_wallet_send_page_generated",
"//brave/components/brave_wallet_ui/page/screens/swap/android:brave_wallet_swap_page_generated",
]

if (!brave_android_web_wallet_enabled) {
deps += [
"//brave/components/brave_wallet_ui/page/screens/android-buy/android:brave_wallet_fund_wallet_page_generated",
"//brave/components/brave_wallet_ui/page/screens/fund-wallet/android:brave_wallet_deposit_page_generated",
"//brave/components/brave_wallet_ui/page/screens/send/android:brave_wallet_send_page_generated",
"//brave/components/brave_wallet_ui/page/screens/swap/android:brave_wallet_swap_page_generated",
]
}
}

if (ethereum_remote_client_enabled && !is_android) {
Expand Down
2 changes: 1 addition & 1 deletion browser/ui/android/strings/android_brave_strings.grd
Original file line number Diff line number Diff line change
Expand Up @@ -4084,7 +4084,7 @@ If you don't accept this request, VPN will not reconnect and your internet conne
</message>
<message name="IDS_BRAVE_LEO_CONFIRM_TEXT" desc="Text for Leo confirm button text.">
Confirm
</message>
</message>
<message name="IDS_ELLIPSIS_TEXT" desc="Generic ellipsis text" translateable="false">
...
</message>
Expand Down
33 changes: 1 addition & 32 deletions browser/ui/webui/brave_wallet/android/android_wallet_page_ui.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,11 @@

#include <utility>

#include "brave/android/buildflags/buildflags.h"
#if BUILDFLAG(ENABLE_BRAVE_ANDROID_WEB_WALLET)
#include "brave/components/brave_wallet_page/resources/grit/brave_wallet_page_generated_map.h"
#else
#include "brave/components/brave_wallet_page/resources/grit/brave_wallet_deposit_page_generated_map.h"
#include "brave/components/brave_wallet_page/resources/grit/brave_wallet_fund_wallet_page_generated_map.h"
#include "brave/components/brave_wallet_page/resources/grit/brave_wallet_page_generated_map.h"
#include "brave/components/brave_wallet_page/resources/grit/brave_wallet_send_page_generated_map.h"
#include "brave/components/brave_wallet_page/resources/grit/brave_wallet_swap_page_generated_map.h"
#endif // BUILDFLAG(ENABLE_BRAVE_ANDROID_WEB_WALLET)
#include "brave/components/l10n/common/localization_util.h"

#include "brave/browser/ui/webui/brave_wallet/wallet_common_ui.h"
Expand Down Expand Up @@ -65,38 +61,11 @@ AndroidWalletPageUI::AndroidWalletPageUI(content::WebUI* web_ui,
}

// Add required resources.
#if BUILDFLAG(ENABLE_BRAVE_ANDROID_WEB_WALLET)
if (url.host() == kWalletPageHost) {
webui::SetupWebUIDataSource(source,
base::make_span(kBraveWalletPageGenerated,
kBraveWalletPageGeneratedSize),
IDR_WALLET_PAGE_HTML);
#else
if (url.path() == kWalletSwapPagePath) {
webui::SetupWebUIDataSource(
source,
base::make_span(kBraveWalletSwapPageGenerated,
kBraveWalletSwapPageGeneratedSize),
IDR_BRAVE_WALLET_SWAP_PAGE_HTML);
} else if (url.path() == kWalletSendPagePath) {
webui::SetupWebUIDataSource(
source,
base::make_span(kBraveWalletSendPageGenerated,
kBraveWalletSendPageGeneratedSize),
IDR_BRAVE_WALLET_SEND_PAGE_HTML);
} else if (url.path() == kWalletBuyPagePath) {
webui::SetupWebUIDataSource(
source,
base::make_span(kBraveWalletFundWalletPageGenerated,
kBraveWalletFundWalletPageGeneratedSize),
IDR_BRAVE_WALLET_FUND_WALLET_PAGE_HTML);
} else if (url.path() == kWalletDepositPagePath) {
webui::SetupWebUIDataSource(
source,
base::make_span(kBraveWalletDepositPageGenerated,
kBraveWalletDepositPageGeneratedSize),
IDR_BRAVE_WALLET_DEPOSIT_PAGE_HTML);
#endif // BUILDFLAG(ENABLE_BRAVE_ANDROID_WEB_WALLET)
} else {
NOTREACHED() << "Failed to find page resources for:" << url.path();
}
Expand Down
13 changes: 0 additions & 13 deletions browser/ui/webui/brave_web_ui_controller_factory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -229,15 +229,7 @@ WebUIFactoryFunction GetWebUIFactoryFunction(WebUI* web_ui,
ipfs::IpfsServiceFactory::IsIpfsEnabled(profile)) ||
#endif // BUILDFLAG(ENABLE_IPFS_INTERNALS_WEBUI)
#if BUILDFLAG(IS_ANDROID)
#if BUILDFLAG(ENABLE_BRAVE_ANDROID_WEB_WALLET)
(url.is_valid() && url.host_piece() == kWalletPageHost) ||
#else
(url.is_valid() && url.host_piece() == kWalletPageHost &&
(url.path() == kWalletSwapPagePath ||
url.path() == kWalletSendPagePath ||
url.path().starts_with(kWalletBuyPagePath) ||
url.path().starts_with(kWalletDepositPagePath))) ||
#endif // BUILDFLAG(ENABLE_BRAVE_ANDROID_WEB_WALLET)
#else
(base::FeatureList::IsEnabled(
brave_news::features::kBraveNewsFeedUpdate) &&
Expand Down Expand Up @@ -316,16 +308,11 @@ bool ShouldBlockWalletWebUI(content::BrowserContext* browser_context,
}
auto* keyring_service =
brave_wallet::KeyringServiceFactory::GetServiceForContext(profile);
#if BUILDFLAG(ENABLE_BRAVE_ANDROID_WEB_WALLET)
// Support to unlock Wallet has been extended also through WebUI,
// so we block only when Wallet hasn't been created yet, as onboarding
// is offered only via native Andrioid UI.
return !keyring_service ||
(keyring_service && !keyring_service->IsWalletCreatedSync());
#else
return !keyring_service ||
(keyring_service && keyring_service->IsLockedSync());
#endif
}
#endif // BUILDFLAG(IS_ANDROID)
} // namespace
Expand Down
1 change: 0 additions & 1 deletion build/android/java/templates/BraveConfig.template
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,4 @@ public class BraveConfig {
public static final boolean IPFS_ENABLED = BRAVE_ANDROID_ENABLE_IPFS;
public static final boolean AI_CHAT_ENABLED = BRAVE_ANDROID_AI_CHAT_ENABLED;
public static final String WEBCOMPAT_REPORT_ENDPOINT = BRAVE_ANDROID_WEBCOMPAT_REPORT_ENDPOINT;
public static final boolean WEB_WALLET_ENABLED = BRAVE_ANDROID_WEB_WALLET_ENABLED;
}
1 change: 0 additions & 1 deletion chromium_src/chrome/browser/DEPS
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
include_rules = [
"+brave/app",
"+brave/android/buildflags/buildflags.h",
"+brave/browser",
"+brave/build/android/jni_headers",
"+brave/common",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#include "chrome/browser/ui/webui/chrome_untrusted_web_ui_configs.h"

#include "base/feature_list.h"
#include "brave/android/buildflags/buildflags.h"
#include "brave/browser/ui/webui/brave_wallet/ledger/ledger_ui.h"
#include "brave/browser/ui/webui/brave_wallet/line_chart/line_chart_ui.h"
#include "brave/browser/ui/webui/brave_wallet/market/market_ui.h"
Expand Down Expand Up @@ -50,16 +49,12 @@

void RegisterChromeUntrustedWebUIConfigs() {
RegisterChromeUntrustedWebUIConfigs_ChromiumImpl();

#if !BUILDFLAG(IS_ANDROID) || BUILDFLAG(ENABLE_BRAVE_ANDROID_WEB_WALLET)
content::WebUIConfigMap::GetInstance().AddUntrustedWebUIConfig(
std::make_unique<market::UntrustedMarketUIConfig>());
content::WebUIConfigMap::GetInstance().AddUntrustedWebUIConfig(
std::make_unique<nft::UntrustedNftUIConfig>());
content::WebUIConfigMap::GetInstance().AddUntrustedWebUIConfig(
std::make_unique<line_chart::UntrustedLineChartUIConfig>());
#endif

#if !BUILDFLAG(IS_ANDROID)
content::WebUIConfigMap::GetInstance().AddUntrustedWebUIConfig(
std::make_unique<ledger::UntrustedLedgerUIConfig>());
Expand Down
Loading

0 comments on commit 90f365b

Please sign in to comment.