From 8b1462f465f12a86e0b52cc8fd901be9896990dc Mon Sep 17 00:00:00 2001 From: Robbie Antenesse Date: Sun, 9 Jun 2019 13:04:16 -0600 Subject: [PATCH] Confirm migration if imported from http --- src/js/migration.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/js/migration.js b/src/js/migration.js index 8e53423..07b90ec 100644 --- a/src/js/migration.js +++ b/src/js/migration.js @@ -64,11 +64,14 @@ function dictionaryIsOldDefault(dictionaryJSON) { function checkForReceived() { if (window.hasOwnProperty('dictionaryImportedFromHTTP')) { + let saveOld = true; const storedDictionary = window.localStorage.getItem(LOCAL_STORAGE_KEY); - if (!storedDictionary) { + if (storedDictionary) { + saveOld = confirm('You have an old local dictionary to import. Would you like to overwrite your current local dictionary?'); + } + if (saveOld) { window.localStorage.setItem(LOCAL_STORAGE_KEY, window.dictionaryImportedFromHTTP); delete window.dictionaryImportedFromHTTP; - return; } } } \ No newline at end of file