From 87c099ac958a53aec9cf0decfd6027a5f9fa99f7 Mon Sep 17 00:00:00 2001 From: Anthony Tseng Date: Fri, 23 Sep 2016 01:02:40 +0800 Subject: [PATCH] add confirmation dialog after successful import of data from other browser fix #4188 requires https://github.com/brave/electron/commit/58efa3ce28da513e0776a7d6d9b884263450bad3 Auditors: @bbondy Test Plan: dialog should show up after importing --- app/aboutDialog.js | 14 ++++++++++++++ app/extensions/brave/locales/en-US/app.properties | 1 + app/importer.js | 9 ++++++++- app/locale.js | 3 ++- 4 files changed, 25 insertions(+), 2 deletions(-) diff --git a/app/aboutDialog.js b/app/aboutDialog.js index 1bdebb1c572..5de1e059b09 100644 --- a/app/aboutDialog.js +++ b/app/aboutDialog.js @@ -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) +} diff --git a/app/extensions/brave/locales/en-US/app.properties b/app/extensions/brave/locales/en-US/app.properties index 39b5ebb74fc..549a63ad360 100644 --- a/app/extensions/brave/locales/en-US/app.properties +++ b/app/extensions/brave/locales/en-US/app.properties @@ -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 diff --git a/app/importer.js b/app/importer.js index a28dbf3e887..af7bf7c0949 100644 --- a/app/importer.js +++ b/app/importer.js @@ -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') @@ -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) => { +}) diff --git a/app/locale.js b/app/locale.js index fde1d470953..f7e46eba251 100644 --- a/app/locale.js +++ b/app/locale.js @@ -217,7 +217,8 @@ var rendererIdentifiers = function () { 'windowCaptionButtonMaximize', 'windowCaptionButtonRestore', 'windowCaptionButtonClose', - 'closeFirefoxWarning' + 'closeFirefoxWarning', + 'importSuccess' ] }