prometheas / jira-2-omnifocus

Chrome extension for sending JIRA tickets to OmniFocus
24 stars 8 forks source link

Change options storage from localStorage to chrome.storage #18

Open gsumpster opened 7 years ago

gsumpster commented 7 years ago

I was thinking that being able to sync settings would be nice, although the only setting right now, probably shouldn't be synced across multiple machines, especially if someone is using Mac and then Windows, that probably should be stored locally. That being said, having this ability readily available might be useful in the future.

The downside is that it is asynchronous, which means we'll have to use callbacks to retrieve things, which isn't so nice.

Any thoughts?

gsumpster commented 7 years ago

Started work on this a little bit, currently not working. https://github.com/gsumpster/jira-2-omnifocus/tree/fix/chrome-storage

I think we'd probably be better off wrapping a lot of the storage in promises to keep things clean, either way, it's a pretty major refactor to do this.

prometheas commented 7 years ago

Hey, man.

There's definitely something compelling about being able to sync settings. Generally speaking, I don't add any features or capabilities until they're actually needed, but—as it happens—I'm working on a feature that allows one to edit the template of the message string used as the created task's note.

This would definitely be a handy setting to sync.

I'm also working on cross-browser support for this extension, however, so the picture is about to get bigger than "just Chome"—but settings persistence is a mechanism which is straight-forward enough to abstract.

And, yes—promises do seem like the right approach for that.

gsumpster commented 7 years ago

Ah, OK, let me know if I can help out with the templating, I had just picked that up yesterday! https://github.com/gsumpster/jira-2-omnifocus/tree/feature/templating Not very far along at all, so will let you take that one on unless you'd like me to continue!

The Storage APIs across Firefox and Chrome seem to very similar, shouldn't be too much work to implement that for both, the callbacks you end up with for the with the existing API introduce a bit of a mess, hence the promise wrapper suggestion, something like this: https://www.npmjs.com/package/chrome-storage-promise

Let me know if I can help out anywhere else. I'm think another project to have a look at would be making this work with the issue lists and detecting the issues loaded asynchronously.