From 2d30b04973a9e55f14fbcc7e6f56d088535f455f Mon Sep 17 00:00:00 2001 From: Chris Date: Sat, 14 Mar 2015 18:13:00 -0600 Subject: [PATCH] Safari: seamless transfer of settings to proper storage --- platform/safari/vapi-background.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/platform/safari/vapi-background.js b/platform/safari/vapi-background.js index 72217e302..fb6cbf749 100644 --- a/platform/safari/vapi-background.js +++ b/platform/safari/vapi-background.js @@ -105,6 +105,16 @@ size: storageQuota, storeName: "keyvaluepairs" }); + var oldSettings = safari.extension.settings; // To smoothly transition users + if(oldSettings.hasOwnProperty("version")) { // Old 'storage'! + for(var key in oldSettings) { + if(!oldSettings.hasOwnProperty(key) || key === "open_prefs") { + continue; + } + localforage.setItem(key, oldSettings[key]); + } + oldSettings.clear(); + } vAPI.storage = { QUOTA_BYTES: storageQuota, // copied from Info.plist