-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Conversation
Doing this would also require a 1 time only function (that should be removed in a Sprint or 2) to move the preferences from the old ids to the new ones and removing the preferences on the old ids, so that all the preferences are conserved. |
yeah you're right i didn't think of that. |
@TomMalbran i added a migration function |
Nice work. I am just seeing lots of repeated code. Maybe to simplify it you could just call |
currently it doesn't really work because sometimes old properties do not exist (with empty local storage) and i get an error because some values are undefined. |
what is interesting, is that the problem fixes itself when restarting brackets, |
Would it be solved with something like this? function handleClientIdChange(newPrefs, oldPrefsID) {
if (!newPrefs.getValue("newClientID") && prefStorage[oldPrefsID]) {
var oldPrefs = getPreferenceStorage(oldPrefsID);
var data = oldPrefs.getAllValues();
newPrefs.setAllValues(data, false);
delete prefStorage[oldPrefsID];
newPrefs.setValue("newClientID", true);
}
} And then just call |
I tried something like this but the problem is when somebody would newly install brackets or open brackets with a clean local storage, it would break because the setAllValues method reports the value undefined as invalid. |
I just checked that function I wrote with: |
@TomMalbran would you want to test this? |
I could give it a try later. Right now I don't think that the Preference ID from PreferencesManager should be changed, since that is actually the localStorage key and everything else is stored in an object that is stringifyed and stored as the value associated with that key. I would leave that one as how it is. |
in my opinion it is better to change that in the PreferencesManager too because so it all becomes more consistent, and as it doesn't add an awfull lot of work i think it's ok. |
But is not actually a Preference Storage key associated with the PreferenceManager file, is just the only Local Storage key used, so it can be different to every other key and there wont be any real collision problem with it. |
yeah i'll just revert that change so there are fewer changes |
@@ -49,7 +49,7 @@ define(function main(require, exports, module) { | |||
UrlParams = require("utils/UrlParams").UrlParams, | |||
Strings = require("strings"); | |||
|
|||
var PREFERENCES_KEY = "com.adobe.brackets.live-development"; | |||
var PREFERENCES_CLIENT_ID = "com.adobe.brackets." + module.id; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of repeating this string everywhere, there should be a getClientId(moduleId) function in PreferencesManager.
This looks good, but there's a merge conflict, so I can't test it. |
@redmunds i resolved the merge conflict and added a getClientId function |
Looks good. Merging. |
Cleaned up the preferences ids
See #3016