
Product
Introducing Pull Request Stories to Help Security Teams Track Supply Chain Risks
Socket’s new Pull Request Stories give security teams clear visibility into dependency risks and outcomes across scanned pull requests.
cordova-plugin-app-preferences
Advanced tools
Application preferences plugin and preference pane generator
Why you should use this plugin?
From plugin registry:
$ cordova plugin add cordova-plugin-app-preferences
From the repo:
$ cordova plugin add https://github.com/apla/me.apla.cordova.app-preferences
From a local clone:
$ cordova plugin add /path/to/me.apla.cordova.app-preferences/folder
https://github.com/apla/me.apla.cordova.app-preferences/issues/97
More information: Command-line Interface Guide.
Using Plugman to Manage Plugins.
function ok (value) {}
function fail (error) {}
var prefs = plugins.appPreferences;
// cordova interface
// store key => value pair
prefs.store (ok, fail, 'key', 'value');
// store key => value pair in dict (see notes)
prefs.store (ok, fail, 'dict', 'key', 'value');
// fetch value by key (value will be delivered through "ok" callback)
prefs.fetch (ok, fail, 'key');
// fetch value by key from dict (see notes)
prefs.fetch (ok, fail, 'dict', 'key');
// remove value by key
prefs.remove (ok, fail, 'key');
// show application preferences
prefs.show (ok, fail);
// instead of cordova interface you can use promise interface
// you'll receive promise when you won't pass function reference
// as first and second parameter
// fetch the value for a key using promise
prefs.fetch ('key').then (ok, fail);
// support for iOS suites or android named preference files (untested)
var suitePrefs = prefs.suite ("suiteName");
suitePrefs.fetch (...);
suitePrefs.store (...);
// store preferences in synchronized cloud storage for iOS and windows
var cloudSyncedPrefs = prefs.cloudSync ();
cloudSyncedPrefs.fetch (...);
cloudSyncedPrefs.store (...);
NSUserDefaults
— docs for iOS / macOSandroid.content.SharedPreferences
— docsWindows.Storage.ApplicationData
— docsIsolatedStorageSettings.ApplicationSettings
— docslocalStorage
string
, number
, boolean
) are stored using typed fields.<dict>.<key>
Tests are available in src/test.js
. After installing plugin you can add test code from this file and then launch testPlugin()
function.
Please note that plugin id is changed for npm publishing, so if you used this plugin before cordova@5.0.0, you'll have to reinstall it:
$ cordova plugin rm me.apla.cordova.app-preferences $ cordova plugin add cordova-plugin-app-preferences
If you have generated preferences, you can programmatically show preference pane (Android and iOS at this time). On Android your application show native interface for preferences, on iOS you'll be switched to the Settings.app with application preferences opened for you. Either way, you must listen for Cordova resume event to perform preferences synchronization.
Preferences generator installed along with plugin and run every time when you prepare you cordova app.
After plugin installation you can find file app-settings.json
within your app folder.
If you want to disable this functionality, please remove app-settings.json
.
iOS note: if you have Settings.bundle
from external source or previous version of generator
cordova prepare
will fail. Current version of preference generator trying not to rewrite
existing Settings.bundle
if it is not generated by plugin. It is save to remove Settings.bundle
if it came from previous version of plugin.
TODO: Preferences UI for Windows Phone (guide, docs)
Original version for iOS: https://github.com/phonegap/phonegap-plugins/tree/master/iOS/ApplicationPreferences
Another android implementation for cordova 2.x: https://github.com/macdonst/AppPreferences
FAQs
Application preferences plugin and preference pane generator
The npm package cordova-plugin-app-preferences receives a total of 206 weekly downloads. As such, cordova-plugin-app-preferences popularity was classified as not popular.
We found that cordova-plugin-app-preferences demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket’s new Pull Request Stories give security teams clear visibility into dependency risks and outcomes across scanned pull requests.
Research
/Security News
npm author Qix’s account was compromised, with malicious versions of popular packages like chalk-template, color-convert, and strip-ansi published.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.