From 8cc6efd90a9982d755aa6f306189fe7c9cfaa2f7 Mon Sep 17 00:00:00 2001 From: Jagadesh P Date: Sun, 15 Sep 2024 21:33:32 +0530 Subject: [PATCH] [Sync] Remove Enable/Disable switch and just use input element for handling custom sync url. Also show Relauch button and Managed icon when required. --- app/brave_settings_strings.grdp | 4 +- browser/brave_local_state_prefs.cc | 3 - .../api/settings_private/brave_prefs_util.cc | 6 +- .../brave_sync_browser_proxy.ts | 4 - .../brave_sync_page/brave_sync_page.html | 48 ++--- .../brave_sync_page/brave_sync_page.ts | 18 +- .../brave_sync_page/sync_url_input.html | 69 ++++++-- .../brave_sync_page/sync_url_input.ts | 165 +++++++++++------- browser/ui/webui/brave_settings_ui.cc | 7 +- ...ave_settings_localized_strings_provider.cc | 3 +- components/constants/pref_names.h | 4 - 11 files changed, 181 insertions(+), 150 deletions(-) diff --git a/app/brave_settings_strings.grdp b/app/brave_settings_strings.grdp index 8704b0357d6f..a16f1f95d92d 100644 --- a/app/brave_settings_strings.grdp +++ b/app/brave_settings_strings.grdp @@ -736,8 +736,8 @@ Could not sync Brave on your devices - - Enable custom sync url + + Custom sync url Enter custom sync url diff --git a/browser/brave_local_state_prefs.cc b/browser/brave_local_state_prefs.cc index 2d964cc9c2a7..e41dd1e68c77 100644 --- a/browser/brave_local_state_prefs.cc +++ b/browser/brave_local_state_prefs.cc @@ -180,9 +180,6 @@ void RegisterLocalStatePrefs(PrefRegistrySimple* registry) { misc_metrics::GeneralBrowserUsage::RegisterPrefs(registry); playlist::PlaylistServiceFactory::RegisterLocalStatePrefs(registry); - - registry->RegisterBooleanPref(kBraveCustomSyncUrlEnabled, false); - registry->RegisterStringPref(kBraveCustomSyncUrl, std::string()); } } // namespace brave diff --git a/browser/extensions/api/settings_private/brave_prefs_util.cc b/browser/extensions/api/settings_private/brave_prefs_util.cc index 89b01b6a6b03..253a43e3b881 100644 --- a/browser/extensions/api/settings_private/brave_prefs_util.cc +++ b/browser/extensions/api/settings_private/brave_prefs_util.cc @@ -14,6 +14,7 @@ #include "brave/components/brave_rewards/common/pref_names.h" #include "brave/components/brave_shields/content/browser/brave_shields_util.h" #include "brave/components/brave_shields/core/common/pref_names.h" +#include "brave/components/brave_sync/brave_sync_prefs.h" #include "brave/components/brave_vpn/common/buildflags/buildflags.h" #include "brave/components/brave_wallet/browser/pref_names.h" #include "brave/components/brave_wayback_machine/buildflags/buildflags.h" @@ -227,9 +228,8 @@ const PrefsUtil::TypedPrefMap& BravePrefsUtil::GetAllowlistedKeys() { (*s_brave_allowlist)[kMRUCyclingEnabled] = settings_api::PrefType::kBoolean; // Sync prefs - (*s_brave_allowlist)[kBraveCustomSyncUrlEnabled] = - settings_api::PrefType::kBoolean; - (*s_brave_allowlist)[kBraveCustomSyncUrl] = settings_api::PrefType::kUrl; + (*s_brave_allowlist)[brave_sync::kCustomSyncServiceUrl] = + settings_api::PrefType::kUrl; // WebTorrent pref (*s_brave_allowlist)[kWebTorrentEnabled] = settings_api::PrefType::kBoolean; diff --git a/browser/resources/settings/brave_sync_page/brave_sync_browser_proxy.ts b/browser/resources/settings/brave_sync_page/brave_sync_browser_proxy.ts index 25ee7dfcedea..f34334be5eea 100644 --- a/browser/resources/settings/brave_sync_page/brave_sync_browser_proxy.ts +++ b/browser/resources/settings/brave_sync_page/brave_sync_browser_proxy.ts @@ -58,10 +58,6 @@ export class BraveSyncBrowserProxy { return sendWithPromise('SyncGetWordsCount', syncCode); } - wasCustomSyncUrlEnabledAtStartup(): boolean { - return loadTimeData.getBoolean('customSyncUrlEnabledAtStartup'); - } - getCustomSyncUrlAtStartup(): string { return loadTimeData.getString('customSyncUrlAtStartup'); } diff --git a/browser/resources/settings/brave_sync_page/brave_sync_page.html b/browser/resources/settings/brave_sync_page/brave_sync_page.html index cc1aebb5daa5..90d6cb92d6da 100644 --- a/browser/resources/settings/brave_sync_page/brave_sync_page.html +++ b/browser/resources/settings/brave_sync_page/brave_sync_page.html @@ -1,16 +1,8 @@ - - + +
-