aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/background.js
diff options
context:
space:
mode:
authorEllie Day <heyellieday@gmail.com>2018-01-03 13:53:11 +0800
committerEllie Day <heyellieday@gmail.com>2018-01-03 13:53:11 +0800
commit3c6a5b16ad37c83f548028d5b6fa3d0f75293ca5 (patch)
treeae70957dfd672881ff5bcf4a67b1feb7139311bb /app/scripts/background.js
parent7184db7632ef79d4bde0e643fdc1a4ee910c77fb (diff)
downloadtangerine-wallet-browser-3c6a5b16ad37c83f548028d5b6fa3d0f75293ca5.tar
tangerine-wallet-browser-3c6a5b16ad37c83f548028d5b6fa3d0f75293ca5.tar.gz
tangerine-wallet-browser-3c6a5b16ad37c83f548028d5b6fa3d0f75293ca5.tar.bz2
tangerine-wallet-browser-3c6a5b16ad37c83f548028d5b6fa3d0f75293ca5.tar.lz
tangerine-wallet-browser-3c6a5b16ad37c83f548028d5b6fa3d0f75293ca5.tar.xz
tangerine-wallet-browser-3c6a5b16ad37c83f548028d5b6fa3d0f75293ca5.tar.zst
tangerine-wallet-browser-3c6a5b16ad37c83f548028d5b6fa3d0f75293ca5.zip
conditionally use extension store if supported or enabled
Diffstat (limited to 'app/scripts/background.js')
-rw-r--r--app/scripts/background.js12
1 files changed, 9 insertions, 3 deletions
diff --git a/app/scripts/background.js b/app/scripts/background.js
index 732f47590..d9a2b0a6e 100644
--- a/app/scripts/background.js
+++ b/app/scripts/background.js
@@ -50,8 +50,12 @@ async function loadStateFromPersistence () {
// read from disk
let versionedData = diskStore.getState() || migrator.generateInitialState(firstTimeState)
// fetch from extension store and merge in data
- const extensionData = await extensionStore.fetch() // TODO: handle possible exceptions (https://developer.chrome.com/apps/runtime#property-lastError)
- versionedData = { ...versionedData, ...extensionData }
+
+ if (extensionStore.isSupported && extensionStore.isEnabled) {
+ const extensionData = await extensionStore.fetch() // TODO: handle possible exceptions (https://developer.chrome.com/apps/runtime#property-lastError)
+ versionedData = { ...versionedData, ...extensionData }
+ }
+
// migrate data
versionedData = await migrator.migrateData(versionedData)
// write to disk
@@ -92,7 +96,9 @@ function setupController (initState) {
}
function syncDataWithExtension(state) {
- extensionStore.sync(state) // TODO: handle possible exceptions (https://developer.chrome.com/apps/runtime#property-lastError)
+ if (extensionStore.isSupported && extensionStore.isEnabled) {
+ extensionStore.sync(state) // TODO: handle possible exceptions (https://developer.chrome.com/apps/runtime#property-lastError)
+ }
return state
}