diff --git a/gulp/tasks/write-config.js b/gulp/tasks/write-config.js
index c8997c99b..6ada41df2 100644
--- a/gulp/tasks/write-config.js
+++ b/gulp/tasks/write-config.js
@@ -29,6 +29,7 @@ var writeFile = function(fileName, content) {
gulp.task('write-config-prod', function() {
var mainFileName = paths.tmp + '/build-config.json',
content = {
+ type: 'production',
preloadedApps: helpers.getAppsToInclude()
};
@@ -42,6 +43,7 @@ gulp.task('write-config-prod', function() {
gulp.task('write-config-dev', function() {
var fileName = paths.tmp + '/build-config.json',
content = {
+ type: 'development',
preloadedApps: []
};
diff --git a/src/apps/core/app.js b/src/apps/core/app.js
index 808977f3d..21fdd6bd3 100644
--- a/src/apps/core/app.js
+++ b/src/apps/core/app.js
@@ -469,14 +469,25 @@ define(function(require){
callback && callback();
},
- displayVersion: function(container) {
- var self = this;
+ /* Had to update that code because mainTemplate is no longer the main container, it's an array of divs, where one of them is the core-footer,
+ so we look through that array and once we found it we add the version */
+ displayVersion: function(mainTemplate) {
+ var self = this,
+ version = monster.util.getVersion(),
+ container,
+ $potentialContainer;
- monster.getVersion(function(version) {
- container.find('.core-footer .tag-version').html('('+version+')');
+ _.each(mainTemplate, function(potentialContainer) {
+ $potentialContainer = $(potentialContainer);
- monster.config.version = version;
+ if($potentialContainer.hasClass('core-footer')) {
+ container = $potentialContainer;
+ }
});
+
+ if(container) {
+ container.find('.tag-version').html('('+version+')');
+ }
},
displayLogo: function(container) {
@@ -673,7 +684,7 @@ define(function(require){
account: acc,
authToken: self.getAuthToken(),
apiUrl: self.apiUrl,
- version: monster.config.version,
+ version: monster.util.getVersion(),
hideApiUrl: monster.util.isWhitelabeling() && !monster.util.isSuperDuper()
},
template = monster.template(self, 'dialog-accountInfo', dataTemplate);
diff --git a/src/js/lib/monster.apps.js b/src/js/lib/monster.apps.js
index 16f515000..c9c36e268 100644
--- a/src/js/lib/monster.apps.js
+++ b/src/js/lib/monster.apps.js
@@ -281,7 +281,7 @@ define(function(){
authToken: params.authToken || app.getAuthToken(),
apiRoot: params.apiUrl || app.apiUrl,
uiMetadata: {
- version: monster.config.version,
+ version: monster.util.getVersion(),
ui: 'monster-ui',
origin: app.name
},
@@ -585,7 +585,7 @@ define(function(){
monster.pub('monster.requestStart');
$.ajax({
- url: app.appPath + '/i18n/' + language + '.json',
+ url: monster.util.cacheUrl(app.appPath + '/i18n/' + language + '.json'),
dataType: 'json',
async: false,
success: function(data){
diff --git a/src/js/lib/monster.js b/src/js/lib/monster.js
index 2db3d64fa..09ea867ef 100644
--- a/src/js/lib/monster.js
+++ b/src/js/lib/monster.js
@@ -179,7 +179,7 @@ define(function(require){
if(!data.hasOwnProperty('removeMetadataAPI') || data.removeMetadataAPI === false) {
payload.data.ui_metadata = {
- version: monster.config.version,
+ version: monster.util.getVersion(),
ui: 'monster-ui'
};
}
@@ -216,7 +216,7 @@ define(function(require){
}, config),
css: function(href){
- $('', { rel: 'stylesheet', href: href }).appendTo('head');
+ $('', { rel: 'stylesheet', href: monster.util.cacheUrl(href) }).appendTo('head');
},
domain: function(){
@@ -397,34 +397,46 @@ define(function(require){
next && next();
},
- getVersion: function(callback) {
- $.ajax({
- url: 'VERSION',
- cache: false,
- success: function(version) {
- version = version.replace(/\n.*/g,'')
- .trim();
-
- callback(version);
- }
- });
- },
-
- loadBuildConfig: function(callback) {
- $.ajax({
- url: 'build-config.json',
- dataType: 'json',
- cache: false,
- success: function(config) {
- monster.config.developerFlags.build = config;
+ loadBuildConfig: function(globalCallback) {
+ var self = this;
- callback();
+ monster.parallel({
+ version: function(callback) {
+ $.ajax({
+ url: 'VERSION',
+ cache: false,
+ success: function(version) {
+ version = version.replace(/\n.*/g,'')
+ .trim();
+
+ callback(null, version);
+ },
+ error: function() {
+ callback(null, null);
+ }
+ });
+ },
+ buildFile: function(callback) {
+ $.ajax({
+ url: 'build-config.json',
+ dataType: 'json',
+ cache: false,
+ success: function(config) {
+ callback(null, config);
+ },
+ error: function() {
+ callback(null, {});
+ }
+ });
+ }
},
- error: function() {
- monster.config.developerFlags.build = monster.config.developerFlags.build || {};
- callback();
+ function(err, results) {
+ monster.config.developerFlags.build = results.buildFile;
+ monster.config.developerFlags.build.version = results.version;
+
+ globalCallback && globalCallback(monster.config.developerFlags.build);
}
- });
+ );
},
getScript: function(url, callback) {
diff --git a/src/js/lib/monster.util.js b/src/js/lib/monster.util.js
index a053a308f..abd0e5486 100644
--- a/src/js/lib/monster.util.js
+++ b/src/js/lib/monster.util.js
@@ -1020,6 +1020,31 @@ define(function(require){
return authToken;
},
+ getVersion: function(callback) {
+ return monster.config.developerFlags.build.version;
+ },
+
+ cacheUrl: function(url) {
+ var self = this;
+
+ return url;
+
+ /* Commenting this as we don't want to add this just yet. We have issues with this code because versions from apps != versions in VERSION
+ If we were to use this, and just updated monster-ui-voip, the VERSION file wouldn't change, which means we wouldn't change the query sting used to get assets from any app, even monster-ui-voip...
+ This only gets incremented when master build runs, whereas we need it to be changed when an app is built as well...
+ Leaving this here for now, might have to just remove and forget about it eventually :/
+
+ var self = this,
+ prepend = url.indexOf('?') >= 0 ? '&' : '?',
+ isDev = monster.config.developerFlags.build.type === 'development',
+ devCacheString = (new Date()).getTime(),
+ prodCacheString = monster.util.getVersion(),
+ cacheString = prepend + '_=' + (isDev ? devCacheString : prodCacheString),
+ finalString = url + cacheString;
+
+ return finalString;*/
+ },
+
dataFlags: {
get: function(flagName, object) {
object.markers = object.markers || {};
diff --git a/src/js/templates.js b/src/js/templates.js
index b390b765e..982e22227 100644
--- a/src/js/templates.js
+++ b/src/js/templates.js
@@ -21,7 +21,7 @@ Handlebars.getTemplate = function(app, name, ignoreCache) {
monster.pub('monster.requestStart');
$.ajax({
- url: app.appPath + '/views/' + name + '.html',
+ url: monster.util.cacheUrl(app.appPath + '/views/' + name + '.html'),
dataType: 'text',
async: false,
success: function(result){