Skip to content

Commit

Permalink
Merge pull request #913 from brave/cez-sync-remove-device
Browse files Browse the repository at this point in the history
remove `sync this device` option
  • Loading branch information
cezaraugusto authored Nov 16, 2018
2 parents ebf096e + f6b6552 commit b5cb062
Show file tree
Hide file tree
Showing 11 changed files with 1 addition and 71 deletions.
1 change: 0 additions & 1 deletion browser/ui/webui/brave_webui_source.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand Down
14 changes: 0 additions & 14 deletions browser/ui/webui/sync/sync_ui.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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)));
Expand Down Expand Up @@ -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))
Expand Down
8 changes: 0 additions & 8 deletions components/brave_sync/ui/actions/sync_actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
25 changes: 1 addition & 24 deletions components/brave_sync/ui/components/enabledContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -104,10 +102,6 @@ class SyncEnabledContent extends React.PureComponent<SyncEnabledContentProps, Sy
}
}

onToggleSyncThisDevice = (event: React.ChangeEvent<HTMLInputElement>) => {
this.props.actions.onToggleSyncThisDevice(event.target.checked)
}

onSyncBookmarks = (event: React.ChangeEvent<HTMLInputElement>) => {
this.props.actions.onSyncBookmarks(event.target.checked)
}
Expand Down Expand Up @@ -141,23 +135,6 @@ class SyncEnabledContent extends React.PureComponent<SyncEnabledContentProps, Sy
? <ResetSyncModal actions={actions} onClose={this.resetSyncModal} />
: null
}
<Card>
<Grid columns='1fr 1fr'>
<FlexColumn items='center'>
<SwitchButton
id='syncThisDevice'
size='large'
checked={syncData.shouldSyncThisDevice}
onChange={this.onToggleSyncThisDevice}
/>
<SwitchLabel htmlFor='syncThisDevice'>{getLocale('syncThisDevice')}</SwitchLabel>
</FlexColumn>
<FlexColumn direction='column'>
<Label>{getLocale('deviceName')}</Label>
<Paragraph>{syncData.thisDeviceName}</Paragraph>
</FlexColumn>
</Grid>
</Card>
<SectionBlock>
<SubTitle level={2}>{getLocale('devices')}</SubTitle>
<Table header={this.header} rows={this.getRows(syncData.devices)}>
Expand Down
1 change: 0 additions & 1 deletion components/brave_sync/ui/constants/sync_types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
8 changes: 0 additions & 8 deletions components/brave_sync/ui/reducers/sync_reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ const syncReducer: Reducer<Sync.State | undefined> = (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,
Expand Down Expand Up @@ -101,13 +100,6 @@ const syncReducer: Reducer<Sync.State | undefined> = (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
Expand Down
1 change: 0 additions & 1 deletion components/brave_sync/ui/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export const defaultState = {
thisDeviceName: '',
devices: [],
isSyncConfigured: false,
shouldSyncThisDevice: true,
seedQRImageSource: '',
syncWords: '',
syncBookmarks: true,
Expand Down
1 change: 0 additions & 1 deletion components/definitions/sync.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ declare namespace Sync {
thisDeviceName: string
devices: Devices[]
isSyncConfigured: boolean
shouldSyncThisDevice: boolean
seedQRImageSource: string
syncWords: string
syncBookmarks: boolean
Expand Down
1 change: 0 additions & 1 deletion components/resources/brave_components_strings.grd
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,6 @@
<message name="IDS_BRAVE_SYNC_TITLE_BETA" desc="The Brave Sync beta label">beta</message>
<message name="IDS_BRAVE_SYNC_INFO_1" desc="">Sync encrypted browser data between your devices securely and privately using Brave Sync</message>
<message name="IDS_BRAVE_SYNC_INFO_2" desc="The Brave Sync decription about usage on mobile devices">Note: Sync for iOS and Android is still being completed and will be released soon.</message>
<message name="IDS_BRAVE_SYNC_DEVICE_SYNC" desc="">Sync this device</message>

<message name="IDS_BRAVE_SYNC_DONE" desc="The Brave Sync `Done` button">Done</message>
<message name="IDS_BRAVE_SYNC_CANCEL" desc="The Brave Sync `Cancel` button">Cancel</message>
Expand Down
8 changes: 0 additions & 8 deletions components/test/brave_sync_ui/actions/sync_actions_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 0 additions & 4 deletions components/test/brave_sync_ui/reducers/sync_reducer_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ describe.skip('syncReducer', () => {
// TODO
})

describe('SYNC_ON_SYNC_THIS_DEVICE', () => {
// TODO
})

describe('SYNC_BOOKMARKS', () => {
// TODO
})
Expand Down

0 comments on commit b5cb062

Please sign in to comment.