Skip to content

Commit

Permalink
Merge branch 'develop' into feature/getVariableCategoryName
Browse files Browse the repository at this point in the history
  • Loading branch information
mikepsinn authored May 30, 2020
2 parents 50b1e06 + e7a86c4 commit c1e056f
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 0 deletions.
46 changes: 46 additions & 0 deletions src/js/qmHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ var qm = {
var result = qm.urlHelper.indexOfCurrentUrl("medimodo.heroku") !== -1;
return result;
},
isTestingOrDevelopment: function(){
return qm.appMode.isTesting() || qm.appMode.isDevelopment();
},
isDevelopment: function(){
if(qm.appMode.mode === 'development'){
return true;
Expand Down Expand Up @@ -3604,6 +3607,17 @@ var qm = {
}else{
qm.apiHelper.getParameterDescription(parameterOrPropertyName, callback)
}
},
goToHelpSite: function(){
qm.urlHelper.goToUrl("https://help.quantimo.do")
},
openDrift: function(){
if(typeof drift === "undefined"){
qm.qmLog.error("drift not defined!");
qm.help.goToHelpSite();
} else {
qm.chatButton.openDriftSidebar();
}
}
},
imageHelper: {
Expand Down Expand Up @@ -8425,6 +8439,35 @@ var qm = {
}
},
toast: {
errorAlert: function(errorMessage, callback){
var Toast = Swal.mixin({
toast: true,
icon: "error",
position: 'top-end',
confirmButtonText: "Need help?",
cancelButtonText: "OK",
showConfirmButton: true,
showCloseButton: true,
timer: 5000,
timerProgressBar: true,
onOpen: (toast) => {
toast.addEventListener('mouseenter', Swal.stopTimer)
toast.addEventListener('mouseleave', Swal.resumeTimer)
}
})
Toast.fire({
icon: 'error',
title: errorMessage
}).then(function(result){
if (result.value) {
if(callback){
callback(result);
} else {
qm.help.openDrift();
}
}
})
},
showQuestionToast: function(question, successMessage, callback){
var Toast = Swal.mixin({
toast: true,
Expand Down Expand Up @@ -10173,6 +10216,9 @@ var qm = {
qmLog: function(){
return qm.qmLog;
},
sweetAlert() {

}
};
if(typeof qmLog !== "undefined"){
qm.qmLog = qmLog;
Expand Down
3 changes: 3 additions & 0 deletions src/js/qmLogger.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,9 @@ var qmLog = {
if(qmLog.color){
consoleMessage = qmLog.color.red(consoleMessage);
}
if(qm.appMode.isTestingOrDevelopment()){
qm.toast.errorAlert(consoleMessage);
}
console.error(consoleMessage, errorSpecificMetaData);
qmLog.globalMetaData = qmLog.addGlobalMetaDataAndLog(qmLog.name, qmLog.message, errorSpecificMetaData, qmLog.stackTrace);
qmLog.bugsnagNotify(qmLog.name, qmLog.message, errorSpecificMetaData, "error", qmLog.stackTrace);
Expand Down
25 changes: 25 additions & 0 deletions src/modals/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Modal Demos</title>
<link href="https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@sweetalert2/theme-borderless@3/borderless.css">
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@9/dist/sweetalert2.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js" defer></script>
<script src="https://cdn.jsdelivr.net/gh/alpinejs/[email protected]/dist/alpine.min.js" defer></script>
<script src="../../lib/quantimodo/quantimodo-web.js"></script>
<script src="../js/ionIcons.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="../js/qmChrome.js"></script>
</head>
<body>
<button id="popup-button">Popup</button>
<button id="full-inbox-button">Full Inbox</button>
<button id="compact-inbox-button">Compact Inbox</button>
<script src="modals.js" defer></script>
</body>
</html>
21 changes: 21 additions & 0 deletions src/modals/modals.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
$(document).ready(function () {
function swalIframeOptions(path){
return {
showCancelButton: true,
showConfirmButton: false,
html: '<iframe width="100%" height="300" src="//web.quantimo.do/'+path+'" frameborder="0"></iframe>'
}
}
function fireIframe(path){
Swal.fire(swalIframeOptions(path));
}
$('#popup-button').click(() => {
fireIframe('android_popup.html')
});
$('#full-inbox-button').click(() => {
fireIframe('#/app/reminders-inbox')
});
$('#compact-inbox-button').click(() => {
fireIframe('#/app/reminders-inbox-compact')
});
});

2 comments on commit c1e056f

@mikepsinn
Copy link
Contributor Author

Choose a reason for hiding this comment

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

View recording of ionic_variables_spec.js
Cypress Dashboard

ionic_variables-ionic

BUILD LOG

@mikepsinn
Copy link
Contributor Author

Choose a reason for hiding this comment

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

View recording of ionic_studies_spec.js
Cypress Dashboard

ionic_studies-ionic

BUILD LOG

Please sign in to comment.