From 545c7a1ea70daed6c31ea9f60a94bfcb46de60af Mon Sep 17 00:00:00 2001 From: Cezar Augusto Date: Thu, 15 Nov 2018 16:35:37 -0200 Subject: [PATCH 1/2] remove `sync this device` option closes https://github.com/brave/brave-browser/issues/2156 --- browser/ui/webui/brave_webui_source.cc | 1 - .../brave_sync/ui/actions/sync_actions.ts | 8 ------ .../ui/components/enabledContent.tsx | 25 +------------------ .../brave_sync/ui/constants/sync_types.ts | 1 - .../brave_sync/ui/reducers/sync_reducer.ts | 8 ------ components/brave_sync/ui/storage.ts | 1 - components/definitions/sync.d.ts | 1 - .../resources/brave_components_strings.grd | 1 - .../actions/sync_actions_test.ts | 8 ------ .../reducers/sync_reducer_test.ts | 4 --- 10 files changed, 1 insertion(+), 57 deletions(-) diff --git a/browser/ui/webui/brave_webui_source.cc b/browser/ui/webui/brave_webui_source.cc index cf630154552f..3c5b3d58d530 100644 --- a/browser/ui/webui/brave_webui_source.cc +++ b/browser/ui/webui/brave_webui_source.cc @@ -421,7 +421,6 @@ void CustomizeWebUIHTMLSource(const std::string &name, content::WebUIDataSource* { "beta", IDS_BRAVE_SYNC_TITLE_BETA }, { "syncInfo1", IDS_BRAVE_SYNC_INFO_1 }, { "syncInfo2", IDS_BRAVE_SYNC_INFO_2 }, - { "syncThisDevice", IDS_BRAVE_SYNC_DEVICE_SYNC }, { "done", IDS_BRAVE_SYNC_DONE }, { "cancel", IDS_BRAVE_SYNC_CANCEL }, { "areYouSure", IDS_BRAVE_SYNC_ARE_YOU_SURE }, diff --git a/components/brave_sync/ui/actions/sync_actions.ts b/components/brave_sync/ui/actions/sync_actions.ts index e94a88f8dbdf..f35d16fdbbc6 100644 --- a/components/brave_sync/ui/actions/sync_actions.ts +++ b/components/brave_sync/ui/actions/sync_actions.ts @@ -83,14 +83,6 @@ export const onSyncReset = () => { return action(types.SYNC_ON_RESET) } -/** - * Dispatches a message telling the back-end whether or not this device should be synced - * @param {boolean} shouldSyncThisDevice - Whether or not it should keep syncing the current device - */ -export const onToggleSyncThisDevice = (shouldSyncThisDevice: boolean) => { - return action(types.SYNC_ON_SYNC_THIS_DEVICE, { shouldSyncThisDevice }) -} - /** * Dispatches a message telling the back-end that user toggled the bookmarks sync * @param {boolean} shouldEnable - Whether or not it should sync the bookmarks diff --git a/components/brave_sync/ui/components/enabledContent.tsx b/components/brave_sync/ui/components/enabledContent.tsx index 7f17eff2f4f5..47645e4a30d0 100644 --- a/components/brave_sync/ui/components/enabledContent.tsx +++ b/components/brave_sync/ui/components/enabledContent.tsx @@ -5,16 +5,14 @@ import * as React from 'react' // Components -import { Card, Button } from 'brave-ui' +import { Button } from 'brave-ui' import SwitchButton from 'brave-ui/old/switchButton' import Table, { Cell, Row } from 'brave-ui/components/dataTables/table' // Feature-specific components import { Grid, - FlexColumn, SwitchLabel, - Label, Paragraph, SectionBlock, SubTitle @@ -102,10 +100,6 @@ class SyncEnabledContent extends React.PureComponent) => { - this.props.actions.onToggleSyncThisDevice(event.target.checked) - } - onSyncBookmarks = (event: React.ChangeEvent) => { this.props.actions.onSyncBookmarks(event.target.checked) } @@ -139,23 +133,6 @@ class SyncEnabledContent extends React.PureComponent : null } - - - - - {getLocale('syncThisDevice')} - - - - {syncData.thisDeviceName} - - - {getLocale('devices')} diff --git a/components/brave_sync/ui/constants/sync_types.ts b/components/brave_sync/ui/constants/sync_types.ts index c6c714b84d14..c2d8c5f749c3 100644 --- a/components/brave_sync/ui/constants/sync_types.ts +++ b/components/brave_sync/ui/constants/sync_types.ts @@ -13,7 +13,6 @@ export const enum types { SYNC_ON_REQUEST_SYNC_WORDS = '@@sync/SYNC_ON_REQUEST_SYNC_WORDS', SYNC_ON_REMOVE_DEVICE = '@@sync/SYNC_ON_REMOVE_DEVICE', SYNC_ON_RESET = '@@sync/SYNC_ON_RESET', - SYNC_ON_SYNC_THIS_DEVICE = '@@sync/SYNC_ON_SYNC_THIS_DEVICE', SYNC_BOOKMARKS = '@@sync/SYNC_BOOKMARKS', SYNC_SAVED_SITE_SETTINGS = '@@sync/SYNC_SAVED_SITE_SETTINGS', SYNC_BROWSING_HISTORY = '@@sync/SYNC_BROWSING_HISTORY', diff --git a/components/brave_sync/ui/reducers/sync_reducer.ts b/components/brave_sync/ui/reducers/sync_reducer.ts index 4831e3337d46..7d7268cf7897 100644 --- a/components/brave_sync/ui/reducers/sync_reducer.ts +++ b/components/brave_sync/ui/reducers/sync_reducer.ts @@ -38,7 +38,6 @@ const syncReducer: Reducer = (state: Sync.State | undefi ...state, devices: [ ...devices ], isSyncConfigured: payload.settings.sync_configured, - shouldSyncThisDevice: payload.settings.sync_this_device, thisDeviceName: payload.settings.this_device_name, syncBookmarks: payload.settings.sync_bookmarks, syncSavedSiteSettings: payload.settings.sync_settings, @@ -101,13 +100,6 @@ const syncReducer: Reducer = (state: Sync.State | undefi chrome.send('deleteDevice', [payload.id]) break - case types.SYNC_ON_SYNC_THIS_DEVICE: - if (typeof payload.shouldSyncThisDevice === 'undefined') { - break - } - chrome.send('syncThisDevice', [payload.shouldSyncThisDevice]) - break - case types.SYNC_BOOKMARKS: if (typeof payload.shouldEnable === 'undefined') { break diff --git a/components/brave_sync/ui/storage.ts b/components/brave_sync/ui/storage.ts index 4162f2a9496d..95f6b89b9fb5 100644 --- a/components/brave_sync/ui/storage.ts +++ b/components/brave_sync/ui/storage.ts @@ -11,7 +11,6 @@ export const defaultState = { thisDeviceName: '', devices: [], isSyncConfigured: false, - shouldSyncThisDevice: true, seedQRImageSource: '', syncWords: '', syncBookmarks: true, diff --git a/components/definitions/sync.d.ts b/components/definitions/sync.d.ts index 335a568f5087..8f06a5bc0140 100644 --- a/components/definitions/sync.d.ts +++ b/components/definitions/sync.d.ts @@ -25,7 +25,6 @@ declare namespace Sync { thisDeviceName: string devices: Devices[] isSyncConfigured: boolean - shouldSyncThisDevice: boolean seedQRImageSource: string syncWords: string syncBookmarks: boolean diff --git a/components/resources/brave_components_strings.grd b/components/resources/brave_components_strings.grd index f9189601b958..8589a7729f10 100644 --- a/components/resources/brave_components_strings.grd +++ b/components/resources/brave_components_strings.grd @@ -414,7 +414,6 @@ beta Sync encrypted browser data between your devices securely and privately using Brave Sync Note: Sync for iOS and Android is still being completed and will be released soon. - Sync this device Done Cancel diff --git a/components/test/brave_sync_ui/actions/sync_actions_test.ts b/components/test/brave_sync_ui/actions/sync_actions_test.ts index 78a9ad204bc6..fbddb9fb70f1 100644 --- a/components/test/brave_sync_ui/actions/sync_actions_test.ts +++ b/components/test/brave_sync_ui/actions/sync_actions_test.ts @@ -90,14 +90,6 @@ describe('sync_actions', () => { }) }) - it('onToggleSyncThisDevice', () => { - expect(actions.onToggleSyncThisDevice(true)).toEqual({ - type: types.SYNC_ON_SYNC_THIS_DEVICE, - meta: undefined, - payload: { shouldSyncThisDevice: true } - }) - }) - it('onSyncBookmarks', () => { expect(actions.onSyncBookmarks(true)).toEqual({ type: types.SYNC_BOOKMARKS, diff --git a/components/test/brave_sync_ui/reducers/sync_reducer_test.ts b/components/test/brave_sync_ui/reducers/sync_reducer_test.ts index 8ab8a1164012..faffced5ef38 100644 --- a/components/test/brave_sync_ui/reducers/sync_reducer_test.ts +++ b/components/test/brave_sync_ui/reducers/sync_reducer_test.ts @@ -47,10 +47,6 @@ describe.skip('syncReducer', () => { // TODO }) - describe('SYNC_ON_SYNC_THIS_DEVICE', () => { - // TODO - }) - describe('SYNC_BOOKMARKS', () => { // TODO }) From f6b6552296d4ef70286101e21ce44f7478f52a8c Mon Sep 17 00:00:00 2001 From: Cezar Augusto Date: Thu, 15 Nov 2018 18:14:25 -0200 Subject: [PATCH 2/2] remove c++ handler for syncThisDevice --- browser/ui/webui/sync/sync_ui.cc | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/browser/ui/webui/sync/sync_ui.cc b/browser/ui/webui/sync/sync_ui.cc index e1d8eb44a0df..1b5dd093834d 100644 --- a/browser/ui/webui/sync/sync_ui.cc +++ b/browser/ui/webui/sync/sync_ui.cc @@ -39,7 +39,6 @@ class SyncUIDOMHandler : public WebUIMessageHandler, void PageLoaded(const base::ListValue* args); void NeedSyncWords(const base::ListValue* args); void NeedSyncQRcode(const base::ListValue* args); - void SyncThisDevice(const base::ListValue* args); void SyncBookmarks(const base::ListValue* args); void SyncBrowsingHistory(const base::ListValue* args); void SyncSavedSiteSettings(const base::ListValue* args); @@ -93,10 +92,6 @@ void SyncUIDOMHandler::RegisterMessages() { base::Bind(&SyncUIDOMHandler::NeedSyncQRcode, base::Unretained(this))); - this->web_ui()->RegisterMessageCallback("syncThisDevice", - base::Bind(&SyncUIDOMHandler::SyncThisDevice, - base::Unretained(this))); - this->web_ui()->RegisterMessageCallback("syncBookmarks", base::Bind(&SyncUIDOMHandler::SyncBookmarks, base::Unretained(this))); @@ -157,15 +152,6 @@ void SyncUIDOMHandler::NeedSyncQRcode(const base::ListValue* args) { "sync_ui_exports.haveSeedForQrCode", base::Value(seed)); } -void SyncUIDOMHandler::SyncThisDevice(const base::ListValue* args) { - bool new_value; - if (!args->GetBoolean(0, &new_value)) - // TODO(bridiver) - does this need to report an error? - return; - - sync_service_->OnSetSyncEnabled(new_value); -} - void SyncUIDOMHandler::SyncBookmarks(const base::ListValue* args) { bool new_value; if (!args->GetBoolean(0, &new_value))