mirror of
https://github.com/pebble-dev/clay.git
synced 2026-09-02 23:27:38 -04:00
Change the behavior so that type conversions only run inside of Clay.getSettings no ClayConfig.getSettings
This commit is contained in:
@@ -3,7 +3,8 @@
|
||||
var configPageHtml = require('./tmp/config-page.html');
|
||||
var toSource = require('tosource');
|
||||
var standardComponents = require('./src/scripts/components');
|
||||
|
||||
var utils = require('./src/scripts/lib/utils');
|
||||
var _ = require('./src/scripts/vendor/minified')._;
|
||||
/**
|
||||
* @param {Array} config - the Clay config
|
||||
* @param {function} [customFn] - Custom code to run from the config page. Will run
|
||||
@@ -149,9 +150,10 @@ Clay.prototype.generateUrl = function() {
|
||||
/**
|
||||
* Parse the response from the webviewclosed event data
|
||||
* @param {string} response
|
||||
* @param {boolean} [convert=true]
|
||||
* @returns {Object}
|
||||
*/
|
||||
Clay.prototype.getSettings = function(response) {
|
||||
Clay.prototype.getSettings = function(response, convert) {
|
||||
// Decode and parse config data as JSON
|
||||
var settings = {};
|
||||
|
||||
@@ -162,7 +164,14 @@ Clay.prototype.getSettings = function(response) {
|
||||
}
|
||||
|
||||
localStorage.setItem('clay-settings', JSON.stringify(settings));
|
||||
return settings;
|
||||
|
||||
if (convert === false) {
|
||||
return settings;
|
||||
} else {
|
||||
return _.mapObj(settings, function(key, value) {
|
||||
return utils.prepareForAppMessage(value);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user