diff --git a/Glance/app/index.js b/Glance/app/index.js
index 33c147bc..3fb27324 100644
--- a/Glance/app/index.js
+++ b/Glance/app/index.js
@@ -258,41 +258,52 @@ inbox.onnewfile = () => {
document.getElementById("bg").style.fill="white"
// High || Low alert
-
+ // data.BGD[count].sgv = 50
+ // data.BGD[count].delta = -4
let sgv = data.BGD[count].sgv;
if( data.BGD[CONST_COUNT].units_hint == 'mmol' ){
sgv = mmol(sgv)
}
-
- if( sgv >= data.settings.highThreshold) {
- if((data.BGD[count].delta > 0)){
- console.log('BG HIGH')
- startVibration("nudge", 3000, sgv)
- document.getElementById("bg").style.fill="#e2574c"
- } else {
- console.log('BG still HIGH, But you are going down')
- showAlertModal = true;
- }
- }
-
- if(sgv <= data.settings.lowThreshold) {
- if((data.BGD[count].delta < 0)){
- console.log('BG LOW')
-
+ if(!(data.settings.disableAlert)) {
+ if( sgv >= data.settings.highThreshold) {
+ if((data.BGD[count].delta > 0)){
+ console.log('BG HIGH')
startVibration("nudge", 3000, sgv)
document.getElementById("bg").style.fill="#e2574c"
- } else {
- console.log('BG still LOW, But you are going UP')
- showAlertModal = true;
+ } else {
+ console.log('BG still HIGH, But you are going down')
+ showAlertModal = true;
+ }
+ }
+
+ if(sgv <= data.settings.lowThreshold) {
+ if((data.BGD[count].delta < 0)){
+ console.log('BG LOW')
+
+ startVibration("nudge", 3000, sgv)
+ document.getElementById("bg").style.fill="#e2574c"
+ } else {
+ console.log('BG still LOW, But you are going UP')
+ showAlertModal = true;
+ }
}
}
//End High || Low alert
processOneBg(data.BGD[count])
- settings(data.settings, data.BGD[count].units_hint)
+
+ timeFormat = data.settings.timeFormat
+ let highThreshold = data.settings.highThreshold
+ let lowThreshold = data.settings.lowThreshold
+
+ if(data.BGD[count].units_hint === "mmol") {
+ highThreshold = mgdl( data.settings.highThreshold )
+ lowThreshold = mgdl( data.settings.lowThreshold )
+ }
+ // settings(data.settings, data.BGD[count].units_hint)
// Added by NiVZ
@@ -374,14 +385,9 @@ inbox.onnewfile = () => {
//
//----------------------------------------------------------
function settings(settings, unitsHint){
- timeFormat = settings.timeFormat
- let highThreshold = settings.highThreshold
- let lowThreshold = settings.lowThreshold
- if(unitsHint === "mmol") {
- highThreshold = mgdl( settings.highThreshold )
- lowThreshold = mgdl( settings.lowThreshold )
- }
+
+ // console.log(settings.disableAlert)
// //document.getElementById("high").y = returnPoint(highThreshold)
// document.getElementById("high").text = settings.highThreshold
diff --git a/Glance/companion/index.js b/Glance/companion/index.js
index 6ca77e6b..078e2e9e 100644
--- a/Glance/companion/index.js
+++ b/Glance/companion/index.js
@@ -34,7 +34,7 @@ function queryOpenWeather() {
}
-function queryBGD() {
+function queryBGD(unitsHint) {
let url = getSgvURL()
console.log(url)
return fetch(url)
@@ -68,15 +68,22 @@ function queryBGD() {
let delta = 0;
let count = data.length - 1;
if(!data[count].delta) {
- delta = data[count].sgv - data[count - 1].sgv
+ delta = data[count].sgv - data[count - 1].sgv // DEBUGGGG LOOK HERERERERERERER
}
+
data.forEach(function(bg, index){
- bloodSugars.push({
+ let unitType = unitsHint;
+ if(unitType == null) {
+ unitType = bg.units_hint
+ } else {
+ unitType = unitType.values[0].name
+ }
+ bloodSugars.push({
sgv: bg.sgv,
delta: ((Math.round(bg.delta)) ? Math.round(bg.delta) : delta),
nextPull: diffMs,
- units_hint: ((bg.units_hint) ? bg.units_hint : 'mgdl')
+ units_hint: unitType
})
})
@@ -103,25 +110,25 @@ function formatReturnData() {
});
let BGDPromise = new Promise(function(resolve, reject) {
- resolve( queryBGD() );
+ resolve( queryBGD(getSettings("units") ) );
});
let highThreshold = null
let lowThreshold = null
if(getSettings("highThreshold")){
highThreshold = getSettings("highThreshold").name
- }
- if(getSettings("highThreshold").name == ""){
+ } else {
highThreshold = 200
}
if(getSettings("lowThreshold")){
lowThreshold = getSettings("lowThreshold").name
- }
- if(getSettings("lowThreshold").name == ""){
+ } else {
lowThreshold = 70
}
-
+ console.log("disableAlert")
+
+ console.log( getSettings('disableAlert'))
Promise.all([weatherPromise, BGDPromise]).then(function(values) {
let dataToSend = {
'weather':values[0],
@@ -130,7 +137,8 @@ function formatReturnData() {
'bgColor': getSettings('bgColor'),
'highThreshold': highThreshold,
'lowThreshold': lowThreshold,
- 'timeFormat' : getSettings('timeFormat')
+ 'timeFormat' : getSettings('timeFormat'),
+ 'disableAlert' : getSettings('disableAlert')
}
}
returnData(dataToSend)
diff --git a/Glance/settings/index.jsx b/Glance/settings/index.jsx
index 8c4ed19b..6f4b4f1d 100644
--- a/Glance/settings/index.jsx
+++ b/Glance/settings/index.jsx
@@ -18,6 +18,18 @@ function mySettings(props) {
label="Low threshold"
settingsKey="lowThreshold"
/>
+
+