Merge pull request #282 from NativeScript/local-settings-rename

local-settings renamed to application-settings
This commit is contained in:
Vladimir Enchev
2015-04-14 17:13:15 +03:00
13 changed files with 96 additions and 112 deletions

View File

@ -548,7 +548,7 @@
<TypeScriptCompile Include="timer\timer.ios.ts"> <TypeScriptCompile Include="timer\timer.ios.ts">
<DependentUpon>timer.d.ts</DependentUpon> <DependentUpon>timer.d.ts</DependentUpon>
</TypeScriptCompile> </TypeScriptCompile>
<TypeScriptCompile Include="apps\tests\local-settings-tests.ts" /> <TypeScriptCompile Include="apps\tests\application-settings-tests.ts" />
<TypeScriptCompile Include="file-system\file-system-access.android.ts"> <TypeScriptCompile Include="file-system\file-system-access.android.ts">
<DependentUpon>file-system-access.d.ts</DependentUpon> <DependentUpon>file-system-access.d.ts</DependentUpon>
</TypeScriptCompile> </TypeScriptCompile>
@ -558,14 +558,14 @@
<TypeScriptCompile Include="application\application-common.ts"> <TypeScriptCompile Include="application\application-common.ts">
<DependentUpon>application.d.ts</DependentUpon> <DependentUpon>application.d.ts</DependentUpon>
</TypeScriptCompile> </TypeScriptCompile>
<TypeScriptCompile Include="local-settings\local-settings.d.ts" /> <TypeScriptCompile Include="application-settings\application-settings.d.ts" />
<TypeScriptCompile Include="local-settings\local-settings.android.ts"> <TypeScriptCompile Include="application-settings\application-settings.android.ts">
<DependentUpon>local-settings.d.ts</DependentUpon> <DependentUpon>application-settings.d.ts</DependentUpon>
</TypeScriptCompile> </TypeScriptCompile>
<TypeScriptCompile Include="local-settings\local-settings.ios.ts"> <TypeScriptCompile Include="application-settings\application-settings.ios.ts">
<DependentUpon>local-settings.d.ts</DependentUpon> <DependentUpon>application-settings.d.ts</DependentUpon>
</TypeScriptCompile> </TypeScriptCompile>
<TypeScriptCompile Include="local-settings\local-settings-common.ts" /> <TypeScriptCompile Include="application-settings\application-settings-common.ts" />
<TypeScriptCompile Include="apps\tests\timer-tests.ts" /> <TypeScriptCompile Include="apps\tests\timer-tests.ts" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@ -1153,7 +1153,7 @@
<Content Include="globals\Readme.md" /> <Content Include="globals\Readme.md" />
<Content Include="timer\Readme.md" /> <Content Include="timer\Readme.md" />
<Content Include="apps\tests\Readme.md" /> <Content Include="apps\tests\Readme.md" />
<Content Include="local-settings\Readme.md" /> <Content Include="application-settings\Readme.md" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="ui\dialogs\Readme.md" /> <Content Include="ui\dialogs\Readme.md" />
@ -1192,7 +1192,7 @@
</Content> </Content>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="local-settings\package.json"> <Content Include="application-settings\package.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
</ItemGroup> </ItemGroup>

View File

@ -0,0 +1,3 @@

Used to store strings, booleans and numbers in built-in key/value store
Uses SharedPreferences on Android and NSUserDefaults on iOS

View File

@ -1,5 +1,5 @@
import appModule = require("application"); import appModule = require("application");
import Common = require("local-settings/local-settings-common"); import Common = require("application-settings/application-settings-common");
var sharedPreferences = appModule.android.context.getSharedPreferences("prefs.db", 0); var sharedPreferences = appModule.android.context.getSharedPreferences("prefs.db", 0);

View File

