Skip to content
This repository has been archived by the owner on Sep 2, 2021. It is now read-only.

updating extension to call Brackets' new Preference APIs #169

Merged
merged 4 commits into from
Apr 7, 2014

Conversation

bchintx
Copy link
Contributor

@bchintx bchintx commented Apr 1, 2014

updating extension to call Brackets' new Preference APIs

@@ -218,7 +218,8 @@ define(function (require, exports, module) {
if (lastTwentyFonts.length > 20) {
lastTwentyFonts.splice(20, lastTwentyFonts.length - 20);
}
prefs.setValue(PREFERENCES_FONT_HISTORY_KEY, lastTwentyFonts);
prefs.set(PREFERENCES_FONT_HISTORY_KEY, lastTwentyFonts);
prefs.save();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One less space in indentation on this line.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RaymondLim Ouch. Nice catch. Will submit a correction.

@peterflynn
Copy link
Member

@RaymondLim

prefs = PreferencesManager.getPreferenceStorage(PREFERENCES_CLIENT_ID);
lastTwentyFonts = prefs.getValue(PREFERENCES_FONT_HISTORY_KEY);
prefs = PreferencesManager.getExtensionPrefs(PREFERENCES_CLIENT_ID);
PreferencesManager.convertPreferences(module, { "ewf-font-history": "user com.adobe.edgewebfonts.ewf-font-history" });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bchintx Have you tested with font history migration? I asked because I'm not familiar with accessing the old local storage. What I noticed here is you're combining PREFERENCES_CLIENT_ID and PREFERENCES_FONT_HISTORY_KEY using dot. If PREFERENCES_FONT_HISTORY_KEY is stored as a property of PREFERENCES_CLIENT_ID, then it makes sense. Just want to make sure that this code works as expected.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RaymondLim Hmm. Good point. It looks like this extension prefixes it's preferences differently than, say, the Edge Inspect extension. As a result, the conversion isn't working. Let me investigate.

@RaymondLim
Copy link
Contributor

Done with review. Just have one question to confirm that we're migrating the old pref correctly.

@bchintx
Copy link
Contributor Author

bchintx commented Apr 7, 2014

@RaymondLim Thanks for the review and the comment. Actually, I tested it under the debugger and you were right -- the conversion wasn't happening correctly because the client ID wasn't getting correctly resolved to the old module.

I've just pushed another change to this branch, which will fix the problem. It does require a Brackets fix that was just merged as adobe/brackets#7415. The two together will fix the conversion of old values.

Ready for next review. Thanks!

@RaymondLim
Copy link
Contributor

Looks good! Merging.

RaymondLim added a commit that referenced this pull request Apr 7, 2014
updating extension to call Brackets' new Preference APIs
@RaymondLim RaymondLim merged commit b7726b5 into master Apr 7, 2014
@RaymondLim RaymondLim deleted the bchin/update-to-new-Preferences-API branch April 7, 2014 22:09
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants