@@ -134,7 +134,7 @@ var paths = {
134
134
firebase : "src/lib/firebase/**/*" ,
135
135
js : "src/js/*.js" ,
136
136
serviceWorker : "src/firebase-messaging-sw.js" ,
137
- staticData : ' src/data/qmStaticData.js' ,
137
+ data : " src/data" ,
138
138
} ,
139
139
www : {
140
140
devCredentials : "www/dev-credentials.json" ,
@@ -143,7 +143,7 @@ var paths = {
143
143
firebase : "www/lib/firebase/" ,
144
144
js : "www/js/" ,
145
145
scripts : "www/scripts" ,
146
- staticData : 'src /data/qmStaticData.js' ,
146
+ data : "www /data" ,
147
147
} ,
148
148
chcpLogin : '.chcplogin' ,
149
149
} ;
@@ -1100,6 +1100,8 @@ function postAppStatus() {
1100
1100
return makeApiRequest ( options ) ;
1101
1101
}
1102
1102
function makeApiRequest ( options , successHandler ) {
1103
+ options . headers . XDEBUG_SESSION_START = "PHPSTORM" ;
1104
+ options . qs . XDEBUG_SESSION_START = "PHPSTORM" ;
1103
1105
var rp = require ( 'request-promise' ) ;
1104
1106
qmLog . info ( 'Making request to ' + options . uri + ' with clientId: ' + QUANTIMODO_CLIENT_ID ) ;
1105
1107
qmLog . debug ( options . uri , options , 280 ) ;
@@ -1128,9 +1130,13 @@ function postNotifyCollaborators(appType) {
1128
1130
function getRequestOptions ( path ) {
1129
1131
var options = {
1130
1132
uri : qmGulp . getAppHostName ( ) + path ,
1131
- qs : { clientId : QUANTIMODO_CLIENT_ID , includeClientSecret : true , allStaticAppData : true } ,
1133
+ qs : {
1134
+ clientId : QUANTIMODO_CLIENT_ID ,
1135
+ includeClientSecret : false ,
1136
+ allStaticAppData : true ,
1137
+ } ,
1132
1138
headers : { 'User-Agent' : 'Request-Promise' , 'Content-Type' : 'application/json' } ,
1133
- json : true // Automatically parses the JSON string in the response
1139
+ json : true , // Automatically parses the JSON string in the response
1134
1140
} ;
1135
1141
if ( process . env . QUANTIMODO_ACCESS_TOKEN ) {
1136
1142
options . qs . access_token = process . env . QUANTIMODO_ACCESS_TOKEN ;
@@ -1278,7 +1284,7 @@ function generateConfigXmlFromTemplate(callback) {
1278
1284
if ( parsedXmlFile . widget . chcp ) { parsedXmlFile . widget . chcp [ 0 ] [ 'config-file' ] = [ { '$' : { "url" : qmGulp . chcp . getChcpJsonUrl ( ) } } ] ; }
1279
1285
writeToXmlFile ( './config.xml' , parsedXmlFile , callback ) ;
1280
1286
qmGulp . staticData . configXml = parsedXmlFile ;
1281
- writeStaticDataFile ( ) ;
1287
+ writeAppSettingsFile ( ) ;
1282
1288
}
1283
1289
} ) ;
1284
1290
}
@@ -1401,7 +1407,15 @@ var chromeScripts = [
1401
1407
'lib/quantimodo/quantimodo-web.js' ,
1402
1408
'js/qmLogger.js' ,
1403
1409
'js/qmHelpers.js' ,
1404
- 'data/qmStaticData.js' , // Must come after qmHelpers because we assign to qm.staticData
1410
+ 'data/appSettings.js' , // Must come after qmHelpers because we assign to qm.staticData
1411
+ 'data/qmStates.js' ,
1412
+ 'data/stateNames.js' ,
1413
+ 'data/buildInfo.js' ,
1414
+ 'data/units.js' ,
1415
+ 'data/variableCategories.js' ,
1416
+ 'data/commonVariables.js' ,
1417
+ 'data/docs.js' ,
1418
+ 'data/dialogAgent.js' ,
1405
1419
'lib/underscore/underscore-min.js' ,
1406
1420
] ;
1407
1421
//if(qmGit.accessToken){chromeScripts.push('qm-amazon/qmUrlUpdater.js');}
@@ -1773,26 +1787,46 @@ gulp.task('downloadSwaggerJson', [], function () {
1773
1787
// .pipe(gulp.dest("src/data/"));
1774
1788
return getConstantsFromApiAndWriteToJson ( 'docs' , url ) ;
1775
1789
} ) ;
1776
- function writeStaticDataFile ( ) {
1790
+ function writeBuildInfoFile ( ) {
1791
+ var as = qmGulp . buildInfoHelper . getCurrentBuildInfo ( ) ;
1792
+ var string =
1793
+ 'if(typeof qm === "undefined"){if(typeof window === "undefined") {global.qm = {}; }else{window.qm = {};}}\n' +
1794
+ 'if(typeof qm.staticData === "undefined"){qm.staticData = {};}\n' +
1795
+ 'qm.staticData.buildInfo =' + qmLog . prettyJSONStringify ( as ) ;
1796
+ try {
1797
+ writeToFile ( paths . www . data + "/buildInfo.js" , string ) ;
1798
+ } catch ( e ) {
1799
+ qmLog . error ( e . message + ". Maybe www/data doesn't exist but it might be resolved when we copy from src" ) ;
1800
+ }
1801
+ try {
1802
+ writeToFile ( 'build/chrome_extension/data/buildInfo.js' , string ) ;
1803
+ } catch ( e ) {
1804
+ qmLog . error ( e . message + ". Maybe build/chrome_extension/data doesn't exist but it might be resolved when we copy from src" ) ;
1805
+ }
1806
+ return writeToFile ( paths . src . data + "/buildInfo.js" , string ) ;
1807
+ }
1808
+ function writeAppSettingsFile ( ) {
1777
1809
qmGulp . staticData . buildInfo = qmGulp . buildInfoHelper . getCurrentBuildInfo ( ) ;
1778
- var string = 'var staticData = ' + qmLog . prettyJSONStringify ( qmGulp . staticData ) +
1779
- '; if(typeof window !== "undefined"){window.qm.staticData = staticData;} ' +
1780
- ' else if(typeof qm !== "undefined"){qm.staticData = staticData;} else {module.exports = staticData;} ' +
1781
- 'if(typeof qm !== "undefined"){qm.stateNames = staticData.stateNames;}' ;
1810
+ var as = qmGulp . getAppSettings ( ) ;
1811
+ var string =
1812
+ 'if(typeof qm === "undefined"){if(typeof window === "undefined") {global.qm = {}; }else{window.qm = {};}}\n' +
1813
+ 'if(typeof qm.staticData === "undefined"){qm.staticData = {};}\n' +
1814
+ 'qm.staticData.appSettings =' + qmLog . prettyJSONStringify ( as ) ;
1782
1815
try {
1783
- writeToFile ( paths . www . staticData , string ) ;
1816
+ writeToFile ( paths . www . data + "/appSettings.js" , string ) ;
1784
1817
} catch ( e ) {
1785
1818
qmLog . error ( e . message + ". Maybe www/data doesn't exist but it might be resolved when we copy from src" ) ;
1786
1819
}
1787
1820
try {
1788
- writeToFile ( 'build/chrome_extension/data/qmStaticData .js' , string ) ;
1821
+ writeToFile ( 'build/chrome_extension/data/appSettings .js' , string ) ;
1789
1822
} catch ( e ) {
1790
1823
qmLog . error ( e . message + ". Maybe build/chrome_extension/data doesn't exist but it might be resolved when we copy from src" ) ;
1791
1824
}
1792
- return writeToFile ( paths . src . staticData , string ) ;
1825
+ return writeToFile ( paths . src . data + "/appSettings.js" , string ) ;
1793
1826
}
1794
1827
gulp . task ( 'staticDataFile' , [ 'getAppConfigs' ] , function ( ) {
1795
- return writeStaticDataFile ( ) ;
1828
+ writeBuildInfoFile ( ) ;
1829
+ return writeAppSettingsFile ( ) ;
1796
1830
} ) ;
1797
1831
function getConstantsFromApiAndWriteToJson ( type , urlPath ) {
1798
1832
var jeditor = require ( 'gulp-json-editor' ) ;
0 commit comments