Skip to content

Commit

Permalink
Uplift of #6182 (squashed) to beta
Browse files Browse the repository at this point in the history
  • Loading branch information
brave-browser-releases committed Jul 28, 2020
1 parent 0fbc333 commit 0a6bc1c
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions browser/resources/settings/brave_sync_page/brave_sync_configure.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,7 @@ Polymer({
},

attached: async function() {
const [syncCode, deviceList] = await Promise.all([
this.browserProxy_.getSyncCode(),
this.browserProxy_.getDeviceList()
])
this.syncCode = syncCode
const deviceList = await this.browserProxy_.getDeviceList()
this.addWebUIListener('device-info-changed', this.handleDeviceInfo_.bind(this))
this.handleDeviceInfo_(deviceList)
},
Expand All @@ -82,11 +78,24 @@ Polymer({
return displayDate.toDateString()
},

onViewSyncCode_: function() {
/*
* This only sets sync code when it is not already set. It needs to be cleared
* when sync chain reset
*/
ensureSetSyncCode_: async function() {
if (!!this.syncCode)
return
const syncCode = await this.browserProxy_.getSyncCode()
this.syncCode = syncCode
},

onViewSyncCode_: async function() {
await this.ensureSetSyncCode_()
this.syncCodeDialogType_ = 'words'
},

onAddDevice_: function() {
onAddDevice_: async function() {
await this.ensureSetSyncCode_()
this.syncCodeDialogType_ = 'choose'
},

Expand All @@ -101,6 +110,9 @@ Polymer({
return
}
await this.browserProxy_.resetSyncChain();
// Clear sync code because user might use the same page to create a new sync
// chain without reload
this.syncCode = undefined
const router = Router.getInstance();
router.navigateTo(router.getRoutes().BRAVE_SYNC);
}
Expand Down

0 comments on commit 0a6bc1c

Please sign in to comment.