Closed ghost closed 10 years ago
Yet another hack.... To remove Double-quotes from the value you need to comment/remove args.value = JSON.stringify (args.value); from .js file as JSON.stringify adds double-quotes to value which is already a string.
@johnkotch, reviewed my code and fixed those things:
plugins.appPreferences.store(function(ok){}, function(err){ alert(err); }, 'itunes', '2john@kotch.com' );
// {"key":"itunes","value":"2john@kotch.com"} (apppreferences.js, line 36)
plugins.appPreferences.fetch (function(ok){console.log (ok)}, function(err){ console.error(err); }, 'itunes');
// {"key":"itunes"} (apppreferences.js, line 36)
// 2john@kotch.com
// ----------------------------------------------
plugins.appPreferences.store(function(ok){}, function(err){ alert(err); }, 'itunes', 'itunes', '2john@kotch.com' );
// {"key":"itunes","dict":"itunes","value":"2john@kotch.com"} (apppreferences.js, line 36)
plugins.appPreferences.fetch(function(ok){console.log (ok)}, function(err){ alert(err); }, 'itunes', 'itunes');
// {"key":"itunes","dict":"itunes"} (apppreferences.js, line 36)
2john@kotch.com
@itsmikean, @johnkotch string issue on the way, some issues with wp8 platform
now basic types (string, number, boolean) stored as-is on android and iOS. windows phone come in next few days.
also, i created basic test for storing and fetching values, src/test.js
hi apla, i am a novice programmer and new to this and i guess am posting this in the wrong place but i need ur help in impleting your plugin on blackberry 10 ( me.apla.cordova.share-social). i have downloaded the code (src/blackberry10/index.js, share-social.js and plugin.xml) but i do not know how to call the share function from my code.
i have created a mobile app using blackberry webworks and cordova 2.6. i needed to include a share functionality and i am on a short timeframe. pls ur assistance will be greatly appreciated. this is my email oneshot990@gmail.com
First, thanks so much for making this work in 3.0!
Here's what I've discovered: I had to make a minor change to .js file. Something about that block didn't work. I made the dict value required which hard-coded the argList and thinned out the error checking. Not sure that the prepareKey is necessary if you require the params. I'm just hacking it for my use and I barely know what I'm doing... you can adjust as necessary:
AppPreferences.prototype.prepareKey = platform.prepareKey || function (mode, dict, key, value) { var argList = [].slice.apply(arguments); argList.shift(); if ((mode == 'get') || (mode == 'set')) { argList.unshift (void 0); } var args = { key: argList[1] }; if (argList[0] !== void 0) args.dict = argList[2]; if (mode == 'set') args.value = argList[3]; return args; }
then I was able to get the following to work in PhoneGap 3.1
window.plugins.AppPreferences.fetch(function(ok) { alert(ok); }, function(err) { alert(err); }, 'itunes', 'itunes');
window.plugins.AppPreferences.store(function(ok){}, function(err){ alert(err); }, 'itunes', 'itunes', 'john@kotch.com' );
PS: when checking the Settings Preferences on my iPhone 5, the value is enclosed in Double-Quotes. I was not able to fix that as I'm already at the outer reaches of my programming capabilities.