@ -1,7 +1,7 @@
/** /**
* Allows you to save and restore any kind of information related to your application. * Allows you to save and restore any kind of information related to your application.
*/ */
declare module "local-settings" { declare module "application-settings" {
/** /**
* Checks whether such a key exists. * Checks whether such a key exists.
* @param key The key to check for. * @param key The key to check for.

View File

@ -1,4 +1,4 @@
import Common = require("local-settings/local-settings-common"); import Common = require("application-settings/application-settings-common");
var userDefaults = NSUserDefaults.standardUserDefaults(); var userDefaults = NSUserDefaults.standardUserDefaults();

View File

@ -0,0 +1,2 @@
{ "name" : "application-settings",
"main" : "application-settings.js" }

View File

@ -1,6 +1,6 @@
import observable = require("data/observable"); import observable = require("data/observable");
import dialogs = require("ui/dialogs"); import dialogs = require("ui/dialogs");
import localSettings = require("local-settings"); import appSettings = require("application-settings");
import button = require("ui/button"); import button = require("ui/button");
var everlive = require("./lib/everlive"); var everlive = require("./lib/everlive");
@ -36,7 +36,7 @@ var sessions: Array<SessionModel> = new Array<SessionModel>();
var FAVOURITES = "FAVOURITES"; var FAVOURITES = "FAVOURITES";
var favourites: Array<string>; var favourites: Array<string>;
try { try {
favourites = <Array<string>>JSON.parse(localSettings.getString(FAVOURITES, "[]")); favourites = <Array<string>>JSON.parse(appSettings.getString(FAVOURITES, "[]"));
} }
catch (error) { catch (error) {
console.log("Error while retrieveing favourites: " + error); console.log("Error while retrieveing favourites: " + error);
@ -61,7 +61,7 @@ function removeFromFavourites(session: SessionModel) {
function updateFavourites() { function updateFavourites() {
var newValue = JSON.stringify(favourites); var newValue = JSON.stringify(favourites);
localSettings.setString(FAVOURITES, newValue); appSettings.setString(FAVOURITES, newValue);
} }
var el = new everlive("mzacGkKPFlZUfbMq"); var el = new everlive("mzacGkKPFlZUfbMq");

View File

@ -1,5 +1,5 @@
import observable = require("data/observable"); import observable = require("data/observable");
import localSettings = require("local-settings"); import appSettings = require("application-settings");
import dialogs = require("ui/dialogs"); import dialogs = require("ui/dialogs");
var NAME = "settings-name"; var NAME = "settings-name";
@ -11,45 +11,45 @@ var SOUND_VOLUME = "settings-sound-value";
export class SettingsViewModel extends observable.Observable { export class SettingsViewModel extends observable.Observable {
get name(): string { get name(): string {
return localSettings.getString(NAME, "John Doe"); return appSettings.getString(NAME, "John Doe");
} }
set name(value: string) { set name(value: string) {
localSettings.setString(NAME, value); appSettings.setString(NAME, value);
} }
get height(): string { get height(): string {
return localSettings.getString(HEIGHT, "180"); return appSettings.getString(HEIGHT, "180");
} }
set height(value: string) { set height(value: string) {
localSettings.setString(HEIGHT, value); appSettings.setString(HEIGHT, value);
} }
get weight(): string { get weight(): string {
return localSettings.getString(WEIGHT, "80"); return appSettings.getString(WEIGHT, "80");
} }
set weight(value: string) { set weight(value: string) {
localSettings.setString(WEIGHT, value); appSettings.setString(WEIGHT, value);
} }
get vibrateEnabled(): boolean { get vibrateEnabled(): boolean {
return localSettings.getBoolean(VIBRATE, true); return appSettings.getBoolean(VIBRATE, true);
} }
set vibrateEnabled(value: boolean) { set vibrateEnabled(value: boolean) {
localSettings.setBoolean(VIBRATE, value); appSettings.setBoolean(VIBRATE, value);
} }
get soundEnabled(): boolean { get soundEnabled(): boolean {
return localSettings.getBoolean(SOUND, true); return appSettings.getBoolean(SOUND, true);
} }
set soundEnabled(value: boolean) { set soundEnabled(value: boolean) {
localSettings.setBoolean(SOUND, value); appSettings.setBoolean(SOUND, value);
} }
get soundVolume(): number { get soundVolume(): number {
return localSettings.getNumber(SOUND_VOLUME, 100); return appSettings.getNumber(SOUND_VOLUME, 100);
} }
set soundVolume(value: number) { set soundVolume(value: number) {
localSettings.setNumber(SOUND_VOLUME, value); appSettings.setNumber(SOUND_VOLUME, value);
} }
public promptName(args: observable.EventData) { public promptName(args: observable.EventData) {
@ -65,7 +65,7 @@ export var settingsViewModel = new SettingsViewModel();
// Pure JavaScript code: // Pure JavaScript code:
//var observable = require("data/observable"); //var observable = require("data/observable");
//var localSettings = require("local-settings"); //var appSettings = require("application-settings");
//var NAME = "settings-name"; //var NAME = "settings-name";
//var HEIGHT = "settings-height"; //var HEIGHT = "settings-height";
@ -76,43 +76,43 @@ export var settingsViewModel = new SettingsViewModel();
//var settings = new observable.Observable(); //var settings = new observable.Observable();
//Object.defineProperty(settings, "name", { //Object.defineProperty(settings, "name", {
// get: function () { return localSettings.getString(NAME, "John Doe"); }, // get: function () { return appSettings.getString(NAME, "John Doe"); },
// set: function (value) { localSettings.setString(NAME, value); }, // set: function (value) { appSettings.setString(NAME, value); },
// enumerable: true, // enumerable: true,
// configurable: true // configurable: true
//}); //});
//Object.defineProperty(settings, "height", { //Object.defineProperty(settings, "height", {
// get: function () { return localSettings.getString(HEIGHT, "180"); }, // get: function () { return appSettings.getString(HEIGHT, "180"); },
// set: function (value) { localSettings.setString(HEIGHT, value); }, // set: function (value) { appSettings.setString(HEIGHT, value); },
// enumerable: true, // enumerable: true,
// configurable: true // configurable: true
//}); //});
//Object.defineProperty(settings, "weight", { //Object.defineProperty(settings, "weight", {
// get: function () { return localSettings.getString(WEIGHT, "80"); }, // get: function () { return appSettings.getString(WEIGHT, "80"); },
// set: function (value) { localSettings.setString(WEIGHT, value); }, // set: function (value) { appSettings.setString(WEIGHT, value); },
// enumerable: true, // enumerable: true,
// configurable: true // configurable: true
//}); //});
//Object.defineProperty(settings, "vibrateEnabled", { //Object.defineProperty(settings, "vibrateEnabled", {
// get: function () { return localSettings.getBoolean(VIBRATE, true); }, // get: function () { return appSettings.getBoolean(VIBRATE, true); },
// set: function (value) { localSettings.setBoolean(VIBRATE, value); }, // set: function (value) { appSettings.setBoolean(VIBRATE, value); },
// enumerable: true, // enumerable: true,
// configurable: true // configurable: true
//}); //});
//Object.defineProperty(settings, "soundEnabled", { //Object.defineProperty(settings, "soundEnabled", {
// get: function () { return localSettings.getBoolean(SOUND, true); }, // get: function () { return appSettings.getBoolean(SOUND, true); },
// set: function (value) { localSettings.setBoolean(SOUND, value); }, // set: function (value) { appSettings.setBoolean(SOUND, value); },
// enumerable: true, // enumerable: true,
// configurable: true // configurable: true
//}); //});
//Object.defineProperty(settings, "soundVolume", { //Object.defineProperty(settings, "soundVolume", {
// get: function () { return localSettings.getNumber(SOUND_VOLUME, 100); }, // get: function () { return appSettings.getNumber(SOUND_VOLUME, 100); },
// set: function (value) { localSettings.setNumber(SOUND_VOLUME, value); }, // set: function (value) { appSettings.setNumber(SOUND_VOLUME, value); },
// enumerable: true, // enumerable: true,
// configurable: true // configurable: true
//}); //});

View File

@ -1,8 +1,8 @@
// <snippet module="local-settings" title="local-settings"> // <snippet module="application-settings" title="application-settings">
// # Local Settings // # Local Settings
// Using local settings methods requires to load "local settings" module. // Using local settings methods requires to load "local settings" module.
// ``` JavaScript // ``` JavaScript
var LocalSettings = require("local-settings"); var appSettings = require("application-settings");
// ``` // ```
// </snippet> // </snippet>
var TKUnit = require("./TKUnit"); var TKUnit = require("./TKUnit");
@ -14,118 +14,118 @@ var noStringKey: string = "noStringKey";
var noBoolKey: string = "noBoolKey"; var noBoolKey: string = "noBoolKey";
var noNumberKey: string = "noNumberKey"; var noNumberKey: string = "noNumberKey";
// <snippet module="local-settings" title="local-settings"> // <snippet module="application-settings" title="application-settings">
// ## Working with string, number and boolean values // ## Working with string, number and boolean values
// </snippet> // </snippet>
export var testBoolean = function () { export var testBoolean = function () {
LocalSettings.setBoolean(boolKey, false); appSettings.setBoolean(boolKey, false);
var boolValueBefore = LocalSettings.getBoolean(boolKey); var boolValueBefore = appSettings.getBoolean(boolKey);
TKUnit.assert(false === boolValueBefore, "Cannot set boolean to false, currently it is: " + LocalSettings.getBoolean(boolKey)); TKUnit.assert(false === boolValueBefore, "Cannot set boolean to false, currently it is: " + appSettings.getBoolean(boolKey));
// <snippet module="local-settings" title="local-settings"> // <snippet module="application-settings" title="application-settings">
// ### Set and get boolean value and provide default value in case it is not set // ### Set and get boolean value and provide default value in case it is not set
// ``` JavaScript // ``` JavaScript
LocalSettings.setBoolean("boolKey", true); appSettings.setBoolean("boolKey", true);
var boolValue = LocalSettings.getBoolean("boolKey", false); var boolValue = appSettings.getBoolean("boolKey", false);
// ``` // ```
// </snippet> // </snippet>
TKUnit.assert(true === boolValue, "Cannot set boolean to true"); TKUnit.assert(true === boolValue, "Cannot set boolean to true");
TKUnit.assert(true === LocalSettings.getBoolean(boolKey), "Cannot set boolean to true (no default)"); TKUnit.assert(true === appSettings.getBoolean(boolKey), "Cannot set boolean to true (no default)");
}; };
export var testString = function () { export var testString = function () {
// <snippet module="local-settings" title="local-settings"> // <snippet module="application-settings" title="application-settings">
// ### Set and get string value // ### Set and get string value
// ``` JavaScript // ``` JavaScript
LocalSettings.setString("stringKey", "String value"); appSettings.setString("stringKey", "String value");
var stringValue = LocalSettings.getString("stringKey"); var stringValue = appSettings.getString("stringKey");
// ``` // ```
// </snippet> // </snippet>
TKUnit.assert("String value" === stringValue, "Cannot set string value"); TKUnit.assert("String value" === stringValue, "Cannot set string value");
}; };
export var testNumber = function () { export var testNumber = function () {
// <snippet module="local-settings" title="local-settings"> // <snippet module="application-settings" title="application-settings">
// ### Set and get numeric value. // ### Set and get numeric value.
// We use `toFixed()` here in order to avoid floating point errors - ex: `54.321` becoming `54.320999999537`. // We use `toFixed()` here in order to avoid floating point errors - ex: `54.321` becoming `54.320999999537`.
// Beware the result of `toFixed()` is a string not a number therefore you cannot use `===` or `!==` when comparing with a number. // Beware the result of `toFixed()` is a string not a number therefore you cannot use `===` or `!==` when comparing with a number.
// ``` JavaScript // ``` JavaScript
LocalSettings.setNumber("numberKey", 54.321); appSettings.setNumber("numberKey", 54.321);
var value = parseFloat(LocalSettings.getNumber("numberKey").toFixed(3)); var value = parseFloat(appSettings.getNumber("numberKey").toFixed(3));
// ``` // ```
// </snippet> // </snippet>
TKUnit.assert(54.321 === value, "Cannot set number value 54.321 != " + value); TKUnit.assert(54.321 === value, "Cannot set number value 54.321 != " + value);
}; };
export var testDefaults = function () { export var testDefaults = function () {
// <snippet module="local-settings" title="local-settings"> // <snippet module="application-settings" title="application-settings">
// ### Reading values that are not set before while providing default value // ### Reading values that are not set before while providing default value
// ``` JavaScript // ``` JavaScript
var defaultValue = LocalSettings.getString("noStringKey", "No string value"); var defaultValue = appSettings.getString("noStringKey", "No string value");
//// will return "No string value" if there is no value for "noStringKey" //// will return "No string value" if there is no value for "noStringKey"
// ``` // ```
// </snippet> // </snippet>
TKUnit.assert("No string value" === defaultValue, "Bad default string value"); TKUnit.assert("No string value" === defaultValue, "Bad default string value");
TKUnit.assert(true === LocalSettings.getBoolean(noBoolKey, true), "Bad default boolean value"); TKUnit.assert(true === appSettings.getBoolean(noBoolKey, true), "Bad default boolean value");
TKUnit.assert(123.45 === LocalSettings.getNumber(noNumberKey, 123.45), "Bad default number value"); TKUnit.assert(123.45 === appSettings.getNumber(noNumberKey, 123.45), "Bad default number value");
} }
export var testDefaultsWithNoDefaultValueProvided = function () { export var testDefaultsWithNoDefaultValueProvided = function () {
// <snippet module="local-settings" title="local-settings"> // <snippet module="application-settings" title="application-settings">
// ### Reading values that are not set before not providing default value // ### Reading values that are not set before not providing default value
// ``` JavaScript // ``` JavaScript
var defaultValue = LocalSettings.getString("noStringKey"); var defaultValue = appSettings.getString("noStringKey");
//// will return undefined if there is no value for "noStringKey" //// will return undefined if there is no value for "noStringKey"
// ``` // ```
// </snippet> // </snippet>
TKUnit.assert("undefined" === typeof defaultValue, "Default string value is not undefined"); TKUnit.assert("undefined" === typeof defaultValue, "Default string value is not undefined");
TKUnit.assert("undefined" === typeof LocalSettings.getBoolean(noBoolKey), "Default boolean value is not undefined"); TKUnit.assert("undefined" === typeof appSettings.getBoolean(noBoolKey), "Default boolean value is not undefined");
TKUnit.assert("undefined" === typeof LocalSettings.getNumber(noNumberKey), "Default number value is not undefined"); TKUnit.assert("undefined" === typeof appSettings.getNumber(noNumberKey), "Default number value is not undefined");
}; };
// <snippet module="local-settings" title="local-settings"> // <snippet module="application-settings" title="application-settings">
// ## Other functions // ## Other functions
// </snippet> // </snippet>
export var testHasKey = function () { export var testHasKey = function () {
// <snippet module="local-settings" title="local-settings"> // <snippet module="application-settings" title="application-settings">
// ### Checking for existence of value for key // ### Checking for existence of value for key
// ``` JavaScript // ``` JavaScript
var hasKey = LocalSettings.hasKey("noBoolKey"); var hasKey = appSettings.hasKey("noBoolKey");
//// will return false if there is no value for "noBoolKey" //// will return false if there is no value for "noBoolKey"
// ``` // ```
// </snippet> // </snippet>
TKUnit.assert(!hasKey, "There is a key: " + noBoolKey); TKUnit.assert(!hasKey, "There is a key: " + noBoolKey);
TKUnit.assert(!LocalSettings.hasKey(noStringKey), "There is a key: " + noStringKey); TKUnit.assert(!appSettings.hasKey(noStringKey), "There is a key: " + noStringKey);
TKUnit.assert(!LocalSettings.hasKey(noNumberKey), "There is a key: " + noNumberKey); TKUnit.assert(!appSettings.hasKey(noNumberKey), "There is a key: " + noNumberKey);
TKUnit.assert(LocalSettings.hasKey(boolKey), "There is no key: " + boolKey); TKUnit.assert(appSettings.hasKey(boolKey), "There is no key: " + boolKey);
TKUnit.assert(LocalSettings.hasKey(stringKey), "There is no key: " + stringKey); TKUnit.assert(appSettings.hasKey(stringKey), "There is no key: " + stringKey);
TKUnit.assert(LocalSettings.hasKey(numberKey), "There is no key: " + numberKey); TKUnit.assert(appSettings.hasKey(numberKey), "There is no key: " + numberKey);
}; };
export var testRemove = function () { export var testRemove = function () {
// <snippet module="local-settings" title="local-settings"> // <snippet module="application-settings" title="application-settings">
// ### Removing value for key // ### Removing value for key
// ``` JavaScript // ``` JavaScript
LocalSettings.remove("boolKey"); appSettings.remove("boolKey");
// ``` // ```
// </snippet> // </snippet>
TKUnit.assert(!LocalSettings.hasKey(boolKey), "Failed to remove key: " + boolKey); TKUnit.assert(!appSettings.hasKey(boolKey), "Failed to remove key: " + boolKey);
LocalSettings.remove(stringKey); appSettings.remove(stringKey);
TKUnit.assert(!LocalSettings.hasKey(stringKey), "Failed to remove key: " + stringKey); TKUnit.assert(!appSettings.hasKey(stringKey), "Failed to remove key: " + stringKey);
LocalSettings.remove(numberKey); appSettings.remove(numberKey);
TKUnit.assert(!LocalSettings.hasKey(numberKey), "Failed to remove key: " + numberKey); TKUnit.assert(!appSettings.hasKey(numberKey), "Failed to remove key: " + numberKey);
}; };
export var testInvalidKey = function () { export var testInvalidKey = function () {
try { try {
LocalSettings.hasKey(undefined); appSettings.hasKey(undefined);
TKUnit.assert(false, "There is a key undefined"); TKUnit.assert(false, "There is a key undefined");
} }
catch (e) { catch (e) {
@ -133,7 +133,7 @@ export var testInvalidKey = function () {
} }
try { try {
LocalSettings.hasKey(null); appSettings.hasKey(null);
TKUnit.assert(false, "There is a key null"); TKUnit.assert(false, "There is a key null");
} }
catch (e) { catch (e) {
@ -141,19 +141,19 @@ export var testInvalidKey = function () {
} }
try { try {
LocalSettings.hasKey(123); appSettings.hasKey(123);
TKUnit.assert(false, "There is a key number"); TKUnit.assert(false, "There is a key number");
} }
catch (e) { catch (e) {
// we should receive an exception here // we should receive an exception here
} }
LocalSettings.hasKey("string"); appSettings.hasKey("string");
}; };
export var testInvalidValue = function () { export var testInvalidValue = function () {
try { try {
LocalSettings.setBoolean(boolKey, "str"); appSettings.setBoolean(boolKey, "str");
TKUnit.assert(false, "There is a key undefined"); TKUnit.assert(false, "There is a key undefined");
} }
catch (e) { catch (e) {
@ -161,7 +161,7 @@ export var testInvalidValue = function () {
} }
try { try {
LocalSettings.setBoolean(boolKey, 123); appSettings.setBoolean(boolKey, 123);
TKUnit.assert(false, "There is a key undefined"); TKUnit.assert(false, "There is a key undefined");
} }
catch (e) { catch (e) {
@ -169,7 +169,7 @@ export var testInvalidValue = function () {
} }
try { try {
LocalSettings.setString(boolKey, true); appSettings.setString(boolKey, true);
TKUnit.assert(false, "There is a key undefined"); TKUnit.assert(false, "There is a key undefined");
} }
catch (e) { catch (e) {
@ -177,7 +177,7 @@ export var testInvalidValue = function () {
} }
try { try {
LocalSettings.setString(boolKey, 123); appSettings.setString(boolKey, 123);
TKUnit.assert(false, "There is a key undefined"); TKUnit.assert(false, "There is a key undefined");
} }
catch (e) { catch (e) {
@ -185,7 +185,7 @@ export var testInvalidValue = function () {
} }
try { try {
LocalSettings.setNumber(boolKey, true); appSettings.setNumber(boolKey, true);
TKUnit.assert(false, "There is a key undefined"); TKUnit.assert(false, "There is a key undefined");
} }
catch (e) { catch (e) {
@ -193,7 +193,7 @@ export var testInvalidValue = function () {
} }
try { try {
LocalSettings.setNumber(boolKey, "123"); appSettings.setNumber(boolKey, "123");
TKUnit.assert(false, "There is a key undefined"); TKUnit.assert(false, "There is a key undefined");
} }
catch (e) { catch (e) {

View File

@ -33,7 +33,7 @@ allTests["SCROLL-VIEW"] = require("./ui/scroll-view/scroll-view-tests");
allTests["APPLICATION"] = require("./application-tests"); allTests["APPLICATION"] = require("./application-tests");
allTests["FILE SYSTEM"] = require("./file-system-tests"); allTests["FILE SYSTEM"] = require("./file-system-tests");
allTests["HTTP"] = require("./http-tests"); allTests["HTTP"] = require("./http-tests");
allTests["LOCAL SETTINGS"] = require("./local-settings-tests"); allTests["APPLICATION SETTINGS"] = require("./application-settings-tests");
allTests["IMAGE SOURCE"] = require("./image-source-tests"); allTests["IMAGE SOURCE"] = require("./image-source-tests");
allTests["TIMER"] = require("./timer-tests"); allTests["TIMER"] = require("./timer-tests");
allTests["COLOR"] = require("./color-tests"); allTests["COLOR"] = require("./color-tests");

View File

@ -1,19 +0,0 @@

Used to store strings, booleans and numbers in built-in key/value store
Uses SharedPreferences on Android and NSUserDefaults on iOS
Sample code:
```
UserPreferences.setBoolean("boolKey", false);
var bValue = UserPreferences.getBoolean("boolKey");
var sValue = UserPreferences.getString("noSuchStringKey", "No string value");
// will return "No string value" if there is no such value
var weHaveKey = UserPreferences.hasKey("boolKey");
if (weHaveKey) {
UserPreferences.remove("boolKey");
}
```

View File

@ -1,2 +0,0 @@
{ "name" : "local-settings",
"main" : "local-settings.js" }