Skip to content

Commit

Permalink
Show bookmarks toolbar automatically if it was disabled after importi…
Browse files Browse the repository at this point in the history
…ng bookmarks successfully

fix brave#4507

Auditors: @bbondy

Test Plan:
1. Make sure bookmakrs toolbar doesn't show
2. Import bookmarks
3. bookmarks toolbar will show after successful import
  • Loading branch information
darkdh committed Oct 6, 2016
1 parent e8bf42e commit 579bd21
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions app/importer.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@ const AppStore = require('../js/stores/appStore')
const siteTags = require('../js/constants/siteTags')
const appActions = require('../js/actions/appActions')
const messages = require('../js/constants/messages')
const settings = require('../js/constants/settings')
const getSetting = require('../js/settings').getSetting

var isMergeFavorites = false
var isImportingBookmarks = false

exports.init = () => {
importer.initialize()
Expand All @@ -27,12 +30,16 @@ exports.importData = (selected) => {
if (selected.get('mergeFavorites')) {
isMergeFavorites = true
}
if (selected.get('favorites')) {
isImportingBookmarks = true
}
if (selected !== undefined) {
importer.importData(selected.toJS())
}
}

exports.importHTML = (selected) => {
isImportingBookmarks = true
if (selected.get('mergeFavorites')) {
isMergeFavorites = true
}
Expand All @@ -51,6 +58,7 @@ exports.importHTML = (selected) => {

importer.on('update-supported-browsers', (e, detail) => {
isMergeFavorites = false
isImportingBookmarks = false
if (BrowserWindow.getFocusedWindow()) {
BrowserWindow.getFocusedWindow().webContents.send(messages.IMPORTER_LIST, detail)
}
Expand Down Expand Up @@ -203,6 +211,12 @@ importer.on('show-warning-dialog', (e) => {
})

importer.on('import-success', (e) => {
if (isImportingBookmarks) {
const showBookmarksToolbar = getSetting(settings.SHOW_BOOKMARKS_TOOLBAR)
if (!showBookmarksToolbar) {
appActions.changeSetting(settings.SHOW_BOOKMARKS_TOOLBAR, true)
}
}
showImportSuccess()
})

Expand Down

2 comments on commit 579bd21

@bbondy
Copy link

@bbondy bbondy commented on 579bd21 Oct 6, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please only do this when 0 bookmarks are present.

@darkdh
Copy link
Owner Author

@darkdh darkdh commented on 579bd21 Oct 6, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed in brave@61e6e24. thx

Please sign in to comment.