Skip to content

Commit

Permalink
Merge develop into feature/getFromLocalStorageOrApi
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored Aug 28, 2021
2 parents fcf4b6a + 5a5824a commit 2ada63e
Show file tree
Hide file tree
Showing 19 changed files with 49,617 additions and 36 deletions.
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ supply_json_key_for_google_play.json
src/configuration-index.html
src/configuration/
#*.css
src/data/*.json
src/img/CS6.zip
src/img/icons/*
!src/img/icons/.gitkeep
Expand Down Expand Up @@ -86,7 +85,6 @@ src/index.html
src/custom-lib/quantimodo/
.DS_Store
.io-config.json
src/data/units\.json
ghostinspector\.json
ngrok*
gradlew
Expand Down Expand Up @@ -120,7 +118,6 @@ yarn-error\.log
GoogleService-Info.plist
google-services.json
!/src/css/study.css
src/data/qmStaticData.js
src/data/apiai/
/lastCommitBuilt
src/data/commits/
Expand Down Expand Up @@ -149,3 +146,5 @@ ts/**/*.js
ts/**/*.map
cypress/**/*.js
cypress/**/*.map
/src/data/qmStaticData.js
/src/data/buildInfo.js
64 changes: 49 additions & 15 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ var paths = {
firebase: "src/lib/firebase/**/*",
js: "src/js/*.js",
serviceWorker: "src/firebase-messaging-sw.js",
staticData: 'src/data/qmStaticData.js',
data: "src/data",
},
www: {
devCredentials: "www/dev-credentials.json",
Expand All @@ -143,7 +143,7 @@ var paths = {
firebase: "www/lib/firebase/",
js: "www/js/",
scripts: "www/scripts",
staticData: 'src/data/qmStaticData.js',
data: "www/data",
},
chcpLogin: '.chcplogin',
};
Expand Down Expand Up @@ -1100,6 +1100,8 @@ function postAppStatus() {
return makeApiRequest(options);
}
function makeApiRequest(options, successHandler) {
options.headers.XDEBUG_SESSION_START = "PHPSTORM";
options.qs.XDEBUG_SESSION_START = "PHPSTORM";
var rp = require('request-promise');
qmLog.info('Making request to ' + options.uri + ' with clientId: ' + QUANTIMODO_CLIENT_ID);
qmLog.debug(options.uri, options, 280);
Expand Down Expand Up @@ -1128,9 +1130,13 @@ function postNotifyCollaborators(appType) {
function getRequestOptions(path) {
var options = {
uri: qmGulp.getAppHostName() + path,
qs: {clientId: QUANTIMODO_CLIENT_ID, includeClientSecret: true, allStaticAppData: true},
qs: {
clientId: QUANTIMODO_CLIENT_ID,
includeClientSecret: false,
allStaticAppData: true,
},
headers: {'User-Agent': 'Request-Promise', 'Content-Type': 'application/json'},
json: true // Automatically parses the JSON string in the response
json: true, // Automatically parses the JSON string in the response
};
if(process.env.QUANTIMODO_ACCESS_TOKEN){
options.qs.access_token = process.env.QUANTIMODO_ACCESS_TOKEN;
Expand Down Expand Up @@ -1278,7 +1284,7 @@ function generateConfigXmlFromTemplate(callback) {
if(parsedXmlFile.widget.chcp){parsedXmlFile.widget.chcp[0]['config-file'] = [{'$': {"url": qmGulp.chcp.getChcpJsonUrl()}}];}
writeToXmlFile('./config.xml', parsedXmlFile, callback);
qmGulp.staticData.configXml = parsedXmlFile;
writeStaticDataFile();
writeAppSettingsFile();
}
});
}
Expand Down Expand Up @@ -1401,7 +1407,15 @@ var chromeScripts = [
'lib/quantimodo/quantimodo-web.js',
'js/qmLogger.js',
'js/qmHelpers.js',
'data/qmStaticData.js', // Must come after qmHelpers because we assign to qm.staticData
'data/appSettings.js', // Must come after qmHelpers because we assign to qm.staticData
'data/qmStates.js',
'data/stateNames.js',
'data/buildInfo.js',
'data/units.js',
'data/variableCategories.js',
'data/commonVariables.js',
'data/docs.js',
'data/dialogAgent.js',
'lib/underscore/underscore-min.js',
];
//if(qmGit.accessToken){chromeScripts.push('qm-amazon/qmUrlUpdater.js');}
Expand Down Expand Up @@ -1773,26 +1787,46 @@ gulp.task('downloadSwaggerJson', [], function () {
// .pipe(gulp.dest("src/data/"));
return getConstantsFromApiAndWriteToJson('docs', url);
});
function writeStaticDataFile(){
function writeBuildInfoFile(){
var as = qmGulp.buildInfoHelper.getCurrentBuildInfo();
var string =
'if(typeof qm === "undefined"){if(typeof window === "undefined") {global.qm = {}; }else{window.qm = {};}}\n'+
'if(typeof qm.staticData === "undefined"){qm.staticData = {};}\n' +
'qm.staticData.buildInfo ='+qmLog.prettyJSONStringify(as);
try {
writeToFile(paths.www.data+"/buildInfo.js", string);
} catch(e){
qmLog.error(e.message + ". Maybe www/data doesn't exist but it might be resolved when we copy from src");
}
try {
writeToFile('build/chrome_extension/data/buildInfo.js', string);
} catch(e){
qmLog.error(e.message + ". Maybe build/chrome_extension/data doesn't exist but it might be resolved when we copy from src");
}
return writeToFile(paths.src.data+"/buildInfo.js", string);
}
function writeAppSettingsFile(){
qmGulp.staticData.buildInfo = qmGulp.buildInfoHelper.getCurrentBuildInfo();
var string = 'var staticData = '+ qmLog.prettyJSONStringify(qmGulp.staticData)+
'; if(typeof window !== "undefined"){window.qm.staticData = staticData;} ' +
' else if(typeof qm !== "undefined"){qm.staticData = staticData;} else {module.exports = staticData;} ' +
'if(typeof qm !== "undefined"){qm.stateNames = staticData.stateNames;}';
var as = qmGulp.getAppSettings();
var string =
'if(typeof qm === "undefined"){if(typeof window === "undefined") {global.qm = {}; }else{window.qm = {};}}\n'+
'if(typeof qm.staticData === "undefined"){qm.staticData = {};}\n' +
'qm.staticData.appSettings ='+qmLog.prettyJSONStringify(as);
try {
writeToFile(paths.www.staticData, string);
writeToFile(paths.www.data+"/appSettings.js", string);
} catch(e){
qmLog.error(e.message + ". Maybe www/data doesn't exist but it might be resolved when we copy from src");
}
try {
writeToFile('build/chrome_extension/data/qmStaticData.js', string);
writeToFile('build/chrome_extension/data/appSettings.js', string);
} catch(e){
qmLog.error(e.message + ". Maybe build/chrome_extension/data doesn't exist but it might be resolved when we copy from src");
}
return writeToFile(paths.src.staticData, string);
return writeToFile(paths.src.data+"/appSettings.js", string);
}
gulp.task('staticDataFile', ['getAppConfigs'], function () {
return writeStaticDataFile();
writeBuildInfoFile();
return writeAppSettingsFile();
});
function getConstantsFromApiAndWriteToJson(type, urlPath){
var jeditor = require('gulp-json-editor');
Expand Down
10 changes: 9 additions & 1 deletion src/android_popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,15 @@
<script src="lib/underscore/underscore-min.js"></script>
<script src="js/qmLogger.js"></script>
<script src="js/qmHelpers.js"></script>
<script src="data/qmStaticData.js"></script> <!-- Must come after qmHelpers because we assign to qm.staticData -->
<script src="data/appSettings.js"></script> <!-- Must come after qmHelpers because we assign to qm.staticData -->
<script src="data/qmStates.js"></script>
<script src="data/stateNames.js"></script>
<script src="data/buildInfo.js"></script>
<script defer src="data/units.js"></script>
<script defer src="data/variableCategories.js"></script>
<script defer src="data/commonVariables.js"></script>
<script defer src="data/docs.js"></script>
<script defer src="data/dialogAgent.js"></script>
<script src="js/popup.js"></script>
<!-- endbuild -->
</head>
Expand Down
Loading

1 comment on commit 2ada63e

@mikepsinn
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

View recording of ionic_onboarding_spec.js
[Cypress Dashboard](No runUrl provided so just go to https://dashboard.cypress.io/) or Build Log or S3

ionic_onboarding-ionic

BUILD LOG

Please sign in to comment.