dpa99c / phonegap-launch-navigator

Phonegap/Cordova plugin which launches native route navigation apps for Android, iOS and Windows
369 stars 131 forks source link

[FEATURE] Ability to provide different storage driver as an option to `launchnavigator.navigate` #228

Open krishnagopinath opened 4 years ago

krishnagopinath commented 4 years ago

I'm submitting a ...

This is a use case that our app would benefit from, but I also think it could be useful as an option for the plugin.

The app I work on uses WebSQL and IDB in a weird way*, which makes it very difficult to use this plugin reliably, because localforage@1.5.0 has a precedence order of IDB, WebSQL and localStorage when it tries to store something. The plugin works the very first time but once we try to store the choice, any attempts to navigate via launchnavigator.navigate does not work!

My theory is that it tries to use our borked setups of IDB and WebSQL and returns nothing when navigate gets called.

In this case, it would be very beneficial to default localforage to just use localStorage and ignore other options. I tried this in a forked version and that seemed to work for my use case! 🎉

I also noticed that localforage takes in an options object into localforage which lets you specify a driver of your choice, like so:

localforage.createInstance({
 name: 'someName',
 driver: localforage.LOCALSTORAGE
})

I wonder if it be beneficial to expose this an option to launchnavigator.navigate, so it is more configurable!

Thanks for the all the hard work on this plugin!

krishnagopinath commented 4 years ago

I'd be happy to submit a PR for this, if you don't have the time!

dpa99c commented 4 years ago

Added to the backlog but if you are able to submit a PR to implement this I will be able to review it more quickly and push out in a patch release.