Skip to content

Commit

Permalink
add confirmation dialog after successful import of data from other br…
Browse files Browse the repository at this point in the history
…owser

fix brave#4188

requires brave/muon@58efa3c

Auditors: @bbondy

Test Plan:
dialog should show up after importing
  • Loading branch information
darkdh committed Sep 22, 2016
1 parent c99bfaf commit 87c099a
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 2 deletions.
14 changes: 14 additions & 0 deletions app/aboutDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,17 @@ module.exports.showImportWarning = function () {
})
}, 50)
}

module.exports.showImportSuccess = function () {
// The timeout is in case there's a call just after the modal to hide the menu.
// showMessageBox is a modal and blocks everything otherwise, so menu would remain open
// while the dialog is displayed.
setTimeout(() => {
dialog.showMessageBox({
title: 'Brave',
message: `${locale.translation('importSuccess')}`,
icon: path.join(__dirname, '..', 'app', 'extensions', 'brave', 'img', 'braveAbout.png'),
buttons: ['Ok']
})
}, 50)
}
1 change: 1 addition & 0 deletions app/extensions/brave/locales/en-US/app.properties
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ importBrowserData=Import browser data
import=Import
importDataWarning=Note: Each browser has a different set of importable data.
importDataCloseBrowserWarning=Please make sure the selected browser is closed before importing your data.
importSuccess=Your data has been imported to Brave successfully.
closeFirefoxWarning=Firefox must be closed during data import. Please close and try again.
favoritesOrBookmarks=Favorites/Bookmarks
mergeIntoBookmarksToolbar=Merge Favorites into Bookmarks Toolbar
Expand Down
9 changes: 8 additions & 1 deletion app/importer.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const dialog = electron.dialog
const BrowserWindow = electron.BrowserWindow
const session = electron.session
const Immutable = require('immutable')
const showImportWarning = require('./aboutDialog').showImportWarning
const { showImportWarning, showImportSuccess } = require('./aboutDialog')
const siteUtil = require('../js/state/siteUtil')
const AppStore = require('../js/stores/appStore')
const siteTags = require('../js/constants/siteTags')
Expand Down Expand Up @@ -179,3 +179,10 @@ importer.on('add-cookies', (e, cookies) => {
importer.on('show-warning-dialog', (e) => {
showImportWarning()
})

importer.on('import-success', (e) => {
showImportSuccess()
})

importer.on('import-dismiss', (e) => {
})
3 changes: 2 additions & 1 deletion app/locale.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,8 @@ var rendererIdentifiers = function () {
'windowCaptionButtonMaximize',
'windowCaptionButtonRestore',
'windowCaptionButtonClose',
'closeFirefoxWarning'
'closeFirefoxWarning',
'importSuccess'
]
}

Expand Down

0 comments on commit 87c099a

Please sign in to comment.