Merge pull request #2 from purplecabbage/2.4.0rc2Prep
2.4.0rc2 prep
diff --git a/VERSION b/VERSION
index edf28ac..6f905f8 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.4.0rc1
\ No newline at end of file
+2.4.0rc2
\ No newline at end of file
diff --git a/example/www/cordova-2.4.0.js b/example/www/cordova-2.4.0.js
index b64e13f..d62f792 100644
--- a/example/www/cordova-2.4.0.js
+++ b/example/www/cordova-2.4.0.js
@@ -1,6 +1,8 @@
-// commit 7d5552049e33254eca3bda227af8a4892a7ce7c3
+// Platform: windowsphone
-// File generated at :: Mon Jan 21 2013 17:12:32 GMT-0800 (Pacific Standard Time)
+// commit e784eee3ce02dbd475e3c3f70031668f1706f2ec
+
+// File generated at :: Fri Feb 01 2013 14:32:23 GMT-0800 (Pacific Standard Time)
/*
Licensed to the Apache Software Foundation (ASF) under one
@@ -78,6 +80,7 @@
delete modules[id];
};
+ define.moduleMap = modules;
})();
//Export for use in node
@@ -409,6 +412,8 @@
if (message) {
utils.defineGetter(obj, key, function() {
console.log(message);
+ delete obj[key];
+ clobber(obj, key, value);
return value;
});
} else {
@@ -438,10 +443,6 @@
// Overwrite if not currently defined.
if (typeof parent[key] == 'undefined') {
assignOrWrapInDeprecateGetter(parent, key, result, obj.deprecated);
- } else if (merge && typeof obj.path !== 'undefined') {
- // If merging, merge parent onto result
- recursiveMerge(result, parent[key]);
- parent[key] = result;
} else {
// Set result to what already exists, so we can build children into it if they exist.
result = parent[key];
@@ -467,19 +468,18 @@
function recursiveMerge(target, src) {
for (var prop in src) {
if (src.hasOwnProperty(prop)) {
- if (typeof target.prototype !== 'undefined' && target.prototype.constructor === target) {
+ if (target.prototype && target.prototype.constructor === target) {
// If the target object is a constructor override off prototype.
- target.prototype[prop] = src[prop];
+ clobber(target.prototype, prop, src[prop]);
} else {
- if (typeof src[prop] === 'object') {
- target[prop] = recursiveMerge(target[prop], src[prop]);
+ if (typeof src[prop] === 'object' && typeof target[prop] === 'object') {
+ recursiveMerge(target[prop], src[prop]);
} else {
clobber(target, prop, src[prop]);
}
}
}
}
- return target;
}
module.exports = {
@@ -491,7 +491,9 @@
},
buildIntoAndMerge: function(objects, target) {
include(target, objects, true, true);
- }
+ },
+ recursiveMerge: recursiveMerge,
+ assignOrWrapInDeprecateGetter: assignOrWrapInDeprecateGetter
};
});
@@ -904,54 +906,9 @@
device: {
path: 'cordova/plugin/device'
},
- DirectoryEntry: {
- path: 'cordova/plugin/DirectoryEntry'
- },
- DirectoryReader: {
- path: 'cordova/plugin/DirectoryReader'
- },
- Entry: {
- path: 'cordova/plugin/Entry'
- },
- File: {
- path: 'cordova/plugin/File'
- },
- FileEntry: {
- path: 'cordova/plugin/FileEntry'
- },
- FileError: {
- path: 'cordova/plugin/FileError'
- },
- FileReader: {
- path: 'cordova/plugin/FileReader'
- },
- FileSystem: {
- path: 'cordova/plugin/FileSystem'
- },
- FileTransfer: {
- path: 'cordova/plugin/FileTransfer'
- },
- FileTransferError: {
- path: 'cordova/plugin/FileTransferError'
- },
- FileUploadOptions: {
- path: 'cordova/plugin/FileUploadOptions'
- },
- FileUploadResult: {
- path: 'cordova/plugin/FileUploadResult'
- },
- FileWriter: {
- path: 'cordova/plugin/FileWriter'
- },
- Flags: {
- path: 'cordova/plugin/Flags'
- },
GlobalizationError: {
path: 'cordova/plugin/GlobalizationError'
},
- LocalFileSystem: {
- path: 'cordova/plugin/LocalFileSystem'
- },
Media: {
path: 'cordova/plugin/Media'
},
@@ -964,9 +921,6 @@
MediaFileData:{
path: 'cordova/plugin/MediaFileData'
},
- Metadata:{
- path: 'cordova/plugin/Metadata'
- },
Position: {
path: 'cordova/plugin/Position'
},
@@ -975,12 +929,6 @@
},
ProgressEvent: {
path: 'cordova/plugin/ProgressEvent'
- },
- requestFileSystem:{
- path: 'cordova/plugin/requestFileSystem'
- },
- resolveLocalFileSystemURI:{
- path: 'cordova/plugin/resolveLocalFileSystemURI'
}
},
clobbers: {
@@ -1049,6 +997,107 @@
});
+// file: lib\common\modulemapper.js
+define("cordova/modulemapper", function(require, exports, module) {
+
+var builder = require('cordova/builder'),
+ moduleMap = define.moduleMap,
+ symbolList,
+ deprecationMap;
+
+exports.reset = function() {
+ symbolList = [];
+ deprecationMap = {};
+};
+
+function addEntry(strategy, moduleName, symbolPath, opt_deprecationMessage) {
+ if (!(moduleName in moduleMap)) {
+ throw new Error('Module ' + moduleName + ' does not exist.');
+ }
+ symbolList.push(strategy, moduleName, symbolPath);
+ if (opt_deprecationMessage) {
+ deprecationMap[symbolPath] = opt_deprecationMessage;
+ }
+}
+
+// Note: Android 2.3 does have Function.bind().
+exports.clobbers = function(moduleName, symbolPath, opt_deprecationMessage) {
+ addEntry('c', moduleName, symbolPath, opt_deprecationMessage);
+};
+
+exports.merges = function(moduleName, symbolPath, opt_deprecationMessage) {
+ addEntry('m', moduleName, symbolPath, opt_deprecationMessage);
+};
+
+exports.defaults = function(moduleName, symbolPath, opt_deprecationMessage) {
+ addEntry('d', moduleName, symbolPath, opt_deprecationMessage);
+};
+
+function prepareNamespace(symbolPath, context) {
+ if (!symbolPath) {
+ return context;
+ }
+ var parts = symbolPath.split('.');
+ var cur = context;
+ for (var i = 0, part; part = parts[i]; ++i) {
+ cur[part] = cur[part] || {};
+ }
+ return cur[parts[i-1]];
+}
+
+exports.mapModules = function(context) {
+ var origSymbols = {};
+ context.CDV_origSymbols = origSymbols;
+ for (var i = 0, len = symbolList.length; i < len; i += 3) {
+ var strategy = symbolList[i];
+ var moduleName = symbolList[i + 1];
+ var symbolPath = symbolList[i + 2];
+ var lastDot = symbolPath.lastIndexOf('.');
+ var namespace = symbolPath.substr(0, lastDot);
+ var lastName = symbolPath.substr(lastDot + 1);
+
+ var module = require(moduleName);
+ var deprecationMsg = symbolPath in deprecationMap ? 'Access made to deprecated symbol: ' + symbolPath + '. ' + deprecationMsg : null;
+ var parentObj = prepareNamespace(namespace, context);
+ var target = parentObj[lastName];
+
+ if (strategy == 'm' && target) {
+ builder.recursiveMerge(target, module);
+ } else if ((strategy == 'd' && !target) || (strategy != 'd')) {
+ if (target) {
+ origSymbols[symbolPath] = target;
+ }
+ builder.assignOrWrapInDeprecateGetter(parentObj, lastName, module, deprecationMsg);
+ }
+ }
+};
+
+exports.getOriginalSymbol = function(context, symbolPath) {
+ var origSymbols = context.CDV_origSymbols;
+ if (origSymbols && (symbolPath in origSymbols)) {
+ return origSymbols[symbolPath];
+ }
+ var parts = symbolPath.split('.');
+ var obj = context;
+ for (var i = 0; i < parts.length; ++i) {
+ obj = obj && obj[parts[i]];
+ }
+ return obj;
+};
+
+exports.loadMatchingModules = function(matchingRegExp) {
+ for (var k in moduleMap) {
+ if (matchingRegExp.exec(k)) {
+ require(k);
+ }
+ }
+};
+
+exports.reset();
+
+
+});
+
// file: lib\windowsphone\platform.js
define("cordova/platform", function(require, exports, module) {
@@ -1067,11 +1116,13 @@
module.exports = {
id: "windowsphone",
initialize:function() {
+ var modulemapper = require('cordova/modulemapper');
+
+ modulemapper.loadMatchingModules(/cordova.*\/symbols$/);
+ modulemapper.mapModules(window);
+
window.alert = window.alert || require("cordova/plugin/notification").alert;
window.confirm = window.confirm || require("cordova/plugin/notification").confirm;
- window.FileReader = require("cordova/plugin/FileReader");
- window.File = require("cordova/plugin/File");
-
// Inject a listener for the backbutton, and tell native to override the flag (true/false) when we have 1 or more, or 0, listeners
var backButtonChannel = cordova.addDocumentEventHandler('backbutton');
@@ -1103,9 +1154,6 @@
},
console:{
path: "cordova/plugin/windowsphone/console"
- },
- FileTransfer: {
- path: 'cordova/plugin/windowsphone/FileTransfer'
}
}
};
@@ -2265,11 +2313,12 @@
define("cordova/plugin/FileReader", function(require, exports, module) {
var exec = require('cordova/exec'),
+ modulemapper = require('cordova/modulemapper'),
utils = require('cordova/utils'),
File = require('cordova/plugin/File'),
FileError = require('cordova/plugin/FileError'),
ProgressEvent = require('cordova/plugin/ProgressEvent'),
- origFileReader = this.FileReader;
+ origFileReader = modulemapper.getOriginalSymbol(this, 'FileReader');
/**
* This class reads the mobile device file system.
@@ -4257,6 +4306,46 @@
});
+// file: lib\windowsphone\plugin\file\symbols.js
+define("cordova/plugin/file/symbols", function(require, exports, module) {
+
+
+var modulemapper = require('cordova/modulemapper'),
+ symbolshelper = require('cordova/plugin/file/symbolshelper');
+
+symbolshelper(modulemapper.defaults);
+modulemapper.clobbers('cordova/plugin/File', 'File');
+modulemapper.clobbers('cordova/plugin/FileReader', 'FileReader');
+modulemapper.clobbers('cordova/plugin/windowsphone/FileTransfer', 'FileTransfer');
+
+});
+
+// file: lib\common\plugin\file\symbolshelper.js
+define("cordova/plugin/file/symbolshelper", function(require, exports, module) {
+
+module.exports = function(exportFunc) {
+ exportFunc('cordova/plugin/DirectoryEntry', 'DirectoryEntry');
+ exportFunc('cordova/plugin/DirectoryReader', 'DirectoryReader');
+ exportFunc('cordova/plugin/Entry', 'Entry');
+ exportFunc('cordova/plugin/File', 'File');
+ exportFunc('cordova/plugin/FileEntry', 'FileEntry');
+ exportFunc('cordova/plugin/FileError', 'FileError');
+ exportFunc('cordova/plugin/FileReader', 'FileReader');
+ exportFunc('cordova/plugin/FileSystem', 'FileSystem');
+ exportFunc('cordova/plugin/FileTransfer', 'FileTransfer');
+ exportFunc('cordova/plugin/FileTransferError', 'FileTransferError');
+ exportFunc('cordova/plugin/FileUploadOptions', 'FileUploadOptions');
+ exportFunc('cordova/plugin/FileUploadResult', 'FileUploadResult');
+ exportFunc('cordova/plugin/FileWriter', 'FileWriter');
+ exportFunc('cordova/plugin/Flags', 'Flags');
+ exportFunc('cordova/plugin/LocalFileSystem', 'LocalFileSystem');
+ exportFunc('cordova/plugin/Metadata', 'Metadata');
+ exportFunc('cordova/plugin/requestFileSystem', 'requestFileSystem');
+ exportFunc('cordova/plugin/resolveLocalFileSystemURI', 'resolveLocalFileSystemURI');
+};
+
+});
+
// file: lib\common\plugin\geolocation.js
define("cordova/plugin/geolocation", function(require, exports, module) {
@@ -5991,7 +6080,10 @@
*/
utils.defineGetterSetter = function(obj, key, getFunc, opt_setFunc) {
if (Object.defineProperty) {
- var desc = {get:getFunc};
+ var desc = {
+ get: getFunc,
+ configurable: true
+ };
if (opt_setFunc) {
desc.set = opt_setFunc;
}
diff --git a/framework/WPCordovaClassLib.csproj b/framework/WPCordovaClassLib.csproj
index 9bc9a1c..a6e0fcf 100644
--- a/framework/WPCordovaClassLib.csproj
+++ b/framework/WPCordovaClassLib.csproj
@@ -164,6 +164,9 @@
<Compile Include="..\templates\standalone\cordovalib\Commands\GeoLocation.cs">
<Link>CordovaLib\Commands\GeoLocation.cs</Link>
</Compile>
+ <Compile Include="..\templates\standalone\cordovalib\Commands\Globalization.cs">
+ <Link>CordovaLib\Commands\Globalization.cs</Link>
+ </Compile>
<Compile Include="..\templates\standalone\cordovalib\Commands\ImageExifHelper.cs">
<Link>CordovaLib\Commands\ImageExifHelper.cs</Link>
</Compile>
diff --git a/templates/custom/VERSION b/templates/custom/VERSION
index edf28ac..6f905f8 100644
--- a/templates/custom/VERSION
+++ b/templates/custom/VERSION
@@ -1 +1 @@
-2.4.0rc1
\ No newline at end of file
+2.4.0rc2
\ No newline at end of file
diff --git a/templates/custom/www/cordova-2.4.0.js b/templates/custom/www/cordova-2.4.0.js
index b64e13f..d62f792 100644
--- a/templates/custom/www/cordova-2.4.0.js
+++ b/templates/custom/www/cordova-2.4.0.js
@@ -1,6 +1,8 @@
-// commit 7d5552049e33254eca3bda227af8a4892a7ce7c3
+// Platform: windowsphone
-// File generated at :: Mon Jan 21 2013 17:12:32 GMT-0800 (Pacific Standard Time)
+// commit e784eee3ce02dbd475e3c3f70031668f1706f2ec
+
+// File generated at :: Fri Feb 01 2013 14:32:23 GMT-0800 (Pacific Standard Time)
/*
Licensed to the Apache Software Foundation (ASF) under one
@@ -78,6 +80,7 @@
delete modules[id];
};
+ define.moduleMap = modules;
})();
//Export for use in node
@@ -409,6 +412,8 @@
if (message) {
utils.defineGetter(obj, key, function() {
console.log(message);
+ delete obj[key];
+ clobber(obj, key, value);
return value;
});
} else {
@@ -438,10 +443,6 @@
// Overwrite if not currently defined.
if (typeof parent[key] == 'undefined') {
assignOrWrapInDeprecateGetter(parent, key, result, obj.deprecated);
- } else if (merge && typeof obj.path !== 'undefined') {
- // If merging, merge parent onto result
- recursiveMerge(result, parent[key]);
- parent[key] = result;
} else {
// Set result to what already exists, so we can build children into it if they exist.
result = parent[key];
@@ -467,19 +468,18 @@
function recursiveMerge(target, src) {
for (var prop in src) {
if (src.hasOwnProperty(prop)) {
- if (typeof target.prototype !== 'undefined' && target.prototype.constructor === target) {
+ if (target.prototype && target.prototype.constructor === target) {
// If the target object is a constructor override off prototype.
- target.prototype[prop] = src[prop];
+ clobber(target.prototype, prop, src[prop]);
} else {
- if (typeof src[prop] === 'object') {
- target[prop] = recursiveMerge(target[prop], src[prop]);
+ if (typeof src[prop] === 'object' && typeof target[prop] === 'object') {
+ recursiveMerge(target[prop], src[prop]);
} else {
clobber(target, prop, src[prop]);
}
}
}
}
- return target;
}
module.exports = {
@@ -491,7 +491,9 @@
},
buildIntoAndMerge: function(objects, target) {
include(target, objects, true, true);
- }
+ },
+ recursiveMerge: recursiveMerge,
+ assignOrWrapInDeprecateGetter: assignOrWrapInDeprecateGetter
};
});
@@ -904,54 +906,9 @@
device: {
path: 'cordova/plugin/device'
},
- DirectoryEntry: {
- path: 'cordova/plugin/DirectoryEntry'
- },
- DirectoryReader: {
- path: 'cordova/plugin/DirectoryReader'
- },
- Entry: {
- path: 'cordova/plugin/Entry'
- },
- File: {
- path: 'cordova/plugin/File'
- },
- FileEntry: {
- path: 'cordova/plugin/FileEntry'
- },
- FileError: {
- path: 'cordova/plugin/FileError'
- },
- FileReader: {
- path: 'cordova/plugin/FileReader'
- },
- FileSystem: {
- path: 'cordova/plugin/FileSystem'
- },
- FileTransfer: {
- path: 'cordova/plugin/FileTransfer'
- },
- FileTransferError: {
- path: 'cordova/plugin/FileTransferError'
- },
- FileUploadOptions: {
- path: 'cordova/plugin/FileUploadOptions'
- },
- FileUploadResult: {
- path: 'cordova/plugin/FileUploadResult'
- },
- FileWriter: {
- path: 'cordova/plugin/FileWriter'
- },
- Flags: {
- path: 'cordova/plugin/Flags'
- },
GlobalizationError: {
path: 'cordova/plugin/GlobalizationError'
},
- LocalFileSystem: {
- path: 'cordova/plugin/LocalFileSystem'
- },
Media: {
path: 'cordova/plugin/Media'
},
@@ -964,9 +921,6 @@
MediaFileData:{
path: 'cordova/plugin/MediaFileData'
},
- Metadata:{
- path: 'cordova/plugin/Metadata'
- },
Position: {
path: 'cordova/plugin/Position'
},
@@ -975,12 +929,6 @@
},
ProgressEvent: {
path: 'cordova/plugin/ProgressEvent'
- },
- requestFileSystem:{
- path: 'cordova/plugin/requestFileSystem'
- },
- resolveLocalFileSystemURI:{
- path: 'cordova/plugin/resolveLocalFileSystemURI'
}
},
clobbers: {
@@ -1049,6 +997,107 @@
});
+// file: lib\common\modulemapper.js
+define("cordova/modulemapper", function(require, exports, module) {
+
+var builder = require('cordova/builder'),
+ moduleMap = define.moduleMap,
+ symbolList,
+ deprecationMap;
+
+exports.reset = function() {
+ symbolList = [];
+ deprecationMap = {};
+};
+
+function addEntry(strategy, moduleName, symbolPath, opt_deprecationMessage) {
+ if (!(moduleName in moduleMap)) {
+ throw new Error('Module ' + moduleName + ' does not exist.');
+ }
+ symbolList.push(strategy, moduleName, symbolPath);
+ if (opt_deprecationMessage) {
+ deprecationMap[symbolPath] = opt_deprecationMessage;
+ }
+}
+
+// Note: Android 2.3 does have Function.bind().
+exports.clobbers = function(moduleName, symbolPath, opt_deprecationMessage) {
+ addEntry('c', moduleName, symbolPath, opt_deprecationMessage);
+};
+
+exports.merges = function(moduleName, symbolPath, opt_deprecationMessage) {
+ addEntry('m', moduleName, symbolPath, opt_deprecationMessage);
+};
+
+exports.defaults = function(moduleName, symbolPath, opt_deprecationMessage) {
+ addEntry('d', moduleName, symbolPath, opt_deprecationMessage);
+};
+
+function prepareNamespace(symbolPath, context) {
+ if (!symbolPath) {
+ return context;
+ }
+ var parts = symbolPath.split('.');
+ var cur = context;
+ for (var i = 0, part; part = parts[i]; ++i) {
+ cur[part] = cur[part] || {};
+ }
+ return cur[parts[i-1]];
+}
+
+exports.mapModules = function(context) {
+ var origSymbols = {};
+ context.CDV_origSymbols = origSymbols;
+ for (var i = 0, len = symbolList.length; i < len; i += 3) {
+ var strategy = symbolList[i];
+ var moduleName = symbolList[i + 1];
+ var symbolPath = symbolList[i + 2];
+ var lastDot = symbolPath.lastIndexOf('.');
+ var namespace = symbolPath.substr(0, lastDot);
+ var lastName = symbolPath.substr(lastDot + 1);
+
+ var module = require(moduleName);
+ var deprecationMsg = symbolPath in deprecationMap ? 'Access made to deprecated symbol: ' + symbolPath + '. ' + deprecationMsg : null;
+ var parentObj = prepareNamespace(namespace, context);
+ var target = parentObj[lastName];
+
+ if (strategy == 'm' && target) {
+ builder.recursiveMerge(target, module);
+ } else if ((strategy == 'd' && !target) || (strategy != 'd')) {
+ if (target) {
+ origSymbols[symbolPath] = target;
+ }
+ builder.assignOrWrapInDeprecateGetter(parentObj, lastName, module, deprecationMsg);
+ }
+ }
+};
+
+exports.getOriginalSymbol = function(context, symbolPath) {
+ var origSymbols = context.CDV_origSymbols;
+ if (origSymbols && (symbolPath in origSymbols)) {
+ return origSymbols[symbolPath];
+ }
+ var parts = symbolPath.split('.');
+ var obj = context;
+ for (var i = 0; i < parts.length; ++i) {
+ obj = obj && obj[parts[i]];
+ }
+ return obj;
+};
+
+exports.loadMatchingModules = function(matchingRegExp) {
+ for (var k in moduleMap) {
+ if (matchingRegExp.exec(k)) {
+ require(k);
+ }
+ }
+};
+
+exports.reset();
+
+
+});
+
// file: lib\windowsphone\platform.js
define("cordova/platform", function(require, exports, module) {
@@ -1067,11 +1116,13 @@
module.exports = {
id: "windowsphone",
initialize:function() {
+ var modulemapper = require('cordova/modulemapper');
+
+ modulemapper.loadMatchingModules(/cordova.*\/symbols$/);
+ modulemapper.mapModules(window);
+
window.alert = window.alert || require("cordova/plugin/notification").alert;
window.confirm = window.confirm || require("cordova/plugin/notification").confirm;
- window.FileReader = require("cordova/plugin/FileReader");
- window.File = require("cordova/plugin/File");
-
// Inject a listener for the backbutton, and tell native to override the flag (true/false) when we have 1 or more, or 0, listeners
var backButtonChannel = cordova.addDocumentEventHandler('backbutton');
@@ -1103,9 +1154,6 @@
},
console:{
path: "cordova/plugin/windowsphone/console"
- },
- FileTransfer: {
- path: 'cordova/plugin/windowsphone/FileTransfer'
}
}
};
@@ -2265,11 +2313,12 @@
define("cordova/plugin/FileReader", function(require, exports, module) {
var exec = require('cordova/exec'),
+ modulemapper = require('cordova/modulemapper'),
utils = require('cordova/utils'),
File = require('cordova/plugin/File'),
FileError = require('cordova/plugin/FileError'),
ProgressEvent = require('cordova/plugin/ProgressEvent'),
- origFileReader = this.FileReader;
+ origFileReader = modulemapper.getOriginalSymbol(this, 'FileReader');
/**
* This class reads the mobile device file system.
@@ -4257,6 +4306,46 @@
});
+// file: lib\windowsphone\plugin\file\symbols.js
+define("cordova/plugin/file/symbols", function(require, exports, module) {
+
+
+var modulemapper = require('cordova/modulemapper'),
+ symbolshelper = require('cordova/plugin/file/symbolshelper');
+
+symbolshelper(modulemapper.defaults);
+modulemapper.clobbers('cordova/plugin/File', 'File');
+modulemapper.clobbers('cordova/plugin/FileReader', 'FileReader');
+modulemapper.clobbers('cordova/plugin/windowsphone/FileTransfer', 'FileTransfer');
+
+});
+
+// file: lib\common\plugin\file\symbolshelper.js
+define("cordova/plugin/file/symbolshelper", function(require, exports, module) {
+
+module.exports = function(exportFunc) {
+ exportFunc('cordova/plugin/DirectoryEntry', 'DirectoryEntry');
+ exportFunc('cordova/plugin/DirectoryReader', 'DirectoryReader');
+ exportFunc('cordova/plugin/Entry', 'Entry');
+ exportFunc('cordova/plugin/File', 'File');
+ exportFunc('cordova/plugin/FileEntry', 'FileEntry');
+ exportFunc('cordova/plugin/FileError', 'FileError');
+ exportFunc('cordova/plugin/FileReader', 'FileReader');
+ exportFunc('cordova/plugin/FileSystem', 'FileSystem');
+ exportFunc('cordova/plugin/FileTransfer', 'FileTransfer');
+ exportFunc('cordova/plugin/FileTransferError', 'FileTransferError');
+ exportFunc('cordova/plugin/FileUploadOptions', 'FileUploadOptions');
+ exportFunc('cordova/plugin/FileUploadResult', 'FileUploadResult');
+ exportFunc('cordova/plugin/FileWriter', 'FileWriter');
+ exportFunc('cordova/plugin/Flags', 'Flags');
+ exportFunc('cordova/plugin/LocalFileSystem', 'LocalFileSystem');
+ exportFunc('cordova/plugin/Metadata', 'Metadata');
+ exportFunc('cordova/plugin/requestFileSystem', 'requestFileSystem');
+ exportFunc('cordova/plugin/resolveLocalFileSystemURI', 'resolveLocalFileSystemURI');
+};
+
+});
+
// file: lib\common\plugin\geolocation.js
define("cordova/plugin/geolocation", function(require, exports, module) {
@@ -5991,7 +6080,10 @@
*/
utils.defineGetterSetter = function(obj, key, getFunc, opt_setFunc) {
if (Object.defineProperty) {
- var desc = {get:getFunc};
+ var desc = {
+ get: getFunc,
+ configurable: true
+ };
if (opt_setFunc) {
desc.set = opt_setFunc;
}
diff --git a/templates/full/VERSION b/templates/full/VERSION
index edf28ac..6f905f8 100644
--- a/templates/full/VERSION
+++ b/templates/full/VERSION
@@ -1 +1 @@
-2.4.0rc1
\ No newline at end of file
+2.4.0rc2
\ No newline at end of file
diff --git a/templates/full/www/cordova-2.4.0.js b/templates/full/www/cordova-2.4.0.js
index b64e13f..d62f792 100644
--- a/templates/full/www/cordova-2.4.0.js
+++ b/templates/full/www/cordova-2.4.0.js
@@ -1,6 +1,8 @@
-// commit 7d5552049e33254eca3bda227af8a4892a7ce7c3
+// Platform: windowsphone
-// File generated at :: Mon Jan 21 2013 17:12:32 GMT-0800 (Pacific Standard Time)
+// commit e784eee3ce02dbd475e3c3f70031668f1706f2ec
+
+// File generated at :: Fri Feb 01 2013 14:32:23 GMT-0800 (Pacific Standard Time)
/*
Licensed to the Apache Software Foundation (ASF) under one
@@ -78,6 +80,7 @@
delete modules[id];
};
+ define.moduleMap = modules;
})();
//Export for use in node
@@ -409,6 +412,8 @@
if (message) {
utils.defineGetter(obj, key, function() {
console.log(message);
+ delete obj[key];
+ clobber(obj, key, value);
return value;
});
} else {
@@ -438,10 +443,6 @@
// Overwrite if not currently defined.
if (typeof parent[key] == 'undefined') {
assignOrWrapInDeprecateGetter(parent, key, result, obj.deprecated);
- } else if (merge && typeof obj.path !== 'undefined') {
- // If merging, merge parent onto result
- recursiveMerge(result, parent[key]);
- parent[key] = result;
} else {
// Set result to what already exists, so we can build children into it if they exist.
result = parent[key];
@@ -467,19 +468,18 @@
function recursiveMerge(target, src) {
for (var prop in src) {
if (src.hasOwnProperty(prop)) {
- if (typeof target.prototype !== 'undefined' && target.prototype.constructor === target) {
+ if (target.prototype && target.prototype.constructor === target) {
// If the target object is a constructor override off prototype.
- target.prototype[prop] = src[prop];
+ clobber(target.prototype, prop, src[prop]);
} else {
- if (typeof src[prop] === 'object') {
- target[prop] = recursiveMerge(target[prop], src[prop]);
+ if (typeof src[prop] === 'object' && typeof target[prop] === 'object') {
+ recursiveMerge(target[prop], src[prop]);
} else {
clobber(target, prop, src[prop]);
}
}
}
}
- return target;
}
module.exports = {
@@ -491,7 +491,9 @@
},
buildIntoAndMerge: function(objects, target) {
include(target, objects, true, true);
- }
+ },
+ recursiveMerge: recursiveMerge,
+ assignOrWrapInDeprecateGetter: assignOrWrapInDeprecateGetter
};
});
@@ -904,54 +906,9 @@
device: {
path: 'cordova/plugin/device'
},
- DirectoryEntry: {
- path: 'cordova/plugin/DirectoryEntry'
- },
- DirectoryReader: {
- path: 'cordova/plugin/DirectoryReader'
- },
- Entry: {
- path: 'cordova/plugin/Entry'
- },
- File: {
- path: 'cordova/plugin/File'
- },
- FileEntry: {
- path: 'cordova/plugin/FileEntry'
- },
- FileError: {
- path: 'cordova/plugin/FileError'
- },
- FileReader: {
- path: 'cordova/plugin/FileReader'
- },
- FileSystem: {
- path: 'cordova/plugin/FileSystem'
- },
- FileTransfer: {
- path: 'cordova/plugin/FileTransfer'
- },
- FileTransferError: {
- path: 'cordova/plugin/FileTransferError'
- },
- FileUploadOptions: {
- path: 'cordova/plugin/FileUploadOptions'
- },
- FileUploadResult: {
- path: 'cordova/plugin/FileUploadResult'
- },
- FileWriter: {
- path: 'cordova/plugin/FileWriter'
- },
- Flags: {
- path: 'cordova/plugin/Flags'
- },
GlobalizationError: {
path: 'cordova/plugin/GlobalizationError'
},
- LocalFileSystem: {
- path: 'cordova/plugin/LocalFileSystem'
- },
Media: {
path: 'cordova/plugin/Media'
},
@@ -964,9 +921,6 @@
MediaFileData:{
path: 'cordova/plugin/MediaFileData'
},
- Metadata:{
- path: 'cordova/plugin/Metadata'
- },
Position: {
path: 'cordova/plugin/Position'
},
@@ -975,12 +929,6 @@
},
ProgressEvent: {
path: 'cordova/plugin/ProgressEvent'
- },
- requestFileSystem:{
- path: 'cordova/plugin/requestFileSystem'
- },
- resolveLocalFileSystemURI:{
- path: 'cordova/plugin/resolveLocalFileSystemURI'
}
},
clobbers: {
@@ -1049,6 +997,107 @@
});
+// file: lib\common\modulemapper.js
+define("cordova/modulemapper", function(require, exports, module) {
+
+var builder = require('cordova/builder'),
+ moduleMap = define.moduleMap,
+ symbolList,
+ deprecationMap;
+
+exports.reset = function() {
+ symbolList = [];
+ deprecationMap = {};
+};
+
+function addEntry(strategy, moduleName, symbolPath, opt_deprecationMessage) {
+ if (!(moduleName in moduleMap)) {
+ throw new Error('Module ' + moduleName + ' does not exist.');
+ }
+ symbolList.push(strategy, moduleName, symbolPath);
+ if (opt_deprecationMessage) {
+ deprecationMap[symbolPath] = opt_deprecationMessage;
+ }
+}
+
+// Note: Android 2.3 does have Function.bind().
+exports.clobbers = function(moduleName, symbolPath, opt_deprecationMessage) {
+ addEntry('c', moduleName, symbolPath, opt_deprecationMessage);
+};
+
+exports.merges = function(moduleName, symbolPath, opt_deprecationMessage) {
+ addEntry('m', moduleName, symbolPath, opt_deprecationMessage);
+};
+
+exports.defaults = function(moduleName, symbolPath, opt_deprecationMessage) {
+ addEntry('d', moduleName, symbolPath, opt_deprecationMessage);
+};
+
+function prepareNamespace(symbolPath, context) {
+ if (!symbolPath) {
+ return context;
+ }
+ var parts = symbolPath.split('.');
+ var cur = context;
+ for (var i = 0, part; part = parts[i]; ++i) {
+ cur[part] = cur[part] || {};
+ }
+ return cur[parts[i-1]];
+}
+
+exports.mapModules = function(context) {
+ var origSymbols = {};
+ context.CDV_origSymbols = origSymbols;
+ for (var i = 0, len = symbolList.length; i < len; i += 3) {
+ var strategy = symbolList[i];
+ var moduleName = symbolList[i + 1];
+ var symbolPath = symbolList[i + 2];
+ var lastDot = symbolPath.lastIndexOf('.');
+ var namespace = symbolPath.substr(0, lastDot);
+ var lastName = symbolPath.substr(lastDot + 1);
+
+ var module = require(moduleName);
+ var deprecationMsg = symbolPath in deprecationMap ? 'Access made to deprecated symbol: ' + symbolPath + '. ' + deprecationMsg : null;
+ var parentObj = prepareNamespace(namespace, context);
+ var target = parentObj[lastName];
+
+ if (strategy == 'm' && target) {
+ builder.recursiveMerge(target, module);
+ } else if ((strategy == 'd' && !target) || (strategy != 'd')) {
+ if (target) {
+ origSymbols[symbolPath] = target;
+ }
+ builder.assignOrWrapInDeprecateGetter(parentObj, lastName, module, deprecationMsg);
+ }
+ }
+};
+
+exports.getOriginalSymbol = function(context, symbolPath) {
+ var origSymbols = context.CDV_origSymbols;
+ if (origSymbols && (symbolPath in origSymbols)) {
+ return origSymbols[symbolPath];
+ }
+ var parts = symbolPath.split('.');
+ var obj = context;
+ for (var i = 0; i < parts.length; ++i) {
+ obj = obj && obj[parts[i]];
+ }
+ return obj;
+};
+
+exports.loadMatchingModules = function(matchingRegExp) {
+ for (var k in moduleMap) {
+ if (matchingRegExp.exec(k)) {
+ require(k);
+ }
+ }
+};
+
+exports.reset();
+
+
+});
+
// file: lib\windowsphone\platform.js
define("cordova/platform", function(require, exports, module) {
@@ -1067,11 +1116,13 @@
module.exports = {
id: "windowsphone",
initialize:function() {
+ var modulemapper = require('cordova/modulemapper');
+
+ modulemapper.loadMatchingModules(/cordova.*\/symbols$/);
+ modulemapper.mapModules(window);
+
window.alert = window.alert || require("cordova/plugin/notification").alert;
window.confirm = window.confirm || require("cordova/plugin/notification").confirm;
- window.FileReader = require("cordova/plugin/FileReader");
- window.File = require("cordova/plugin/File");
-
// Inject a listener for the backbutton, and tell native to override the flag (true/false) when we have 1 or more, or 0, listeners
var backButtonChannel = cordova.addDocumentEventHandler('backbutton');
@@ -1103,9 +1154,6 @@
},
console:{
path: "cordova/plugin/windowsphone/console"
- },
- FileTransfer: {
- path: 'cordova/plugin/windowsphone/FileTransfer'
}
}
};
@@ -2265,11 +2313,12 @@
define("cordova/plugin/FileReader", function(require, exports, module) {
var exec = require('cordova/exec'),
+ modulemapper = require('cordova/modulemapper'),
utils = require('cordova/utils'),
File = require('cordova/plugin/File'),
FileError = require('cordova/plugin/FileError'),
ProgressEvent = require('cordova/plugin/ProgressEvent'),
- origFileReader = this.FileReader;
+ origFileReader = modulemapper.getOriginalSymbol(this, 'FileReader');
/**
* This class reads the mobile device file system.
@@ -4257,6 +4306,46 @@
});
+// file: lib\windowsphone\plugin\file\symbols.js
+define("cordova/plugin/file/symbols", function(require, exports, module) {
+
+
+var modulemapper = require('cordova/modulemapper'),
+ symbolshelper = require('cordova/plugin/file/symbolshelper');
+
+symbolshelper(modulemapper.defaults);
+modulemapper.clobbers('cordova/plugin/File', 'File');
+modulemapper.clobbers('cordova/plugin/FileReader', 'FileReader');
+modulemapper.clobbers('cordova/plugin/windowsphone/FileTransfer', 'FileTransfer');
+
+});
+
+// file: lib\common\plugin\file\symbolshelper.js
+define("cordova/plugin/file/symbolshelper", function(require, exports, module) {
+
+module.exports = function(exportFunc) {
+ exportFunc('cordova/plugin/DirectoryEntry', 'DirectoryEntry');
+ exportFunc('cordova/plugin/DirectoryReader', 'DirectoryReader');
+ exportFunc('cordova/plugin/Entry', 'Entry');
+ exportFunc('cordova/plugin/File', 'File');
+ exportFunc('cordova/plugin/FileEntry', 'FileEntry');
+ exportFunc('cordova/plugin/FileError', 'FileError');
+ exportFunc('cordova/plugin/FileReader', 'FileReader');
+ exportFunc('cordova/plugin/FileSystem', 'FileSystem');
+ exportFunc('cordova/plugin/FileTransfer', 'FileTransfer');
+ exportFunc('cordova/plugin/FileTransferError', 'FileTransferError');
+ exportFunc('cordova/plugin/FileUploadOptions', 'FileUploadOptions');
+ exportFunc('cordova/plugin/FileUploadResult', 'FileUploadResult');
+ exportFunc('cordova/plugin/FileWriter', 'FileWriter');
+ exportFunc('cordova/plugin/Flags', 'Flags');
+ exportFunc('cordova/plugin/LocalFileSystem', 'LocalFileSystem');
+ exportFunc('cordova/plugin/Metadata', 'Metadata');
+ exportFunc('cordova/plugin/requestFileSystem', 'requestFileSystem');
+ exportFunc('cordova/plugin/resolveLocalFileSystemURI', 'resolveLocalFileSystemURI');
+};
+
+});
+
// file: lib\common\plugin\geolocation.js
define("cordova/plugin/geolocation", function(require, exports, module) {
@@ -5991,7 +6080,10 @@
*/
utils.defineGetterSetter = function(obj, key, getFunc, opt_setFunc) {
if (Object.defineProperty) {
- var desc = {get:getFunc};
+ var desc = {
+ get: getFunc,
+ configurable: true
+ };
if (opt_setFunc) {
desc.set = opt_setFunc;
}
diff --git a/templates/standalone/VERSION b/templates/standalone/VERSION
index edf28ac..6f905f8 100644
--- a/templates/standalone/VERSION
+++ b/templates/standalone/VERSION
@@ -1 +1 @@
-2.4.0rc1
\ No newline at end of file
+2.4.0rc2
\ No newline at end of file
diff --git a/templates/standalone/cordovalib/Commands/Device.cs b/templates/standalone/cordovalib/Commands/Device.cs
index 9d03d89..f970401 100644
--- a/templates/standalone/cordovalib/Commands/Device.cs
+++ b/templates/standalone/cordovalib/Commands/Device.cs
@@ -73,7 +73,7 @@
get
{
// TODO: should be able to dynamically read the Cordova version from somewhere...
- return "2.4.0rc1";
+ return "2.4.0rc2";
}
}
diff --git a/templates/standalone/cordovalib/Commands/Globalization.cs b/templates/standalone/cordovalib/Commands/Globalization.cs
new file mode 100644
index 0000000..1528807
--- /dev/null
+++ b/templates/standalone/cordovalib/Commands/Globalization.cs
@@ -0,0 +1,1178 @@
+/*
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+using System;
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace WPCordovaClassLib.Cordova.Commands
+{
+ /// <summary>
+ /// Provides information about system locale, culture settings, number formats, ect.
+ /// </summary>
+ public class Globalization : BaseCommand
+ {
+
+ #region Globalization errors
+
+ /// <summary>
+ /// Globalization error codes.
+ /// </summary>
+ public enum ErrorCode : int
+ {
+ UnknownError = 0,
+ FormattingError = 1,
+ ParsingError = 2,
+ PatternError = 3
+ }
+
+ /// <summary>
+ /// Represents globalization error object.
+ /// </summary>
+ [DataContract]
+ public class GlobalizationError
+ {
+ #region Error messages
+ /// <summary>
+ /// Error messages
+ /// </summary>
+ public const string UnknownError = "UNKNOWN_ERROR";
+ public const string FormattingError = "FORMATTIN_ERROR";
+ public const string ParsingError = "PARSING_ERROR";
+ public const string PatternError = "PATTERN_ERROR";
+
+ #endregion
+
+ /// <summary>
+ /// Error code
+ /// </summary>
+ [DataMember(Name = "code", IsRequired = false)]
+ public ErrorCode Code { get; set; }
+
+ /// <summary>
+ /// Error message
+ /// </summary>
+ [DataMember(Name = "message", IsRequired = false)]
+ public string Message { get; set; }
+
+ /// <summary>
+ /// Default constructor
+ /// </summary>
+ public GlobalizationError()
+ {
+ this.Code = ErrorCode.UnknownError;
+ this.Message = UnknownError;
+ }
+
+ /// <summary>
+ /// Constructor setting error code
+ /// </summary>
+ public GlobalizationError(ErrorCode error)
+ {
+ this.Code = error;
+
+ switch (error)
+ {
+ case ErrorCode.ParsingError:
+ {
+ this.Message = ParsingError;
+ break;
+ }
+ case ErrorCode.FormattingError:
+ {
+ this.Message = FormattingError;
+ break;
+ }
+ case ErrorCode.PatternError:
+ {
+ this.Message = PatternError;
+ break;
+ }
+ default:
+ {
+ this.Message = UnknownError;
+ break;
+ }
+ }
+ }
+ }
+
+ #endregion
+
+ #region Globalization options
+
+ /// <summary>
+ /// Represents globalization options.
+ /// </summary>
+ [DataContract]
+ public class GlobalizationOptions
+ {
+ #region available option values
+ /// <summary>
+ /// Number pattern types.
+ /// </summary>
+ public const string Percent = "percent";
+ public const string Currency = "currency";
+ public const string Decimal = "decimal";
+
+ /// <summary>
+ /// Format length types
+ /// </summary>
+ public const string Short = "short";
+ public const string Medium = "medium";
+ public const string Long = "long";
+ public const string Full = "full";
+
+ /// <summary>
+ /// Selector types
+ /// </summary>
+ public const string TimeSelector = "time";
+ public const string DateSelector = "date";
+ public const string DateAndTimeSelector = "date and time";
+
+ /// <summary>
+ /// Date name types
+ /// </summary>
+ public const string Narrow = "narrow";
+ public const string Wide = "wide";
+
+ /// <summary>
+ /// Date name items
+ /// </summary>
+ public const string Months = "months";
+ public const string Days = "days";
+
+ #endregion
+
+ /// <summary>
+ /// Additional options
+ /// </summary>
+ [DataMember(Name = "options", IsRequired = false)]
+ public Options AdditionalOptions { get; set; }
+
+ /// <summary>
+ /// Date to convert
+ /// </summary>
+ [DataMember(Name = "date", IsRequired = false)]
+ public long Date { get; set; }
+
+ /// <summary>
+ /// Date as stirng
+ /// </summary>
+ [DataMember(Name = "dateString", IsRequired = false)]
+ public string DateString { get; set; }
+
+ /// <summary>
+ /// Currency code
+ /// </summary>
+ [DataMember(Name = "currencyCode", IsRequired = false)]
+ public string CurrencyCode { get; set; }
+
+ /// <summary>
+ /// Number as string
+ /// </summary>
+ [DataMember(Name = "numberString", IsRequired = false)]
+ public string NumberString { get; set; }
+
+ /// <summary>
+ /// Number to convert
+ /// </summary>
+ [DataMember(Name = "number", IsRequired = false)]
+ public double Number { get; set; }
+ }
+
+ /// <summary>
+ /// Represents additional options
+ /// </summary>
+ [DataContract]
+ public class Options
+ {
+ /// <summary>
+ /// Pattern type
+ /// </summary>
+ [DataMember(Name = "type", IsRequired = false)]
+ public string Type { get; set; }
+
+ /// <summary>
+ /// Format length
+ /// </summary>
+ [DataMember(Name = "formatLength", IsRequired = false)]
+ public string FormatLength { get; set; }
+
+ /// <summary>
+ /// Selector
+ /// </summary>
+ [DataMember(Name = "selector", IsRequired = false)]
+ public string Selector { get; set; }
+
+ /// <summary>
+ /// Date name item
+ /// </summary>
+ [DataMember(Name = "item", IsRequired = false)]
+ public string Item { get; set; }
+ }
+
+ #endregion
+
+ #region returned objects
+
+ #region Number pattern object
+
+ /// <summary>
+ /// Represents number pattern
+ /// </summary>
+ [DataContract]
+ public class NumberPattern
+ {
+ /// <summary>
+ /// Pattern
+ /// </summary>
+ [DataMember(Name = "pattern", IsRequired = false)]
+ public string Pattern { get; set; }
+
+ /// <summary>
+ /// Symbol
+ /// </summary>
+ [DataMember(Name = "symbol", IsRequired = false)]
+ public string Symbol { get; set; }
+
+ /// <summary>
+ /// Fraction
+ /// </summary>
+ [DataMember(Name = "fraction", IsRequired = false)]
+ public int Fraction { get; set; }
+
+ /// <summary>
+ /// Positive
+ /// </summary>
+ [DataMember(Name = "positive", IsRequired = false)]
+ public string Positive { get; set; }
+
+ /// <summary>
+ /// Negative
+ /// </summary>
+ [DataMember(Name = "negative", IsRequired = false)]
+ public string Negative { get; set; }
+
+ /// <summary>
+ /// Rounding
+ /// </summary>
+ [DataMember(Name = "rounding", IsRequired = false)]
+ public int Rounding { get; set; }
+
+ /// <summary>
+ /// Decimal
+ /// </summary>
+ [DataMember(Name = "decimal", IsRequired = false)]
+ public string Decimal { get; set; }
+
+ /// <summary>
+ /// Grouping
+ /// </summary>
+ [DataMember(Name = "grouping", IsRequired = false)]
+ public string Grouping { get; set; }
+
+ /// <summary>
+ /// Constructor of the class
+ /// </summary>
+ /// <param name="pattern"></param>
+ /// <param name="symbol"></param>
+ /// <param name="fraction"></param>
+ /// <param name="positive"></param>
+ /// <param name="negative"></param>
+ /// <param name="rounding"></param>
+ /// <param name="dec"></param>
+ /// <param name="grouping"></param>
+ public NumberPattern(string pattern, string symbol, int fraction, string positive, string negative, int rounding, string dec, string grouping)
+ {
+ this.Pattern = pattern;
+ this.Symbol = symbol;
+ this.Fraction = fraction;
+ this.Positive = positive;
+ this.Negative = negative;
+ this.Rounding = rounding;
+ this.Decimal = dec;
+ this.Grouping = grouping;
+ }
+ }
+ #endregion
+
+ #region Date format object
+
+ /// <summary>
+ /// Represents date format
+ /// </summary>
+ [DataContract]
+ public class DateFormat
+ {
+ /// <summary>
+ /// Year
+ /// </summary>
+ [DataMember(Name = "year", IsRequired = false)]
+ public int Year { get; set; }
+
+ /// <summary>
+ /// Month
+ /// </summary>
+ [DataMember(Name = "month", IsRequired = false)]
+ public int Month { get; set; }
+
+ /// <summary>
+ /// Day
+ /// </summary>
+ [DataMember(Name = "day", IsRequired = false)]
+ public int Day { get; set; }
+
+ /// <summary>
+ /// Hour
+ /// </summary>
+ [DataMember(Name = "hour", IsRequired = false)]
+ public int Hour { get; set; }
+
+ /// <summary>
+ /// Minute
+ /// </summary>
+ [DataMember(Name = "minute", IsRequired = false)]
+ public int Minute { get; set; }
+
+ /// <summary>
+ /// Second
+ /// </summary>
+ [DataMember(Name = "second", IsRequired = false)]
+ public int Second { get; set; }
+
+ /// <summary>
+ /// Millisecond
+ /// </summary>
+ [DataMember(Name = "millisecond", IsRequired = false)]
+ public int Millisecond { get; set; }
+
+ public DateFormat(int year, int month, int day, int hour, int minute, int second, int millisecond)
+ {
+ this.Year = year;
+ this.Month = month;
+ this.Day = day;
+ this.Hour = hour;
+ this.Minute = minute;
+ this.Millisecond = millisecond;
+ }
+
+ }
+ #endregion
+
+ #region Date pattern object
+
+ /// <summary>
+ /// Represents date pattern object
+ /// </summary>
+ [DataContract]
+ public class DatePattern
+ {
+
+ /// <summary>
+ /// Date pattern
+ /// </summary>
+ [DataMember(Name = "pattern", IsRequired = false)]
+ public string Pattern { get; set; }
+
+ /// <summary>
+ /// TimeZone
+ /// </summary>
+ [DataMember(Name = "timezone", IsRequired = false)]
+ public string TimeZone { get; set; }
+
+ /// <summary>
+ /// UTC offset
+ /// </summary>
+ [DataMember(Name = "utc_offset", IsRequired = false)]
+ public double UtcOffset { get; set; }
+
+ /// <summary>
+ /// Dst offset
+ /// </summary>
+ [DataMember(Name = "dst_offset", IsRequired = false)]
+ public double DstOffset { get; set; }
+
+ /// <summary>
+ /// Constructor of the class
+ /// </summary>
+ /// <param name="pattern"></param>
+ /// <param name="timezone"></param>
+ /// <param name="utcOffset"></param>
+ /// <param name="dstOffset"></param>
+ public DatePattern(string pattern, string timezone, double utcOffset, double dstOffset)
+ {
+ this.Pattern = pattern;
+ this.TimeZone = timezone;
+ this.UtcOffset = utcOffset;
+ this.DstOffset = dstOffset;
+ }
+
+ }
+
+ #endregion
+
+ #endregion
+
+ #region Locale info
+
+ /// <summary>
+ /// Gets the string identifier for the client's current locale setting.
+ /// </summary>
+ /// <param name="options"></param>
+ public void getLocaleName(string options)
+ {
+ try
+ {
+ var locale = RegionInfo.CurrentRegion.TwoLetterISORegionName;
+ PluginResult result = new PluginResult(PluginResult.Status.OK, this.WrapIntoJSON(locale));
+ this.DispatchCommandResult(result);
+ }
+ catch (Exception e)
+ {
+ this.DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, new GlobalizationError()));
+ }
+ }
+
+ /// <summary>
+ /// Gets the string identifier for the client's current language.
+ /// </summary>
+ /// <param name="options"></param>
+ public void getPreferredLanguage(string options)
+ {
+ try
+ {
+ var language = CultureInfo.CurrentCulture.TwoLetterISOLanguageName;
+ PluginResult result = new PluginResult(PluginResult.Status.OK, this.WrapIntoJSON(language));
+ this.DispatchCommandResult(result);
+ }
+ catch (Exception e)
+ {
+ this.DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, new GlobalizationError()));
+ }
+ }
+
+ #endregion
+
+ #region Date and time info
+
+ /// <summary>
+ /// Gets whether daylight savings time is in effect for a given date using the client's
+ /// time zone and calendar.
+ /// </summary>
+ /// <param name="opitons">Date to daylight savings check.</param>
+ public void isDayLightSavingsTime(string options)
+ {
+ GlobalizationOptions globalOptions;
+
+ try
+ {
+ string[] args = JSON.JsonHelper.Deserialize<string[]>(options);
+ globalOptions = JSON.JsonHelper.Deserialize<GlobalizationOptions>(args[0]);
+ }
+ catch (Exception e)
+ {
+ DispatchCommandResult(new PluginResult(PluginResult.Status.JSON_EXCEPTION));
+ return;
+ }
+
+ try
+ {
+ DateTime start = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
+ DateTime date = start.AddMilliseconds(globalOptions.Date).ToLocalTime();
+ TimeZoneInfo localZone = TimeZoneInfo.Local;
+ bool isDaylightSavingTime = localZone.IsDaylightSavingTime(date);
+ this.DispatchCommandResult(new PluginResult(PluginResult.Status.OK, this.WrapIntoJSON(isDaylightSavingTime, "dst")));
+ }
+ catch (Exception e)
+ {
+ this.DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, new GlobalizationError()));
+ }
+ }
+
+ /// <summary>
+ /// Gets the first day of the week according to the client's user preferences and calendar.
+ /// The days of the week are numbered starting from 1 where 1 is considered to be Sunday.
+ /// </summary>
+ /// <param name="options"></param>
+ public void getFirstDayOfWeek(string options)
+ {
+ try
+ {
+ // DateTimeFormat returns days of the week numbered from zero, so we have to increase returned value by one.
+ var firstDayOfWeek = (int)CultureInfo.CurrentCulture.DateTimeFormat.FirstDayOfWeek + 1;
+ PluginResult result = new PluginResult(PluginResult.Status.OK, this.WrapIntoJSON(firstDayOfWeek));
+ this.DispatchCommandResult(result);
+ }
+ catch (Exception e)
+ {
+ this.DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, new GlobalizationError()));
+ }
+ }
+
+ #endregion
+
+ #region Formatting
+
+ /// <summary>
+ /// Gets a date formatted as a string according to the client's user preferences and calendar using the time zone of the client.
+ /// </summary>
+ /// <param name="options"></param>
+ public void dateToString(string options)
+ {
+ GlobalizationOptions globalOptions;
+
+ try
+ {
+ string[] args = JSON.JsonHelper.Deserialize<string[]>(options);
+ globalOptions = JSON.JsonHelper.Deserialize<GlobalizationOptions>(args[0]);
+ }
+ catch (Exception e)
+ {
+ DispatchCommandResult(new PluginResult(PluginResult.Status.JSON_EXCEPTION));
+ return;
+ }
+
+ try
+ {
+ DateTime start = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
+ DateTime date = start.AddMilliseconds(globalOptions.Date).ToLocalTime();
+
+ string format = "{0:M/dd/yy H:m:s}"; //short datetime by default
+ int formatLength = 0; //default format
+ int selector = 0; //default selector
+
+ if (globalOptions.AdditionalOptions != null)
+ {
+ if (globalOptions.AdditionalOptions.FormatLength != null)
+ {
+ string t = globalOptions.AdditionalOptions.FormatLength;
+
+ if (t.Equals(GlobalizationOptions.Full))
+ {
+ formatLength++;
+ }
+ }
+
+ if (globalOptions.AdditionalOptions.Selector != null)
+ {
+ string t = globalOptions.AdditionalOptions.Selector;
+
+ if (t.Equals(GlobalizationOptions.DateSelector))
+ {
+ selector += 10;
+ }
+ else if (t.Equals(GlobalizationOptions.TimeSelector))
+ {
+ selector += 20;
+ }
+ }
+
+ //determine return value
+ int method = formatLength + selector;
+
+ switch (method)
+ {
+ case 1: // full datetime
+ {
+ format = "{0:MMMM/dddd/yyyy HH:mm:ss tt}";
+ break;
+ }
+ case 10: // short date
+ {
+ format = "{0:d}";
+ break;
+ }
+ case 11: // full date
+ {
+ format = "{0:D}";
+ break;
+ }
+ case 20: // short time
+ {
+ format = "{0:t}";
+ break;
+ }
+ case 21: // full time
+ {
+ format = "{0:T}";
+ break;
+ }
+ default: // short datetime
+ {
+ format = "{0:M/dd/yy H:m:s}";
+ break;
+ }
+ }
+ }
+
+ string formattedValue = string.Format(CultureInfo.CurrentCulture, format, date);
+ this.DispatchCommandResult(new PluginResult(PluginResult.Status.OK, this.WrapIntoJSON(formattedValue)));
+ }
+ catch (Exception e)
+ {
+ this.DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, new GlobalizationError(ErrorCode.FormattingError)));
+ }
+ }
+
+ /// <summary>
+ /// Parses a date formatted as a string according to the client's user preferences and calendar using the time zone of the client and returns the corresponding date object
+ /// </summary>
+ /// <param name="options"></param>
+ public void stringToDate(string options)
+ {
+ GlobalizationOptions globalOptions;
+
+ try
+ {
+ string[] args = JSON.JsonHelper.Deserialize<string[]>(options);
+ globalOptions = JSON.JsonHelper.Deserialize<GlobalizationOptions>(args[0]);
+ }
+ catch (Exception e)
+ {
+ DispatchCommandResult(new PluginResult(PluginResult.Status.JSON_EXCEPTION));
+ return;
+ }
+
+ try
+ {
+ if (string.IsNullOrEmpty(globalOptions.DateString))
+ {
+ DispatchCommandResult(new PluginResult(PluginResult.Status.JSON_EXCEPTION));
+ return;
+ }
+
+ string format = "M/dd/yy H:m:s"; // short datetime by default
+ int formatLength = 0; //default format
+ int selector = 0; //default selector
+
+ if (globalOptions.AdditionalOptions != null)
+ {
+ if (globalOptions.AdditionalOptions.FormatLength != null)
+ {
+ string t = globalOptions.AdditionalOptions.FormatLength;
+
+ if (t.Equals(GlobalizationOptions.Full))
+ {
+ formatLength++;
+ }
+ }
+
+ if (globalOptions.AdditionalOptions.Selector != null)
+ {
+ string t = globalOptions.AdditionalOptions.Selector;
+
+ if (t.Equals(GlobalizationOptions.DateSelector))
+ {
+ selector += 10;
+ }
+ else if (t.Equals(GlobalizationOptions.TimeSelector))
+ {
+ selector += 20;
+ }
+ }
+
+ //determine return value
+ int method = formatLength + selector;
+
+ switch (method)
+ {
+ case 1: // full datetime
+ {
+ format = "MMMM/dddd/yyyy HH:mm:ss tt";
+ break;
+ }
+ case 10: // short date
+ {
+ format = "d";
+ break;
+ }
+ case 11: // full date
+ {
+ format = "D";
+ break;
+ }
+ case 20: // short time
+ {
+ format = "t";
+ break;
+ }
+ case 21: // full time
+ {
+ format = "T";
+ break;
+ }
+ default: // short datetime
+ {
+ format = "M/dd/yy H:m:s";
+ break;
+ }
+ }
+ }
+
+ DateTime date = DateTime.ParseExact(globalOptions.DateString, format, CultureInfo.CurrentCulture);
+ DateFormat dateFormat = new DateFormat(date.Year, date.Month, date.Day, date.Hour, date.Minute, date.Second, date.Millisecond);
+ this.DispatchCommandResult(new PluginResult(PluginResult.Status.OK, dateFormat));
+
+ }
+ catch (Exception e)
+ {
+ this.DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, new GlobalizationError(ErrorCode.ParsingError)));
+ }
+ }
+
+ /// <summary>
+ /// Gets a pattern string for formatting and parsing dates according to the client's user preferences.
+ /// </summary>
+ /// <param name="options"></param>
+ public void getDatePattern(string options)
+ {
+ GlobalizationOptions globalOptions;
+
+ try
+ {
+ string[] args = JSON.JsonHelper.Deserialize<string[]>(options);
+ globalOptions = JSON.JsonHelper.Deserialize<GlobalizationOptions>(args[0]);
+ }
+ catch (Exception e)
+ {
+ DispatchCommandResult(new PluginResult(PluginResult.Status.JSON_EXCEPTION));
+ return;
+ }
+
+ try
+ {
+ DateTimeFormatInfo dateFormatInfo = DateTimeFormatInfo.CurrentInfo;
+ string pattern = dateFormatInfo.FullDateTimePattern; // full datetime by default
+ int formatLength = 0; //default format
+ int selector = 0; //default selector
+
+ if (globalOptions.AdditionalOptions != null)
+ {
+ if (globalOptions.AdditionalOptions.FormatLength != null)
+ {
+ string t = globalOptions.AdditionalOptions.FormatLength;
+
+ if (t.Equals(GlobalizationOptions.Full))
+ {
+ formatLength++;
+ }
+ }
+
+ if (globalOptions.AdditionalOptions.Selector != null)
+ {
+ string t = globalOptions.AdditionalOptions.Selector;
+
+ if (t.Equals(GlobalizationOptions.DateSelector))
+ {
+ selector += 10;
+ }
+ else if (t.Equals(GlobalizationOptions.TimeSelector))
+ {
+ selector += 20;
+ }
+ }
+
+ //determine return value
+ int method = formatLength + selector;
+
+ switch (method)
+ {
+ case 1: // full datetime
+ {
+ pattern = dateFormatInfo.FullDateTimePattern;
+ break;
+ }
+ case 10: // short date
+ {
+ pattern = dateFormatInfo.ShortDatePattern;
+ break;
+ }
+ case 11: // full date
+ {
+ pattern = dateFormatInfo.LongDatePattern;
+ break;
+ }
+ case 20: // short time
+ {
+ pattern = dateFormatInfo.ShortTimePattern;
+ break;
+ }
+ case 21: // full time
+ {
+ pattern = dateFormatInfo.LongTimePattern;
+ break;
+ }
+ default: // short datetime
+ {
+ // Seems like C# doesn't support short datetime pattern so we use full format
+ // http://msdn.microsoft.com/en-us/library/1at0z4ew%28v=vs.71%29.aspx
+ pattern = dateFormatInfo.FullDateTimePattern;
+ break;
+ }
+ }
+ }
+
+ TimeZoneInfo localZone = TimeZoneInfo.Local;
+ DatePattern datePattern = new DatePattern(pattern, localZone.DisplayName, localZone.BaseUtcOffset.TotalSeconds, 0);
+ this.DispatchCommandResult(new PluginResult(PluginResult.Status.OK, datePattern));
+ }
+ catch (Exception e)
+ {
+ this.DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, new GlobalizationError(ErrorCode.PatternError)));
+ }
+ }
+
+ /// <summary>
+ /// Gets an array of either the names of the months or days of the week according to the client's user preferences and calendar.
+ /// </summary>
+ /// <param name="options"></param>
+ public void getDateNames(string options)
+ {
+ GlobalizationOptions globalOptions;
+
+ try
+ {
+ string[] args = JSON.JsonHelper.Deserialize<string[]>(options);
+ globalOptions = JSON.JsonHelper.Deserialize<GlobalizationOptions>(args[0]);
+ }
+ catch (Exception e)
+ {
+ DispatchCommandResult(new PluginResult(PluginResult.Status.JSON_EXCEPTION));
+ return;
+ }
+
+ try
+ {
+ int type = 0; //default wide
+ int item = 0; //default months
+
+ if (globalOptions.AdditionalOptions != null)
+ {
+ if (globalOptions.AdditionalOptions.Type != null)
+ {
+ string t = globalOptions.AdditionalOptions.Type;
+
+ if (t.Equals(GlobalizationOptions.Narrow))
+ {
+ type++;
+ }
+ }
+
+ if (globalOptions.AdditionalOptions.Item != null)
+ {
+ string t = globalOptions.AdditionalOptions.Item;
+
+ if (t.Equals(GlobalizationOptions.Days))
+ {
+ item += 10;
+ }
+ }
+ }
+
+ //determine return value
+ int method = item + type;
+ string[] namesArray;
+ CultureInfo currentCulture = CultureInfo.CurrentCulture;
+
+ if (method == 1) //months and narrow
+ {
+ namesArray = currentCulture.DateTimeFormat.AbbreviatedMonthNames;
+ }
+ else if (method == 10) //days and wide
+ {
+ namesArray = currentCulture.DateTimeFormat.DayNames;
+ }
+ else if (method == 11) //days and narrow
+ {
+ namesArray = currentCulture.DateTimeFormat.AbbreviatedDayNames;
+ }
+ else //default: months and wide
+ {
+ namesArray = currentCulture.DateTimeFormat.MonthNames;
+ }
+
+ this.DispatchCommandResult(new PluginResult(PluginResult.Status.OK, this.WrapIntoJSON(namesArray)));
+ }
+ catch (Exception e)
+ {
+ this.DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, new GlobalizationError()));
+ }
+ }
+
+ /// <summary>
+ /// Gets a number formatted as a string according to the client's user preferences.
+ /// </summary>
+ /// <param name="options"></param>
+ public void numberToString(string options)
+ {
+ GlobalizationOptions globalOptions;
+
+ try
+ {
+ string[] args = JSON.JsonHelper.Deserialize<string[]>(options);
+ globalOptions = JSON.JsonHelper.Deserialize<GlobalizationOptions>(args[0]);
+ }
+ catch (Exception e)
+ {
+ DispatchCommandResult(new PluginResult(PluginResult.Status.JSON_EXCEPTION));
+ return;
+ }
+
+ try
+ {
+ string format = string.Empty;
+ string numberFormatType = (globalOptions.AdditionalOptions == null || string.IsNullOrEmpty(globalOptions.AdditionalOptions.Type)) ?
+ GlobalizationOptions.Decimal : globalOptions.AdditionalOptions.Type;
+
+ switch (numberFormatType)
+ {
+ case GlobalizationOptions.Percent:
+ {
+ format = "{0:p}";
+ break;
+ }
+
+ case GlobalizationOptions.Currency:
+ {
+ format = "{0:c}";
+ break;
+ }
+
+ default:
+ {
+ format = "{0:f}";
+ break;
+ }
+ }
+
+ string formattedValue = string.Format(CultureInfo.CurrentCulture, format, globalOptions.Number);
+ this.DispatchCommandResult(new PluginResult(PluginResult.Status.OK, this.WrapIntoJSON(formattedValue)));
+
+ }
+ catch (Exception e)
+ {
+ this.DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, new GlobalizationError(ErrorCode.FormattingError)));
+ }
+ }
+
+ /// <summary>
+ /// Gets a number formatted as a string according to the client's user preferences and returns the corresponding number.
+ /// </summary>
+ /// <param name="options"></param>
+ public void stringToNumber(string options)
+ {
+ GlobalizationOptions globalOptions;
+
+ try
+ {
+ string[] args = JSON.JsonHelper.Deserialize<string[]>(options);
+ globalOptions = JSON.JsonHelper.Deserialize<GlobalizationOptions>(args[0]);
+ }
+ catch (Exception e)
+ {
+ DispatchCommandResult(new PluginResult(PluginResult.Status.JSON_EXCEPTION));
+ return;
+ }
+
+ try
+ {
+ if (string.IsNullOrEmpty(globalOptions.NumberString))
+ {
+ DispatchCommandResult(new PluginResult(PluginResult.Status.JSON_EXCEPTION));
+ return;
+ }
+
+ string numberString = globalOptions.NumberString;
+ string numberFormatType = (globalOptions.AdditionalOptions == null || string.IsNullOrEmpty(globalOptions.AdditionalOptions.Type)) ?
+ GlobalizationOptions.Decimal : globalOptions.AdditionalOptions.Type;
+
+ NumberStyles numberStyle;
+
+ switch (numberFormatType)
+ {
+ case GlobalizationOptions.Percent:
+ {
+ numberStyle = NumberStyles.Any;
+ numberString = numberString.Replace(System.Globalization.CultureInfo.CurrentCulture.NumberFormat.PercentSymbol, "");
+ break;
+ }
+
+ case GlobalizationOptions.Currency:
+ {
+ numberStyle = NumberStyles.Currency;
+ break;
+ }
+
+ default:
+ {
+ numberStyle = NumberStyles.Number;
+ break;
+ }
+ }
+
+ double value = double.Parse(numberString, numberStyle, CultureInfo.CurrentCulture);
+ this.DispatchCommandResult(new PluginResult(PluginResult.Status.OK, this.WrapIntoJSON(value)));
+
+ }
+ catch (Exception e)
+ {
+ this.DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, new GlobalizationError(ErrorCode.ParsingError)));
+ }
+ }
+
+
+ /// <summary>
+ /// Gets a pattern string for formatting and parsing numbers according to the client's user preferences.
+ /// </summary>
+ /// <param name="options"></param>
+ public void getNumberPattern(string options)
+ {
+ GlobalizationOptions globalOptions;
+
+ try
+ {
+ string[] args = JSON.JsonHelper.Deserialize<string[]>(options);
+ globalOptions = JSON.JsonHelper.Deserialize<GlobalizationOptions>(args[0]);
+ }
+ catch (Exception e)
+ {
+ DispatchCommandResult(new PluginResult(PluginResult.Status.JSON_EXCEPTION));
+ return;
+ }
+
+ try
+ {
+ CultureInfo cultureInfo = CultureInfo.CurrentCulture;
+ NumberFormatInfo formatInfo = cultureInfo.NumberFormat;
+ string numberFormatType = (globalOptions.AdditionalOptions == null || string.IsNullOrEmpty(globalOptions.AdditionalOptions.Type)) ?
+ GlobalizationOptions.Decimal : globalOptions.AdditionalOptions.Type;
+ NumberPattern pattern = null;
+ string symbol;
+
+ // TODO find out how to get format pattern and the number of fraction digits
+ switch (numberFormatType)
+ {
+ case GlobalizationOptions.Percent:
+ {
+ symbol = formatInfo.PercentSymbol;
+ pattern = new NumberPattern("", symbol, 0, formatInfo.PercentPositivePattern.ToString(), formatInfo.PercentNegativePattern.ToString(), 0, formatInfo.PercentDecimalSeparator, formatInfo.PercentGroupSeparator);
+ break;
+ }
+ case GlobalizationOptions.Currency:
+ {
+ symbol = formatInfo.CurrencySymbol;
+ pattern = new NumberPattern("", symbol, 0, formatInfo.CurrencyPositivePattern.ToString(), formatInfo.CurrencyNegativePattern.ToString(), 0, formatInfo.CurrencyDecimalSeparator, formatInfo.CurrencyGroupSeparator);
+ break;
+ }
+ default:
+ {
+ symbol = formatInfo.NumberDecimalSeparator;
+ pattern = new NumberPattern("", symbol, 0, "", formatInfo.NumberNegativePattern.ToString(), 0, formatInfo.NumberDecimalSeparator, formatInfo.NumberGroupSeparator);
+ break;
+ }
+ }
+
+ this.DispatchCommandResult(new PluginResult(PluginResult.Status.OK, pattern));
+ }
+ catch (Exception e)
+ {
+ this.DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, new GlobalizationError(ErrorCode.PatternError)));
+ }
+ }
+
+ /// <summary>
+ /// Gets a pattern string for formatting and parsing currency values according to the client's user preferences and ISO 4217 currency code.
+ /// </summary>
+ /// <param name="options"></param>
+ public void getCurrencyPattern(string options)
+ {
+ GlobalizationOptions globalOptions;
+
+ try
+ {
+ string[] args = JSON.JsonHelper.Deserialize<string[]>(options);
+ globalOptions = JSON.JsonHelper.Deserialize<GlobalizationOptions>(args[0]);
+ }
+ catch (Exception e)
+ {
+ DispatchCommandResult(new PluginResult(PluginResult.Status.JSON_EXCEPTION));
+ return;
+ }
+
+ try
+ {
+ if (string.IsNullOrEmpty(globalOptions.CurrencyCode))
+ {
+ DispatchCommandResult(new PluginResult(PluginResult.Status.JSON_EXCEPTION));
+ return;
+ }
+
+ string currencyCode = globalOptions.CurrencyCode;
+
+ // temporary not supported via lack of api required
+ this.DispatchCommandResult(new PluginResult(PluginResult.Status.INVALID_ACTION, "Not supported"));
+ return;
+
+ // TODO find the way to get currency info from currency code
+ // http://stackoverflow.com/questions/12373800/3-digit-currency-code-to-currency-symbol
+ // http://stackoverflow.com/questions/6924067/how-to-get-specific-culture-currency-pattern
+ // CultureInfo cultureInfo = new CultureInfo(currencyCode);
+ // NumberFormatInfo numberFormat = cultureInfo.NumberFormat;
+ }
+ catch (Exception e)
+ {
+ this.DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, new GlobalizationError(ErrorCode.FormattingError)));
+ }
+ }
+
+ #endregion
+
+
+ #region private methods
+
+ /// <summary>
+ /// Wraps data into JSON format
+ /// </summary>
+ /// <param name="data">data</param>
+ /// <returns>data formatted as JSON object</returns>
+ private string WrapIntoJSON<T>(T data, string keyName = "value")
+ {
+ string param = "{0}";
+ string stringifiedData = data.ToString();
+
+ if (data.GetType() == typeof(string))
+ {
+ param = "\"" + param + "\"";
+ }
+
+ if (data.GetType() == typeof(bool))
+ {
+ stringifiedData = stringifiedData.ToLower();
+ }
+
+ if (data.GetType() == typeof(string[]))
+ {
+ stringifiedData = JSON.JsonHelper.Serialize(data);
+ }
+
+ var formattedData = string.Format("\"" + keyName + "\":" + param, stringifiedData);
+ formattedData = "{" + formattedData + "}";
+
+ return formattedData;
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/templates/standalone/www/cordova-2.4.0.js b/templates/standalone/www/cordova-2.4.0.js
index b64e13f..d62f792 100644
--- a/templates/standalone/www/cordova-2.4.0.js
+++ b/templates/standalone/www/cordova-2.4.0.js
@@ -1,6 +1,8 @@
-// commit 7d5552049e33254eca3bda227af8a4892a7ce7c3
+// Platform: windowsphone
-// File generated at :: Mon Jan 21 2013 17:12:32 GMT-0800 (Pacific Standard Time)
+// commit e784eee3ce02dbd475e3c3f70031668f1706f2ec
+
+// File generated at :: Fri Feb 01 2013 14:32:23 GMT-0800 (Pacific Standard Time)
/*
Licensed to the Apache Software Foundation (ASF) under one
@@ -78,6 +80,7 @@
delete modules[id];
};
+ define.moduleMap = modules;
})();
//Export for use in node
@@ -409,6 +412,8 @@
if (message) {
utils.defineGetter(obj, key, function() {
console.log(message);
+ delete obj[key];
+ clobber(obj, key, value);
return value;
});
} else {
@@ -438,10 +443,6 @@
// Overwrite if not currently defined.
if (typeof parent[key] == 'undefined') {
assignOrWrapInDeprecateGetter(parent, key, result, obj.deprecated);
- } else if (merge && typeof obj.path !== 'undefined') {
- // If merging, merge parent onto result
- recursiveMerge(result, parent[key]);
- parent[key] = result;
} else {
// Set result to what already exists, so we can build children into it if they exist.
result = parent[key];
@@ -467,19 +468,18 @@
function recursiveMerge(target, src) {
for (var prop in src) {
if (src.hasOwnProperty(prop)) {
- if (typeof target.prototype !== 'undefined' && target.prototype.constructor === target) {
+ if (target.prototype && target.prototype.constructor === target) {
// If the target object is a constructor override off prototype.
- target.prototype[prop] = src[prop];
+ clobber(target.prototype, prop, src[prop]);
} else {
- if (typeof src[prop] === 'object') {
- target[prop] = recursiveMerge(target[prop], src[prop]);
+ if (typeof src[prop] === 'object' && typeof target[prop] === 'object') {
+ recursiveMerge(target[prop], src[prop]);
} else {
clobber(target, prop, src[prop]);
}
}
}
}
- return target;
}
module.exports = {
@@ -491,7 +491,9 @@
},
buildIntoAndMerge: function(objects, target) {
include(target, objects, true, true);
- }
+ },
+ recursiveMerge: recursiveMerge,
+ assignOrWrapInDeprecateGetter: assignOrWrapInDeprecateGetter
};
});
@@ -904,54 +906,9 @@
device: {
path: 'cordova/plugin/device'
},
- DirectoryEntry: {
- path: 'cordova/plugin/DirectoryEntry'
- },
- DirectoryReader: {
- path: 'cordova/plugin/DirectoryReader'
- },
- Entry: {
- path: 'cordova/plugin/Entry'
- },
- File: {
- path: 'cordova/plugin/File'
- },
- FileEntry: {
- path: 'cordova/plugin/FileEntry'
- },
- FileError: {
- path: 'cordova/plugin/FileError'
- },
- FileReader: {
- path: 'cordova/plugin/FileReader'
- },
- FileSystem: {
- path: 'cordova/plugin/FileSystem'
- },
- FileTransfer: {
- path: 'cordova/plugin/FileTransfer'
- },
- FileTransferError: {
- path: 'cordova/plugin/FileTransferError'
- },
- FileUploadOptions: {
- path: 'cordova/plugin/FileUploadOptions'
- },
- FileUploadResult: {
- path: 'cordova/plugin/FileUploadResult'
- },
- FileWriter: {
- path: 'cordova/plugin/FileWriter'
- },
- Flags: {
- path: 'cordova/plugin/Flags'
- },
GlobalizationError: {
path: 'cordova/plugin/GlobalizationError'
},
- LocalFileSystem: {
- path: 'cordova/plugin/LocalFileSystem'
- },
Media: {
path: 'cordova/plugin/Media'
},
@@ -964,9 +921,6 @@
MediaFileData:{
path: 'cordova/plugin/MediaFileData'
},
- Metadata:{
- path: 'cordova/plugin/Metadata'
- },
Position: {
path: 'cordova/plugin/Position'
},
@@ -975,12 +929,6 @@
},
ProgressEvent: {
path: 'cordova/plugin/ProgressEvent'
- },
- requestFileSystem:{
- path: 'cordova/plugin/requestFileSystem'
- },
- resolveLocalFileSystemURI:{
- path: 'cordova/plugin/resolveLocalFileSystemURI'
}
},
clobbers: {
@@ -1049,6 +997,107 @@
});
+// file: lib\common\modulemapper.js
+define("cordova/modulemapper", function(require, exports, module) {
+
+var builder = require('cordova/builder'),
+ moduleMap = define.moduleMap,
+ symbolList,
+ deprecationMap;
+
+exports.reset = function() {
+ symbolList = [];
+ deprecationMap = {};
+};
+
+function addEntry(strategy, moduleName, symbolPath, opt_deprecationMessage) {
+ if (!(moduleName in moduleMap)) {
+ throw new Error('Module ' + moduleName + ' does not exist.');
+ }
+ symbolList.push(strategy, moduleName, symbolPath);
+ if (opt_deprecationMessage) {
+ deprecationMap[symbolPath] = opt_deprecationMessage;
+ }
+}
+
+// Note: Android 2.3 does have Function.bind().
+exports.clobbers = function(moduleName, symbolPath, opt_deprecationMessage) {
+ addEntry('c', moduleName, symbolPath, opt_deprecationMessage);
+};
+
+exports.merges = function(moduleName, symbolPath, opt_deprecationMessage) {
+ addEntry('m', moduleName, symbolPath, opt_deprecationMessage);
+};
+
+exports.defaults = function(moduleName, symbolPath, opt_deprecationMessage) {
+ addEntry('d', moduleName, symbolPath, opt_deprecationMessage);
+};
+
+function prepareNamespace(symbolPath, context) {
+ if (!symbolPath) {
+ return context;
+ }
+ var parts = symbolPath.split('.');
+ var cur = context;
+ for (var i = 0, part; part = parts[i]; ++i) {
+ cur[part] = cur[part] || {};
+ }
+ return cur[parts[i-1]];
+}
+
+exports.mapModules = function(context) {
+ var origSymbols = {};
+ context.CDV_origSymbols = origSymbols;
+ for (var i = 0, len = symbolList.length; i < len; i += 3) {
+ var strategy = symbolList[i];
+ var moduleName = symbolList[i + 1];
+ var symbolPath = symbolList[i + 2];
+ var lastDot = symbolPath.lastIndexOf('.');
+ var namespace = symbolPath.substr(0, lastDot);
+ var lastName = symbolPath.substr(lastDot + 1);
+
+ var module = require(moduleName);
+ var deprecationMsg = symbolPath in deprecationMap ? 'Access made to deprecated symbol: ' + symbolPath + '. ' + deprecationMsg : null;
+ var parentObj = prepareNamespace(namespace, context);
+ var target = parentObj[lastName];
+
+ if (strategy == 'm' && target) {
+ builder.recursiveMerge(target, module);
+ } else if ((strategy == 'd' && !target) || (strategy != 'd')) {
+ if (target) {
+ origSymbols[symbolPath] = target;
+ }
+ builder.assignOrWrapInDeprecateGetter(parentObj, lastName, module, deprecationMsg);
+ }
+ }
+};
+
+exports.getOriginalSymbol = function(context, symbolPath) {
+ var origSymbols = context.CDV_origSymbols;
+ if (origSymbols && (symbolPath in origSymbols)) {
+ return origSymbols[symbolPath];
+ }
+ var parts = symbolPath.split('.');
+ var obj = context;
+ for (var i = 0; i < parts.length; ++i) {
+ obj = obj && obj[parts[i]];
+ }
+ return obj;
+};
+
+exports.loadMatchingModules = function(matchingRegExp) {
+ for (var k in moduleMap) {
+ if (matchingRegExp.exec(k)) {
+ require(k);
+ }
+ }
+};
+
+exports.reset();
+
+
+});
+
// file: lib\windowsphone\platform.js
define("cordova/platform", function(require, exports, module) {
@@ -1067,11 +1116,13 @@
module.exports = {
id: "windowsphone",
initialize:function() {
+ var modulemapper = require('cordova/modulemapper');
+
+ modulemapper.loadMatchingModules(/cordova.*\/symbols$/);
+ modulemapper.mapModules(window);
+
window.alert = window.alert || require("cordova/plugin/notification").alert;
window.confirm = window.confirm || require("cordova/plugin/notification").confirm;
- window.FileReader = require("cordova/plugin/FileReader");
- window.File = require("cordova/plugin/File");
-
// Inject a listener for the backbutton, and tell native to override the flag (true/false) when we have 1 or more, or 0, listeners
var backButtonChannel = cordova.addDocumentEventHandler('backbutton');
@@ -1103,9 +1154,6 @@
},
console:{
path: "cordova/plugin/windowsphone/console"
- },
- FileTransfer: {
- path: 'cordova/plugin/windowsphone/FileTransfer'
}
}
};
@@ -2265,11 +2313,12 @@
define("cordova/plugin/FileReader", function(require, exports, module) {
var exec = require('cordova/exec'),
+ modulemapper = require('cordova/modulemapper'),
utils = require('cordova/utils'),
File = require('cordova/plugin/File'),
FileError = require('cordova/plugin/FileError'),
ProgressEvent = require('cordova/plugin/ProgressEvent'),
- origFileReader = this.FileReader;
+ origFileReader = modulemapper.getOriginalSymbol(this, 'FileReader');
/**
* This class reads the mobile device file system.
@@ -4257,6 +4306,46 @@
});
+// file: lib\windowsphone\plugin\file\symbols.js
+define("cordova/plugin/file/symbols", function(require, exports, module) {
+
+
+var modulemapper = require('cordova/modulemapper'),
+ symbolshelper = require('cordova/plugin/file/symbolshelper');
+
+symbolshelper(modulemapper.defaults);
+modulemapper.clobbers('cordova/plugin/File', 'File');
+modulemapper.clobbers('cordova/plugin/FileReader', 'FileReader');
+modulemapper.clobbers('cordova/plugin/windowsphone/FileTransfer', 'FileTransfer');
+
+});
+
+// file: lib\common\plugin\file\symbolshelper.js
+define("cordova/plugin/file/symbolshelper", function(require, exports, module) {
+
+module.exports = function(exportFunc) {
+ exportFunc('cordova/plugin/DirectoryEntry', 'DirectoryEntry');
+ exportFunc('cordova/plugin/DirectoryReader', 'DirectoryReader');
+ exportFunc('cordova/plugin/Entry', 'Entry');
+ exportFunc('cordova/plugin/File', 'File');
+ exportFunc('cordova/plugin/FileEntry', 'FileEntry');
+ exportFunc('cordova/plugin/FileError', 'FileError');
+ exportFunc('cordova/plugin/FileReader', 'FileReader');
+ exportFunc('cordova/plugin/FileSystem', 'FileSystem');
+ exportFunc('cordova/plugin/FileTransfer', 'FileTransfer');
+ exportFunc('cordova/plugin/FileTransferError', 'FileTransferError');
+ exportFunc('cordova/plugin/FileUploadOptions', 'FileUploadOptions');
+ exportFunc('cordova/plugin/FileUploadResult', 'FileUploadResult');
+ exportFunc('cordova/plugin/FileWriter', 'FileWriter');
+ exportFunc('cordova/plugin/Flags', 'Flags');
+ exportFunc('cordova/plugin/LocalFileSystem', 'LocalFileSystem');
+ exportFunc('cordova/plugin/Metadata', 'Metadata');
+ exportFunc('cordova/plugin/requestFileSystem', 'requestFileSystem');
+ exportFunc('cordova/plugin/resolveLocalFileSystemURI', 'resolveLocalFileSystemURI');
+};
+
+});
+
// file: lib\common\plugin\geolocation.js
define("cordova/plugin/geolocation", function(require, exports, module) {
@@ -5991,7 +6080,10 @@
*/
utils.defineGetterSetter = function(obj, key, getFunc, opt_setFunc) {
if (Object.defineProperty) {
- var desc = {get:getFunc};
+ var desc = {
+ get: getFunc,
+ configurable: true
+ };
if (opt_setFunc) {
desc.set = opt_setFunc;
}
diff --git a/templates/vspackage/GapAppVsPackage.cs b/templates/vspackage/GapAppVsPackage.cs
deleted file mode 100644
index ac66cd8..0000000
--- a/templates/vspackage/GapAppVsPackage.cs
+++ /dev/null
@@ -1,64 +0,0 @@
-using System;
-using System.Diagnostics;
-using System.Globalization;
-using System.Runtime.InteropServices;
-using System.ComponentModel.Design;
-using Microsoft.Win32;
-using Microsoft.VisualStudio;
-using Microsoft.VisualStudio.Shell.Interop;
-using Microsoft.VisualStudio.OLE.Interop;
-using Microsoft.VisualStudio.Shell;
-
-namespace Microsoft.vspackage1
-{
- /// <summary>
- /// This is the class that implements the package exposed by this assembly.
- ///
- /// The minimum requirement for a class to be considered a valid package for Visual Studio
- /// is to implement the IVsPackage interface and register itself with the shell.
- /// This package uses the helper classes defined inside the Managed Package Framework (MPF)
- /// to do it: it derives from the Package class that provides the implementation of the
- /// IVsPackage interface and uses the registration attributes defined in the framework to
- /// register itself and its components with the shell.
- /// </summary>
- // This attribute tells the PkgDef creation utility (CreatePkgDef.exe) that this class is
- // a package.
- [PackageRegistration(UseManagedResourcesOnly = true)]
- // This attribute is used to register the informations needed to show the this package
- // in the Help/About dialog of Visual Studio.
- [InstalledProductRegistration("#110", "#112", "1.0", IconResourceID = 400)]
- [Guid(GuidList.guidvspackage1PkgString)]
- public sealed class vspackage1Package : Package
- {
- /// <summary>
- /// Default constructor of the package.
- /// Inside this method you can place any initialization code that does not require
- /// any Visual Studio service because at this point the package object is created but
- /// not sited yet inside Visual Studio environment. The place to do all the other
- /// initialization is the Initialize method.
- /// </summary>
- public vspackage1Package()
- {
- Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering constructor for: {0}", this.ToString()));
- }
-
-
-
- /////////////////////////////////////////////////////////////////////////////
- // Overriden Package Implementation
- #region Package Members
-
- /// <summary>
- /// Initialization of the package; this method is called right after the package is sited, so this is the place
- /// where you can put all the initilaization code that rely on services provided by VisualStudio.
- /// </summary>
- protected override void Initialize()
- {
- Trace.WriteLine (string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString()));
- base.Initialize();
-
- }
- #endregion
-
- }
-}
diff --git a/templates/vspackage/GapAppVsPackage.csproj b/templates/vspackage/GapAppVsPackage.csproj
deleted file mode 100644
index 9130ec1..0000000
--- a/templates/vspackage/GapAppVsPackage.csproj
+++ /dev/null
@@ -1,174 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{16C962DB-EEDC-4B73-99A6-33F490077CF3}</ProjectGuid>
- <ProjectTypeGuids>{82b43b9b-a64c-4715-b499-d71e9ca2bd60};{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>GapAppVsPackage</RootNamespace>
- <AssemblyName>GapAppVsPackage</AssemblyName>
- <SignAssembly>True</SignAssembly>
- <AssemblyOriginatorKeyFile>Key.snk</AssemblyOriginatorKeyFile>
- <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>bin\Debug\</OutputPath>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <DebugType>pdbonly</DebugType>
- <Optimize>true</Optimize>
- <OutputPath>bin\Release\</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <RunCodeAnalysis>true</RunCodeAnalysis>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="Microsoft.CSharp" />
- <Reference Include="Microsoft.VisualStudio.OLE.Interop" />
- <Reference Include="Microsoft.VisualStudio.Shell.Interop" />
- <Reference Include="Microsoft.VisualStudio.Shell.Interop.8.0" />
- <Reference Include="Microsoft.VisualStudio.Shell.Interop.9.0" />
- <Reference Include="Microsoft.VisualStudio.Shell.Interop.10.0" />
- <Reference Include="Microsoft.VisualStudio.TextManager.Interop" />
- <Reference Include="Microsoft.VisualStudio.Shell.10.0">
- <Private>false</Private>
- </Reference>
- <Reference Include="Microsoft.VisualStudio.Shell.Immutable.10.0" />
- <Reference Include="System" />
- <Reference Include="System.Core" />
- <Reference Include="System.Data" />
- <Reference Include="System.Design" />
- <Reference Include="System.Drawing" />
- <Reference Include="System.Windows.Forms" />
- <Reference Include="System.Xml" />
- </ItemGroup>
- <ItemGroup>
- <COMReference Include="EnvDTE">
- <Guid>{80CC9F66-E7D8-4DDD-85B6-D9E6CD0E93E2}</Guid>
- <VersionMajor>8</VersionMajor>
- <VersionMinor>0</VersionMinor>
- <Lcid>0</Lcid>
- <WrapperTool>primary</WrapperTool>
- <Isolated>False</Isolated>
- <EmbedInteropTypes>False</EmbedInteropTypes>
- </COMReference>
- <COMReference Include="EnvDTE100">
- <Guid>{26AD1324-4B7C-44BC-84F8-B86AED45729F}</Guid>
- <VersionMajor>10</VersionMajor>
- <VersionMinor>0</VersionMinor>
- <Lcid>0</Lcid>
- <WrapperTool>primary</WrapperTool>
- <Isolated>False</Isolated>
- <EmbedInteropTypes>False</EmbedInteropTypes>
- </COMReference>
- <COMReference Include="EnvDTE80">
- <Guid>{1A31287A-4D7D-413E-8E32-3B374931BD89}</Guid>
- <VersionMajor>8</VersionMajor>
- <VersionMinor>0</VersionMinor>
- <Lcid>0</Lcid>
- <WrapperTool>primary</WrapperTool>
- <Isolated>False</Isolated>
- <EmbedInteropTypes>False</EmbedInteropTypes>
- </COMReference>
- <COMReference Include="EnvDTE90">
- <Guid>{2CE2370E-D744-4936-A090-3FFFE667B0E1}</Guid>
- <VersionMajor>9</VersionMajor>
- <VersionMinor>0</VersionMinor>
- <Lcid>0</Lcid>
- <WrapperTool>primary</WrapperTool>
- <Isolated>False</Isolated>
- <EmbedInteropTypes>False</EmbedInteropTypes>
- </COMReference>
- <COMReference Include="Microsoft.VisualStudio.CommandBars">
- <Guid>{1CBA492E-7263-47BB-87FE-639000619B15}</Guid>
- <VersionMajor>8</VersionMajor>
- <VersionMinor>0</VersionMinor>
- <Lcid>0</Lcid>
- <WrapperTool>primary</WrapperTool>
- <Isolated>False</Isolated>
- <EmbedInteropTypes>False</EmbedInteropTypes>
- </COMReference>
- <COMReference Include="stdole">
- <Guid>{00020430-0000-0000-C000-000000000046}</Guid>
- <VersionMajor>2</VersionMajor>
- <VersionMinor>0</VersionMinor>
- <Lcid>0</Lcid>
- <WrapperTool>primary</WrapperTool>
- <Isolated>False</Isolated>
- <EmbedInteropTypes>False</EmbedInteropTypes>
- </COMReference>
- </ItemGroup>
- <ItemGroup>
- <Compile Include="Guids.cs" />
- <Compile Include="Resources.Designer.cs">
- <AutoGen>True</AutoGen>
- <DesignTime>True</DesignTime>
- <DependentUpon>Resources.resx</DependentUpon>
- </Compile>
- <Compile Include="GlobalSuppressions.cs" />
- <Compile Include="GapAppVsPackage.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- </ItemGroup>
- <ItemGroup>
- <EmbeddedResource Include="Resources.resx">
- <Generator>ResXFileCodeGenerator</Generator>
- <LastGenOutput>Resources.Designer.cs</LastGenOutput>
- <SubType>Designer</SubType>
- </EmbeddedResource>
- <EmbeddedResource Include="VSPackage.resx">
- <MergeWithCTO>true</MergeWithCTO>
- <ManifestResourceName>VSPackage</ManifestResourceName>
- </EmbeddedResource>
- </ItemGroup>
- <ItemGroup>
- <None Include="source.extension.vsixmanifest">
- <SubType>Designer</SubType>
- </None>
- </ItemGroup>
- <ItemGroup>
- <None Include="Key.snk" />
- </ItemGroup>
- <ItemGroup>
- <Content Include="pg_templateIcon.png">
- <CopyToOutputDirectory>Always</CopyToOutputDirectory>
- <IncludeInVSIX>true</IncludeInVSIX>
- </Content>
- <Content Include="pg_templatePreview.jpg">
- <CopyToOutputDirectory>Always</CopyToOutputDirectory>
- <IncludeInVSIX>true</IncludeInVSIX>
- </Content>
- <Content Include="Resources\Package.ico" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\full\GapAppProjTemplate.csproj">
- <Project>{A7CBA84E-1D65-4260-8A07-277F1F518A11}</Project>
- <Name>GapAppProjTemplate</Name>
- <IncludeOutputGroupsInVSIX>TemplateProjectOutputGroup%3b</IncludeOutputGroupsInVSIX>
- <TemplateType>Project</TemplateType>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- <VSIXSubPath>ProjectTemplates</VSIXSubPath>
- </ProjectReference>
- </ItemGroup>
- <PropertyGroup>
- <UseCodebase>true</UseCodebase>
- </PropertyGroup>
- <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
- <Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\VSSDK\Microsoft.VsSDK.targets" />
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
- Other similar extension points exist, see Microsoft.Common.targets.
- <Target Name="BeforeBuild">
- </Target>
- <Target Name="AfterBuild">
- </Target>
- -->
-</Project>
\ No newline at end of file
diff --git a/templates/vspackage/GlobalSuppressions.cs b/templates/vspackage/GlobalSuppressions.cs
deleted file mode 100644
index 746e3da..0000000
--- a/templates/vspackage/GlobalSuppressions.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-// This file is used by Code Analysis to maintain SuppressMessage
-// attributes that are applied to this project. Project-level
-// suppressions either have no target or are given a specific target
-// and scoped to a namespace, type, member, etc.
-//
-// To add a suppression to this file, right-click the message in the
-// Error List, point to "Suppress Message(s)", and click "In Project
-// Suppression File". You do not need to add suppressions to this
-// file manually.
-
-[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1017:MarkAssembliesWithComVisible")]
diff --git a/templates/vspackage/Guids.cs b/templates/vspackage/Guids.cs
deleted file mode 100644
index 1637287..0000000
--- a/templates/vspackage/Guids.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-// Guids.cs
-// MUST match guids.h
-using System;
-
-namespace Microsoft.vspackage1
-{
- static class GuidList
- {
- public const string guidvspackage1PkgString = "d5c0d96c-110c-41a0-8224-51bcba658426";
- public const string guidvspackage1CmdSetString = "7f9800fa-9b5e-4286-b22a-783ae28cb526";
-
- public static readonly Guid guidvspackage1CmdSet = new Guid(guidvspackage1CmdSetString);
- };
-}
\ No newline at end of file
diff --git a/templates/vspackage/Key.snk b/templates/vspackage/Key.snk
deleted file mode 100644
index 2345c66..0000000
--- a/templates/vspackage/Key.snk
+++ /dev/null
Binary files differ
diff --git a/templates/vspackage/Properties/AssemblyInfo.cs b/templates/vspackage/Properties/AssemblyInfo.cs
deleted file mode 100644
index d3b9890..0000000
--- a/templates/vspackage/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System;
-using System.Reflection;
-using System.Resources;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("Apache Cordova for Windows Phone")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("Microsoft")]
-[assembly: AssemblyProduct("Apache Cordova for Windows Phone")]
-[assembly: AssemblyCopyright("")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-[assembly: ComVisible(false)]
-[assembly: CLSCompliant(false)]
-[assembly: NeutralResourcesLanguage("en-US")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Revision and Build Numbers
-// by using the '*' as shown below:
-
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
-
-
-
diff --git a/templates/vspackage/Resources.Designer.cs b/templates/vspackage/Resources.Designer.cs
deleted file mode 100644
index 9a3d11c..0000000
--- a/templates/vspackage/Resources.Designer.cs
+++ /dev/null
@@ -1,63 +0,0 @@
-//------------------------------------------------------------------------------
-// <auto-generated>
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.261
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-// </auto-generated>
-//------------------------------------------------------------------------------
-
-namespace GapAppVsPackage {
- using System;
-
-
- /// <summary>
- /// A strongly-typed resource class, for looking up localized strings, etc.
- /// </summary>
- // This class was auto-generated by the StronglyTypedResourceBuilder
- // class via a tool like ResGen or Visual Studio.
- // To add or remove a member, edit your .ResX file then rerun ResGen
- // with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class Resources {
-
- private static global::System.Resources.ResourceManager resourceMan;
-
- private static global::System.Globalization.CultureInfo resourceCulture;
-
- [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal Resources() {
- }
-
- /// <summary>
- /// Returns the cached ResourceManager instance used by this class.
- /// </summary>
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager {
- get {
- if (object.ReferenceEquals(resourceMan, null)) {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("GapAppVsPackage.Resources", typeof(Resources).Assembly);
- resourceMan = temp;
- }
- return resourceMan;
- }
- }
-
- /// <summary>
- /// Overrides the current thread's CurrentUICulture property for all
- /// resource lookups using this strongly typed resource class.
- /// </summary>
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture {
- get {
- return resourceCulture;
- }
- set {
- resourceCulture = value;
- }
- }
- }
-}
diff --git a/templates/vspackage/Resources.resx b/templates/vspackage/Resources.resx
deleted file mode 100644
index 7081e35..0000000
--- a/templates/vspackage/Resources.resx
+++ /dev/null
@@ -1,129 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- VS SDK Notes: This resx file contains the resources that will be consumed directly by your package.
- For example, if you chose to create a tool window, there is a resource with ID 'CanNotCreateWindow'. This
- is used in VsPkg.cs to determine the string to show the user if there is an error when attempting to create
- the tool window.
-
- Resources that are accessed directly from your package *by Visual Studio* are stored in the VSPackage.resx
- file.
--->
-<root>
- <!--
- Microsoft ResX Schema
-
- Version 2.0
-
- The primary goals of this format is to allow a simple XML format
- that is mostly human readable. The generation and parsing of the
- various data types are done through the TypeConverter classes
- associated with the data types.
-
- Example:
-
- ... ado.net/XML headers & schema ...
- <resheader name="resmimetype">text/microsoft-resx</resheader>
- <resheader name="version">2.0</resheader>
- <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
- <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
- <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
- <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
- <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
- <value>[base64 mime encoded serialized .NET Framework object]</value>
- </data>
- <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
- <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
- <comment>This is a comment</comment>
- </data>
-
- There are any number of "resheader" rows that contain simple
- name/value pairs.
-
- Each data row contains a name, and value. The row also contains a
- type or mimetype. Type corresponds to a .NET class that support
- text/value conversion through the TypeConverter architecture.
- Classes that don't support this are serialized and stored with the
- mimetype set.
-
- The mimetype is used for serialized objects, and tells the
- ResXResourceReader how to depersist the object. This is currently not
- extensible. For a given mimetype the value must be set accordingly:
-
- Note - application/x-microsoft.net.object.binary.base64 is the format
- that the ResXResourceWriter will generate, however the reader can
- read any of the formats listed below.
-
- mimetype: application/x-microsoft.net.object.binary.base64
- value : The object must be serialized with
- : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.soap.base64
- value : The object must be serialized with
- : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.bytearray.base64
- value : The object must be serialized into a byte array
- : using a System.ComponentModel.TypeConverter
- : and then encoded with base64 encoding.
- -->
- <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
- <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
- <xsd:element name="root" msdata:IsDataSet="true">
- <xsd:complexType>
- <xsd:choice maxOccurs="unbounded">
- <xsd:element name="metadata">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" />
- </xsd:sequence>
- <xsd:attribute name="name" use="required" type="xsd:string" />
- <xsd:attribute name="type" type="xsd:string" />
- <xsd:attribute name="mimetype" type="xsd:string" />
- <xsd:attribute ref="xml:space" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="assembly">
- <xsd:complexType>
- <xsd:attribute name="alias" type="xsd:string" />
- <xsd:attribute name="name" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="data">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
- <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
- <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
- <xsd:attribute ref="xml:space" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="resheader">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" />
- </xsd:complexType>
- </xsd:element>
- </xsd:choice>
- </xsd:complexType>
- </xsd:element>
- </xsd:schema>
- <resheader name="resmimetype">
- <value>text/microsoft-resx</value>
- </resheader>
- <resheader name="version">
- <value>2.0</value>
- </resheader>
- <resheader name="reader">
- <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <resheader name="writer">
- <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
-</root>
\ No newline at end of file
diff --git a/templates/vspackage/Resources/Package.ico b/templates/vspackage/Resources/Package.ico
deleted file mode 100644
index ea3b23f..0000000
--- a/templates/vspackage/Resources/Package.ico
+++ /dev/null
Binary files differ
diff --git a/templates/vspackage/VSPackage.resx b/templates/vspackage/VSPackage.resx
deleted file mode 100644
index a54fdf1..0000000
--- a/templates/vspackage/VSPackage.resx
+++ /dev/null
@@ -1,140 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- VS SDK Notes: This resx file contains the resources that will be consumed from your package by Visual Studio.
- For example, Visual Studio will attempt to load resource '400' from this resource stream when it needs to
- load your package's icon. Because Visual Studio will always look in the VSPackage.resources stream first for
- resources it needs, you should put additional resources that Visual Studio will load directly into this resx
- file.
-
- Resources that you would like to access directly from your package in a strong-typed fashion should be stored
- in Resources.resx or another resx file.
--->
-<root>
- <!--
- Microsoft ResX Schema
-
- Version 2.0
-
- The primary goals of this format is to allow a simple XML format
- that is mostly human readable. The generation and parsing of the
- various data types are done through the TypeConverter classes
- associated with the data types.
-
- Example:
-
- ... ado.net/XML headers & schema ...
- <resheader name="resmimetype">text/microsoft-resx</resheader>
- <resheader name="version">2.0</resheader>
- <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
- <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
- <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
- <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
- <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
- <value>[base64 mime encoded serialized .NET Framework object]</value>
- </data>
- <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
- <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
- <comment>This is a comment</comment>
- </data>
-
- There are any number of "resheader" rows that contain simple
- name/value pairs.
-
- Each data row contains a name, and value. The row also contains a
- type or mimetype. Type corresponds to a .NET class that support
- text/value conversion through the TypeConverter architecture.
- Classes that don't support this are serialized and stored with the
- mimetype set.
-
- The mimetype is used for serialized objects, and tells the
- ResXResourceReader how to depersist the object. This is currently not
- extensible. For a given mimetype the value must be set accordingly:
-
- Note - application/x-microsoft.net.object.binary.base64 is the format
- that the ResXResourceWriter will generate, however the reader can
- read any of the formats listed below.
-
- mimetype: application/x-microsoft.net.object.binary.base64
- value : The object must be serialized with
- : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.soap.base64
- value : The object must be serialized with
- : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.bytearray.base64
- value : The object must be serialized into a byte array
- : using a System.ComponentModel.TypeConverter
- : and then encoded with base64 encoding.
- -->
- <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
- <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
- <xsd:element name="root" msdata:IsDataSet="true">
- <xsd:complexType>
- <xsd:choice maxOccurs="unbounded">
- <xsd:element name="metadata">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" />
- </xsd:sequence>
- <xsd:attribute name="name" use="required" type="xsd:string" />
- <xsd:attribute name="type" type="xsd:string" />
- <xsd:attribute name="mimetype" type="xsd:string" />
- <xsd:attribute ref="xml:space" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="assembly">
- <xsd:complexType>
- <xsd:attribute name="alias" type="xsd:string" />
- <xsd:attribute name="name" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="data">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
- <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
- <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
- <xsd:attribute ref="xml:space" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="resheader">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" />
- </xsd:complexType>
- </xsd:element>
- </xsd:choice>
- </xsd:complexType>
- </xsd:element>
- </xsd:schema>
- <resheader name="resmimetype">
- <value>text/microsoft-resx</value>
- </resheader>
- <resheader name="version">
- <value>2.0</value>
- </resheader>
- <resheader name="reader">
- <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <resheader name="writer">
- <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
- <data name="110" xml:space="preserve">
- <value>Apache Cordova for Windows Phone 7</value>
- </data>
- <data name="112" xml:space="preserve">
- <value>Information about my package</value>
- </data>
- <data name="400" type="System.Resources.ResXFileRef, System.Windows.Forms">
- <value>Resources\Package.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
- </data>
-</root>
\ No newline at end of file
diff --git a/templates/vspackage/pg_templateIcon.png b/templates/vspackage/pg_templateIcon.png
deleted file mode 100644
index 75c17c7..0000000
--- a/templates/vspackage/pg_templateIcon.png
+++ /dev/null
Binary files differ
diff --git a/templates/vspackage/pg_templatePreview.jpg b/templates/vspackage/pg_templatePreview.jpg
deleted file mode 100644
index 1d72941..0000000
--- a/templates/vspackage/pg_templatePreview.jpg
+++ /dev/null
Binary files differ
diff --git a/templates/vspackage/source.extension.vsixmanifest b/templates/vspackage/source.extension.vsixmanifest
deleted file mode 100644
index f2893a9..0000000
--- a/templates/vspackage/source.extension.vsixmanifest
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Vsix xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Version="1.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2010">
- <Identifier Id="d5c0d96c-110c-41a0-8224-51bcba658426">
- <Name>Apache Cordova for Windows Phone 8</Name>
- <Author>Microsoft</Author>
- <Version>1.0</Version>
- <Description xml:space="preserve">Apache Cordova fow Windows Phone 8 Project Template</Description>
- <Locale>1033</Locale>
- <MoreInfoUrl>https://github.com/apache/cordova-wp8</MoreInfoUrl>
- <GettingStartedGuide>http://create.msdn.com/en-us/home/getting_started</GettingStartedGuide>
- <Icon>pg_templateIcon.png</Icon>
- <PreviewImage>pg_templatePreview.jpg</PreviewImage>
- <InstalledByMsi>false</InstalledByMsi>
- <SupportedProducts>
- <VisualStudio Version="10.0">
- <Edition>Pro</Edition>
- </VisualStudio>
- </SupportedProducts>
- <SupportedFrameworkRuntimeEdition MinVersion="4.0" MaxVersion="4.0" />
- </Identifier>
- <References>
- <Reference Id="Microsoft.VisualStudio.MPF" MinVersion="10.0">
- <Name>Visual Studio MPF</Name>
- </Reference>
- </References>
- <Content>
- <VsPackage>|%CurrentProject%;PkgdefProjectOutputGroup|</VsPackage>
- <ProjectTemplate>ProjectTemplates</ProjectTemplate>
- </Content>
-</Vsix>
diff --git a/tests/MobileSpecUnitTests/MobileSpecUnitTests.csproj b/tests/MobileSpecUnitTests/MobileSpecUnitTests.csproj
index 491dbeb..68decca 100644
--- a/tests/MobileSpecUnitTests/MobileSpecUnitTests.csproj
+++ b/tests/MobileSpecUnitTests/MobileSpecUnitTests.csproj
@@ -203,10 +203,9 @@
<Content Include="www\camera\index.html" />
<Content Include="www\compass\index.html" />
<Content Include="www\contacts\index.html" />
- <Content Include="www\cordova-2.3.0.js" />
+ <Content Include="www\cordova-2.4.0.js" />
<Content Include="www\cordova.js" />
<Content Include="www\events\index.html" />
- <Content Include="www\globalization.js" />
<Content Include="www\index.html">
<SubType>Designer</SubType>
</Content>
diff --git a/tests/MobileSpecUnitTests/www/cordova-2.4.0.js b/tests/MobileSpecUnitTests/www/cordova-2.4.0.js
index b64e13f..d62f792 100644
--- a/tests/MobileSpecUnitTests/www/cordova-2.4.0.js
+++ b/tests/MobileSpecUnitTests/www/cordova-2.4.0.js
@@ -1,6 +1,8 @@
-// commit 7d5552049e33254eca3bda227af8a4892a7ce7c3
+// Platform: windowsphone
-// File generated at :: Mon Jan 21 2013 17:12:32 GMT-0800 (Pacific Standard Time)
+// commit e784eee3ce02dbd475e3c3f70031668f1706f2ec
+
+// File generated at :: Fri Feb 01 2013 14:32:23 GMT-0800 (Pacific Standard Time)
/*
Licensed to the Apache Software Foundation (ASF) under one
@@ -78,6 +80,7 @@
delete modules[id];
};
+ define.moduleMap = modules;
})();
//Export for use in node
@@ -409,6 +412,8 @@
if (message) {
utils.defineGetter(obj, key, function() {
console.log(message);
+ delete obj[key];
+ clobber(obj, key, value);
return value;
});
} else {
@@ -438,10 +443,6 @@
// Overwrite if not currently defined.
if (typeof parent[key] == 'undefined') {
assignOrWrapInDeprecateGetter(parent, key, result, obj.deprecated);
- } else if (merge && typeof obj.path !== 'undefined') {
- // If merging, merge parent onto result
- recursiveMerge(result, parent[key]);
- parent[key] = result;
} else {
// Set result to what already exists, so we can build children into it if they exist.
result = parent[key];
@@ -467,19 +468,18 @@
function recursiveMerge(target, src) {
for (var prop in src) {
if (src.hasOwnProperty(prop)) {
- if (typeof target.prototype !== 'undefined' && target.prototype.constructor === target) {
+ if (target.prototype && target.prototype.constructor === target) {
// If the target object is a constructor override off prototype.
- target.prototype[prop] = src[prop];
+ clobber(target.prototype, prop, src[prop]);
} else {
- if (typeof src[prop] === 'object') {
- target[prop] = recursiveMerge(target[prop], src[prop]);
+ if (typeof src[prop] === 'object' && typeof target[prop] === 'object') {
+ recursiveMerge(target[prop], src[prop]);
} else {
clobber(target, prop, src[prop]);
}
}
}
}
- return target;
}
module.exports = {
@@ -491,7 +491,9 @@
},
buildIntoAndMerge: function(objects, target) {
include(target, objects, true, true);
- }
+ },
+ recursiveMerge: recursiveMerge,
+ assignOrWrapInDeprecateGetter: assignOrWrapInDeprecateGetter
};
});
@@ -904,54 +906,9 @@
device: {
path: 'cordova/plugin/device'
},
- DirectoryEntry: {
- path: 'cordova/plugin/DirectoryEntry'
- },
- DirectoryReader: {
- path: 'cordova/plugin/DirectoryReader'
- },
- Entry: {
- path: 'cordova/plugin/Entry'
- },
- File: {
- path: 'cordova/plugin/File'
- },
- FileEntry: {
- path: 'cordova/plugin/FileEntry'
- },
- FileError: {
- path: 'cordova/plugin/FileError'
- },
- FileReader: {
- path: 'cordova/plugin/FileReader'
- },
- FileSystem: {
- path: 'cordova/plugin/FileSystem'
- },
- FileTransfer: {
- path: 'cordova/plugin/FileTransfer'
- },
- FileTransferError: {
- path: 'cordova/plugin/FileTransferError'
- },
- FileUploadOptions: {
- path: 'cordova/plugin/FileUploadOptions'
- },
- FileUploadResult: {
- path: 'cordova/plugin/FileUploadResult'
- },
- FileWriter: {
- path: 'cordova/plugin/FileWriter'
- },
- Flags: {
- path: 'cordova/plugin/Flags'
- },
GlobalizationError: {
path: 'cordova/plugin/GlobalizationError'
},
- LocalFileSystem: {
- path: 'cordova/plugin/LocalFileSystem'
- },
Media: {
path: 'cordova/plugin/Media'
},
@@ -964,9 +921,6 @@
MediaFileData:{
path: 'cordova/plugin/MediaFileData'
},
- Metadata:{
- path: 'cordova/plugin/Metadata'
- },
Position: {
path: 'cordova/plugin/Position'
},
@@ -975,12 +929,6 @@
},
ProgressEvent: {
path: 'cordova/plugin/ProgressEvent'
- },
- requestFileSystem:{
- path: 'cordova/plugin/requestFileSystem'
- },
- resolveLocalFileSystemURI:{
- path: 'cordova/plugin/resolveLocalFileSystemURI'
}
},
clobbers: {
@@ -1049,6 +997,107 @@
});
+// file: lib\common\modulemapper.js
+define("cordova/modulemapper", function(require, exports, module) {
+
+var builder = require('cordova/builder'),
+ moduleMap = define.moduleMap,
+ symbolList,
+ deprecationMap;
+
+exports.reset = function() {
+ symbolList = [];
+ deprecationMap = {};
+};
+
+function addEntry(strategy, moduleName, symbolPath, opt_deprecationMessage) {
+ if (!(moduleName in moduleMap)) {
+ throw new Error('Module ' + moduleName + ' does not exist.');
+ }
+ symbolList.push(strategy, moduleName, symbolPath);
+ if (opt_deprecationMessage) {
+ deprecationMap[symbolPath] = opt_deprecationMessage;
+ }
+}
+
+// Note: Android 2.3 does have Function.bind().
+exports.clobbers = function(moduleName, symbolPath, opt_deprecationMessage) {
+ addEntry('c', moduleName, symbolPath, opt_deprecationMessage);
+};
+
+exports.merges = function(moduleName, symbolPath, opt_deprecationMessage) {
+ addEntry('m', moduleName, symbolPath, opt_deprecationMessage);
+};
+
+exports.defaults = function(moduleName, symbolPath, opt_deprecationMessage) {
+ addEntry('d', moduleName, symbolPath, opt_deprecationMessage);
+};
+
+function prepareNamespace(symbolPath, context) {
+ if (!symbolPath) {
+ return context;
+ }
+ var parts = symbolPath.split('.');
+ var cur = context;
+ for (var i = 0, part; part = parts[i]; ++i) {
+ cur[part] = cur[part] || {};
+ }
+ return cur[parts[i-1]];
+}
+
+exports.mapModules = function(context) {
+ var origSymbols = {};
+ context.CDV_origSymbols = origSymbols;
+ for (var i = 0, len = symbolList.length; i < len; i += 3) {
+ var strategy = symbolList[i];
+ var moduleName = symbolList[i + 1];
+ var symbolPath = symbolList[i + 2];
+ var lastDot = symbolPath.lastIndexOf('.');
+ var namespace = symbolPath.substr(0, lastDot);
+ var lastName = symbolPath.substr(lastDot + 1);
+
+ var module = require(moduleName);
+ var deprecationMsg = symbolPath in deprecationMap ? 'Access made to deprecated symbol: ' + symbolPath + '. ' + deprecationMsg : null;
+ var parentObj = prepareNamespace(namespace, context);
+ var target = parentObj[lastName];
+
+ if (strategy == 'm' && target) {
+ builder.recursiveMerge(target, module);
+ } else if ((strategy == 'd' && !target) || (strategy != 'd')) {
+ if (target) {
+ origSymbols[symbolPath] = target;
+ }
+ builder.assignOrWrapInDeprecateGetter(parentObj, lastName, module, deprecationMsg);
+ }
+ }
+};
+
+exports.getOriginalSymbol = function(context, symbolPath) {
+ var origSymbols = context.CDV_origSymbols;
+ if (origSymbols && (symbolPath in origSymbols)) {
+ return origSymbols[symbolPath];
+ }
+ var parts = symbolPath.split('.');
+ var obj = context;
+ for (var i = 0; i < parts.length; ++i) {
+ obj = obj && obj[parts[i]];
+ }
+ return obj;
+};
+
+exports.loadMatchingModules = function(matchingRegExp) {
+ for (var k in moduleMap) {
+ if (matchingRegExp.exec(k)) {
+ require(k);
+ }
+ }
+};
+
+exports.reset();
+
+
+});
+
// file: lib\windowsphone\platform.js
define("cordova/platform", function(require, exports, module) {
@@ -1067,11 +1116,13 @@
module.exports = {
id: "windowsphone",
initialize:function() {
+ var modulemapper = require('cordova/modulemapper');
+
+ modulemapper.loadMatchingModules(/cordova.*\/symbols$/);
+ modulemapper.mapModules(window);
+
window.alert = window.alert || require("cordova/plugin/notification").alert;
window.confirm = window.confirm || require("cordova/plugin/notification").confirm;
- window.FileReader = require("cordova/plugin/FileReader");
- window.File = require("cordova/plugin/File");
-
// Inject a listener for the backbutton, and tell native to override the flag (true/false) when we have 1 or more, or 0, listeners
var backButtonChannel = cordova.addDocumentEventHandler('backbutton');
@@ -1103,9 +1154,6 @@
},
console:{
path: "cordova/plugin/windowsphone/console"
- },
- FileTransfer: {
- path: 'cordova/plugin/windowsphone/FileTransfer'
}
}
};
@@ -2265,11 +2313,12 @@
define("cordova/plugin/FileReader", function(require, exports, module) {
var exec = require('cordova/exec'),
+ modulemapper = require('cordova/modulemapper'),
utils = require('cordova/utils'),
File = require('cordova/plugin/File'),
FileError = require('cordova/plugin/FileError'),
ProgressEvent = require('cordova/plugin/ProgressEvent'),
- origFileReader = this.FileReader;
+ origFileReader = modulemapper.getOriginalSymbol(this, 'FileReader');
/**
* This class reads the mobile device file system.
@@ -4257,6 +4306,46 @@
});
+// file: lib\windowsphone\plugin\file\symbols.js
+define("cordova/plugin/file/symbols", function(require, exports, module) {
+
+
+var modulemapper = require('cordova/modulemapper'),
+ symbolshelper = require('cordova/plugin/file/symbolshelper');
+
+symbolshelper(modulemapper.defaults);
+modulemapper.clobbers('cordova/plugin/File', 'File');
+modulemapper.clobbers('cordova/plugin/FileReader', 'FileReader');
+modulemapper.clobbers('cordova/plugin/windowsphone/FileTransfer', 'FileTransfer');
+
+});
+
+// file: lib\common\plugin\file\symbolshelper.js
+define("cordova/plugin/file/symbolshelper", function(require, exports, module) {
+
+module.exports = function(exportFunc) {
+ exportFunc('cordova/plugin/DirectoryEntry', 'DirectoryEntry');
+ exportFunc('cordova/plugin/DirectoryReader', 'DirectoryReader');
+ exportFunc('cordova/plugin/Entry', 'Entry');
+ exportFunc('cordova/plugin/File', 'File');
+ exportFunc('cordova/plugin/FileEntry', 'FileEntry');
+ exportFunc('cordova/plugin/FileError', 'FileError');
+ exportFunc('cordova/plugin/FileReader', 'FileReader');
+ exportFunc('cordova/plugin/FileSystem', 'FileSystem');
+ exportFunc('cordova/plugin/FileTransfer', 'FileTransfer');
+ exportFunc('cordova/plugin/FileTransferError', 'FileTransferError');
+ exportFunc('cordova/plugin/FileUploadOptions', 'FileUploadOptions');
+ exportFunc('cordova/plugin/FileUploadResult', 'FileUploadResult');
+ exportFunc('cordova/plugin/FileWriter', 'FileWriter');
+ exportFunc('cordova/plugin/Flags', 'Flags');
+ exportFunc('cordova/plugin/LocalFileSystem', 'LocalFileSystem');
+ exportFunc('cordova/plugin/Metadata', 'Metadata');
+ exportFunc('cordova/plugin/requestFileSystem', 'requestFileSystem');
+ exportFunc('cordova/plugin/resolveLocalFileSystemURI', 'resolveLocalFileSystemURI');
+};
+
+});
+
// file: lib\common\plugin\geolocation.js
define("cordova/plugin/geolocation", function(require, exports, module) {
@@ -5991,7 +6080,10 @@
*/
utils.defineGetterSetter = function(obj, key, getFunc, opt_setFunc) {
if (Object.defineProperty) {
- var desc = {get:getFunc};
+ var desc = {
+ get: getFunc,
+ configurable: true
+ };
if (opt_setFunc) {
desc.set = opt_setFunc;
}
diff --git a/tests/MobileSpecUnitTests/www/cordova.js b/tests/MobileSpecUnitTests/www/cordova.js
index 0c80545..772f3a5 100644
--- a/tests/MobileSpecUnitTests/www/cordova.js
+++ b/tests/MobileSpecUnitTests/www/cordova.js
@@ -12,8 +12,3 @@
window.history.go(-1);
}
}
-
-// extras and plugins
-
-// globalization.js
-document.write('<script type="text/javascript" charset="utf-8" src="' + cordovaPath.replace('cordova-' + VERSION + '.js', 'globalization.js') + '"></script>');
diff --git a/tests/MobileSpecUnitTests/www/globalization.js b/tests/MobileSpecUnitTests/www/globalization.js
deleted file mode 100644
index e593633..0000000
--- a/tests/MobileSpecUnitTests/www/globalization.js
+++ /dev/null
@@ -1,540 +0,0 @@
-var Globalization = function() {
-};
-
-Globalization.prototype.getPreferredLanguage = function(successCB, failureCB)
-{
- // successCallback required
- if (typeof successCB != "function") {
- console.log("Globalization.getPreferredLanguage Error: successCB is not a function");
- return;
- }
-
- // errorCallback required
- if (typeof failureCB != "function") {
- console.log("Globalization.getPreferredLanguage Error: failureCB is not a function");
- return;
- }
-
- cordova.exec(successCB, failureCB, "Globalization","getPreferredLanguage", []);
-};
-
-/**
-* Returns the string identifier for the client's current locale setting.
-* It returns the locale identifier string to the successCB callback with a
-* properties object as a parameter. If there is an error getting the locale,
-* then the errorCB callback is invoked.
-*
-* @param {Function} successCB
-* @param {Function} errorCB
-*
-* @return Object.value {String}: The locale identifier
-*
-* @error GlobalizationError.UNKNOWN_ERROR
-*
-* Example
-* globalization.getLocaleName(function (locale) {alert('locale:' + locale.value + '\n');},
-* function () {});
-*/
-Globalization.prototype.getLocaleName = function(successCB, failureCB)
-{
- // successCallback required
- if (typeof successCB != "function") {
- console.log("Globalization.getLocaleName Error: successCB is not a function");
- return;
- }
-
- // errorCallback required
- if (typeof failureCB != "function") {
- console.log("Globalization.getLocaleName Error: failureCB is not a function");
- return;
- }
- cordova.exec(successCB, failureCB, "Globalization","getLocaleName", []);
-};
-
-
-/**
-* Returns a date formatted as a string according to the client's user preferences and
-* calendar using the time zone of the client. It returns the formatted date string to the
-* successCB callback with a properties object as a parameter. If there is an error
-* formatting the date, then the errorCB callback is invoked.
-*
-* The defaults are: formatLenght="short" and selector="date and time"
-*
-* @param {Date} date
-* @param {Function} successCB
-* @param {Function} errorCB
-* @param {Object} options {optional}
-* formatLength {String}: 'short', 'medium', 'long', or 'full'
-* selector {String}: 'date', 'time', or 'date and time'
-*
-* @return Object.value {String}: The localized date string
-*
-* @error GlobalizationError.FORMATTING_ERROR
-*
-* Example
-* globalization.dateToString(new Date(),
-* function (date) {alert('date:' + date.value + '\n');},
-* function (errorCode) {alert(errorCode);},
-* {formatLength:'short'});
-*/
-Globalization.prototype.dateToString = function(date, successCB, failureCB, options)
-{
- // successCallback required
- if (typeof successCB != "function") {
- console.log("Globalization.dateToString Error: successCB is not a function");
- return;
- }
-
- // errorCallback required
- if (typeof failureCB != "function") {
- console.log("Globalization.dateToString Error: failureCB is not a function");
- return;
- }
-
-
- if (date instanceof Date){
- var dateValue;
- dateValue = date.valueOf();
- cordova.exec(successCB, failureCB, "Globalization", "dateToString", [{"date": dateValue, "options": options}]);
- }
- else {
- console.log("Globalization.dateToString Error: date is not a Date object");
- }
-};
-
-
-/**
-* Parses a date formatted as a string according to the client's user
-* preferences and calendar using the time zone of the client and returns
-* the corresponding date object. It returns the date to the successCB
-* callback with a properties object as a parameter. If there is an error
-* parsing the date string, then the errorCB callback is invoked.
-*
-* The defaults are: formatLength="short" and selector="date and time"
-*
-* @param {String} dateString
-* @param {Function} successCB
-* @param {Function} errorCB
-* @param {Object} options {optional}
-* formatLength {String}: 'short', 'medium', 'long', or 'full'
-* selector {String}: 'date', 'time', or 'date and time'
-*
-* @return Object.year {Number}: The four digit year
-* Object.month {Number}: The month from (0 - 11)
-* Object.day {Number}: The day from (1 - 31)
-* Object.hour {Number}: The hour from (0 - 23)
-* Object.minute {Number}: The minute from (0 - 59)
-* Object.second {Number}: The second from (0 - 59)
-* Object.millisecond {Number}: The milliseconds (from 0 - 999),
-* not available on all platforms
-*
-* @error GlobalizationError.PARSING_ERROR
-*
-* Example
-* globalization.stringToDate('4/11/2011',
-* function (date) { alert('Month:' + date.month + '\n' +
-* 'Day:' + date.day + '\n' +
-* 'Year:' + date.year + '\n');},
-* function (errorCode) {alert(errorCode);},
-* {selector:'date'});
-*/
-Globalization.prototype.stringToDate = function(dateString, successCB, failureCB, options)
-{
- // successCallback required
- if (typeof successCB != "function") {
- console.log("Globalization.stringToDate Error: successCB is not a function");
- return;
- }
-
- // errorCallback required
- if (typeof failureCB != "function") {
- console.log("Globalization.stringToDate Error: failureCB is not a function");
- return;
- }
- if (typeof dateString == "string"){
- cordova.exec(successCB, failureCB, "Globalization", "stringToDate", [{"dateString": dateString, "options": options}]);
- }
- else {
- console.log("Globalization.stringToDate Error: dateString is not a string");
- }
-};
-
-
-/**
-* Returns a pattern string for formatting and parsing dates according to the client's
-* user preferences. It returns the pattern to the successCB callback with a
-* properties object as a parameter. If there is an error obtaining the pattern,
-* then the errorCB callback is invoked.
-*
-* The defaults are: formatLength="short" and selector="date and time"
-*
-* @param {Function} successCB
-* @param {Function} errorCB
-* @param {Object} options {optional}
-* formatLength {String}: 'short', 'medium', 'long', or 'full'
-* selector {String}: 'date', 'time', or 'date and time'
-*
-* @return Object.pattern {String}: The date and time pattern for formatting and parsing dates.
-* The patterns follow Unicode Technical Standard #35
-* http://unicode.org/reports/tr35/tr35-4.html
-* Object.timezone {String}: The abbreviated name of the time zone on the client
-* Object.utc_offset {Number}: The current difference in seconds between the client's
-* time zone and coordinated universal time.
-* Object.dst_offset {Number}: The current daylight saving time offset in seconds
-* between the client's non-daylight saving's time zone
-* and the client's daylight saving's time zone.
-*
-* @error GlobalizationError.PATTERN_ERROR
-*
-* Example
-* globalization.getDatePattern(
-* function (date) {alert('pattern:' + date.pattern + '\n');},
-* function () {},
-* {formatLength:'short'});
-*/
-Globalization.prototype.getDatePattern = function(successCB, failureCB, options)
-{
- // successCallback required
- if (typeof successCB != "function") {
- console.log("Globalization.getDatePattern Error: successCB is not a function");
- return;
- }
-
- // errorCallback required
- if (typeof failureCB != "function") {
- console.log("Globalization.getDatePattern Error: failureCB is not a function");
- return;
- }
-
- cordova.exec(successCB, failureCB, "Globalization", "getDatePattern", [{"options": options}]);
-};
-
-
-/**
-* Returns an array of either the names of the months or days of the week
-* according to the client's user preferences and calendar. It returns the array of names to the
-* successCB callback with a properties object as a parameter. If there is an error obtaining the
-* names, then the errorCB callback is invoked.
-*
-* The defaults are: type="wide" and item="months"
-*
-* @param {Function} successCB
-* @param {Function} errorCB
-* @param {Object} options {optional}
-* type {String}: 'narrow' or 'wide'
-* item {String}: 'months', or 'days'
-*
-* @return Object.value {Array{String}}: The array of names starting from either
-* the first month in the year or the
-* first day of the week.
-* @error GlobalizationError.UNKNOWN_ERROR
-*
-* Example
-* globalization.getDateNames(function (names) {
-* for(var i = 0; i < names.value.length; i++) {
-* alert('Month:' + names.value[i] + '\n');}},
-* function () {});
-*/
-Globalization.prototype.getDateNames = function(successCB, failureCB, options)
-{
- // successCallback required
- if (typeof successCB != "function") {
- console.log("Globalization.getDateNames Error: successCB is not a function");
- return;
- }
-
- // errorCallback required
- if (typeof failureCB != "function") {
- console.log("Globalization.getDateNames Error: failureCB is not a function");
- return;
- }
- cordova.exec(successCB, failureCB, "Globalization", "getDateNames", [{"options": options}]);
-};
-
-/**
-* Returns whether daylight savings time is in effect for a given date using the client's
-* time zone and calendar. It returns whether or not daylight savings time is in effect
-* to the successCB callback with a properties object as a parameter. If there is an error
-* reading the date, then the errorCB callback is invoked.
-*
-* @param {Date} date
-* @param {Function} successCB
-* @param {Function} errorCB
-*
-* @return Object.dst {Boolean}: The value "true" indicates that daylight savings time is
-* in effect for the given date and "false" indicate that it is not.
-*
-* @error GlobalizationError.UNKNOWN_ERROR
-*
-* Example
-* globalization.isDayLightSavingsTime(new Date(),
-* function (date) {alert('dst:' + date.dst + '\n');}
-* function () {});
-*/
-Globalization.prototype.isDayLightSavingsTime = function(date, successCB, failureCB)
-{
- // successCallback required
- if (typeof successCB != "function") {
- console.log("Globalization.isDayLightSavingsTime Error: successCB is not a function");
- return;
- }
-
- // errorCallback required
- if (typeof failureCB != "function") {
- console.log("Globalization.isDayLightSavingsTime Error: failureCB is not a function");
- return;
- }
-
-
- if (date instanceof Date){
- var dateValue;
- dateValue = date.valueOf();
- cordova.exec(successCB, failureCB, "Globalization", "isDayLightSavingsTime", [{"date": dateValue}]);
- }
- else {
- console.log("Globalization.isDayLightSavingsTime Error: date is not a Date object");
- }
-
-};
-
-/**
-* Returns the first day of the week according to the client's user preferences and calendar.
-* The days of the week are numbered starting from 1 where 1 is considered to be Sunday.
-* It returns the day to the successCB callback with a properties object as a parameter.
-* If there is an error obtaining the pattern, then the errorCB callback is invoked.
-*
-* @param {Function} successCB
-* @param {Function} errorCB
-*
-* @return Object.value {Number}: The number of the first day of the week.
-*
-* @error GlobalizationError.UNKNOWN_ERROR
-*
-* Example
-* globalization.getFirstDayOfWeek(function (day)
-* { alert('Day:' + day.value + '\n');},
-* function () {});
-*/
-Globalization.prototype.getFirstDayOfWeek = function(successCB, failureCB)
-{
- // successCallback required
- if (typeof successCB != "function") {
- console.log("Globalization.getFirstDayOfWeek Error: successCB is not a function");
- return;
- }
-
- // errorCallback required
- if (typeof failureCB != "function") {
- console.log("Globalization.getFirstDayOfWeek Error: failureCB is not a function");
- return;
- }
-
- cordova.exec(successCB, failureCB, "Globalization", "getFirstDayOfWeek", []);
-};
-
-
-/**
-* Returns a number formatted as a string according to the client's user preferences.
-* It returns the formatted number string to the successCB callback with a properties object as a
-* parameter. If there is an error formatting the number, then the errorCB callback is invoked.
-*
-* The defaults are: type="decimal"
-*
-* @param {Number} number
-* @param {Function} successCB
-* @param {Function} errorCB
-* @param {Object} options {optional}
-* type {String}: 'decimal', "percent", or 'currency'
-*
-* @return Object.value {String}: The formatted number string.
-*
-* @error GlobalizationError.FORMATTING_ERROR
-*
-* Example
-* globalization.numberToString(3.25,
-* function (number) {alert('number:' + number.value + '\n');},
-* function () {},
-* {type:'decimal'});
-*/
-Globalization.prototype.numberToString = function(number, successCB, failureCB, options)
-{
- // successCallback required
- if (typeof successCB != "function") {
- console.log("Globalization.numberToString Error: successCB is not a function");
- return;
- }
-
- // errorCallback required
- if (typeof failureCB != "function") {
- console.log("Globalization.numberToString Error: failureCB is not a function");
- return;
- }
-
- if(typeof number == "number") {
- cordova.exec(successCB, failureCB, "Globalization", "numberToString", [{"number": number, "options": options}]);
- }
- else {
- console.log("Globalization.numberToString Error: number is not a number");
- }
-};
-
-/**
-* Parses a number formatted as a string according to the client's user preferences and
-* returns the corresponding number. It returns the number to the successCB callback with a
-* properties object as a parameter. If there is an error parsing the number string, then
-* the errorCB callback is invoked.
-*
-* The defaults are: type="decimal"
-*
-* @param {String} numberString
-* @param {Function} successCB
-* @param {Function} errorCB
-* @param {Object} options {optional}
-* type {String}: 'decimal', "percent", or 'currency'
-*
-* @return Object.value {Number}: The parsed number.
-*
-* @error GlobalizationError.PARSING_ERROR
-*
-* Example
-* globalization.stringToNumber('1234.56',
-* function (number) {alert('Number:' + number.value + '\n');},
-* function () { alert('Error parsing number');});
-*/
-Globalization.prototype.stringToNumber = function(numberString, successCB, failureCB, options)
-{
- // successCallback required
- if (typeof successCB != "function") {
- console.log("Globalization.stringToNumber Error: successCB is not a function");
- return;
- }
-
- // errorCallback required
- if (typeof failureCB != "function") {
- console.log("Globalization.stringToNumber Error: failureCB is not a function");
- return;
- }
-
- if(typeof numberString == "string") {
- cordova.exec(successCB, failureCB, "Globalization", "stringToNumber", [{"numberString": numberString, "options": options}]);
- }
- else {
- console.log("Globalization.stringToNumber Error: numberString is not a string");
- }
-};
-
-/**
-* Returns a pattern string for formatting and parsing numbers according to the client's user
-* preferences. It returns the pattern to the successCB callback with a properties object as a
-* parameter. If there is an error obtaining the pattern, then the errorCB callback is invoked.
-*
-* The defaults are: type="decimal"
-*
-* @param {Function} successCB
-* @param {Function} errorCB
-* @param {Object} options {optional}
-* type {String}: 'decimal', "percent", or 'currency'
-*
-* @return Object.pattern {String}: The number pattern for formatting and parsing numbers.
-* The patterns follow Unicode Technical Standard #35.
-* http://unicode.org/reports/tr35/tr35-4.html
-* Object.symbol {String}: The symbol to be used when formatting and parsing
-* e.g., percent or currency symbol.
-* Object.fraction {Number}: The number of fractional digits to use when parsing and
-* formatting numbers.
-* Object.rounding {Number}: The rounding increment to use when parsing and formatting.
-* Object.positive {String}: The symbol to use for positive numbers when parsing and formatting.
-* Object.negative: {String}: The symbol to use for negative numbers when parsing and formatting.
-* Object.decimal: {String}: The decimal symbol to use for parsing and formatting.
-* Object.grouping: {String}: The grouping symbol to use for parsing and formatting.
-*
-* @error GlobalizationError.PATTERN_ERROR
-*
-* Example
-* globalization.getNumberPattern(
-* function (pattern) {alert('Pattern:' + pattern.pattern + '\n');},
-* function () {});
-*/
-Globalization.prototype.getNumberPattern = function(successCB, failureCB, options)
-{
- // successCallback required
- if (typeof successCB != "function") {
- console.log("Globalization.getNumberPattern Error: successCB is not a function");
- return;
- }
-
- // errorCallback required
- if (typeof failureCB != "function") {
- console.log("Globalization.getNumberPattern Error: failureCB is not a function");
- return;
- }
-
- cordova.exec(successCB, failureCB, "Globalization", "getNumberPattern", [{"options": options}]);
-};
-
-/**
-* Returns a pattern string for formatting and parsing currency values according to the client's
-* user preferences and ISO 4217 currency code. It returns the pattern to the successCB callback with a
-* properties object as a parameter. If there is an error obtaining the pattern, then the errorCB
-* callback is invoked.
-*
-* @param {String} currencyCode
-* @param {Function} successCB
-* @param {Function} errorCB
-*
-* @return Object.pattern {String}: The currency pattern for formatting and parsing currency values.
-* The patterns follow Unicode Technical Standard #35
-* http://unicode.org/reports/tr35/tr35-4.html
-* Object.code {String}: The ISO 4217 currency code for the pattern.
-* Object.fraction {Number}: The number of fractional digits to use when parsing and
-* formatting currency.
-* Object.rounding {Number}: The rounding increment to use when parsing and formatting.
-* Object.decimal: {String}: The decimal symbol to use for parsing and formatting.
-* Object.grouping: {String}: The grouping symbol to use for parsing and formatting.
-*
-* @error GlobalizationError.FORMATTING_ERROR
-*
-* Example
-* globalization.getCurrencyPattern('EUR',
-* function (currency) {alert('Pattern:' + currency.pattern + '\n');}
-* function () {});
-*/
-Globalization.prototype.getCurrencyPattern = function(currencyCode, successCB, failureCB)
-{
- // successCallback required
- if (typeof successCB != "function") {
- console.log("Globalization.getCurrencyPattern Error: successCB is not a function");
- return;
- }
-
- // errorCallback required
- if (typeof failureCB != "function") {
- console.log("Globalization.getCurrencyPattern Error: failureCB is not a function");
- return;
- }
-
- if(typeof currencyCode == "string") {
- cordova.exec(successCB, failureCB, "Globalization", "getCurrencyPattern", [{"currencyCode": currencyCode}]);
- }
- else {
- console.log("Globalization.getCurrencyPattern Error: currencyCode is not a currency code");
- }
-};
-
-GlobalizationError = function() {
- this.code = null;
-}
-
-// Globalization error codes
-GlobalizationError.UNKNOWN_ERROR = 0;
-GlobalizationError.FORMATTING_ERROR = 1;
-GlobalizationError.PARSING_ERROR = 2;
-GlobalizationError.PATTERN_ERROR = 3;
-
-
-if(!window.plugins) {
- window.plugins = {};
-}
-if (!window.plugins.globalization) {
- window.plugins.globalization = new Globalization();
-}