Skip to content

Commit 6f40e1b

Browse files
committed
Just update the chart if a smart scale is not connected - else it has huge performance issues on android
1 parent faaa18f commit 6f40e1b

File tree

1 file changed

+32
-20
lines changed

1 file changed

+32
-20
lines changed

src/components/brews/brew-brewing-graph/brew-brewing-graph.component.ts

Lines changed: 32 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1481,10 +1481,12 @@ export class BrewBrewingGraphComponent implements OnInit {
14811481
this.stopFetchingDataFromSanremoYOU();
14821482

14831483
const setSanremoData = () => {
1484-
const temp = prepDeviceCall.getTemperature();
1485-
const press = prepDeviceCall.getPressure();
1486-
this.__setPressureFlow({ actual: press, old: press });
1487-
this.__setTemperatureFlow({ actual: temp, old: temp });
1484+
this.ngZone.runOutsideAngular(() => {
1485+
const temp = prepDeviceCall.getTemperature();
1486+
const press = prepDeviceCall.getPressure();
1487+
this.__setPressureFlow({ actual: press, old: press });
1488+
this.__setTemperatureFlow({ actual: temp, old: temp });
1489+
});
14881490
};
14891491

14901492
/**
@@ -1496,22 +1498,24 @@ export class BrewBrewingGraphComponent implements OnInit {
14961498
setSanremoData();
14971499
});
14981500

1499-
this.sanremoYOUFetchingInterval = setInterval(async () => {
1500-
try {
1501-
//const apiThirdCallDelayStart = moment(); // create a moment with the current time
1502-
//let apiDelayEnd;
1501+
this.ngZone.runOutsideAngular(() => {
1502+
this.sanremoYOUFetchingInterval = setInterval(async () => {
1503+
try {
1504+
//const apiThirdCallDelayStart = moment(); // create a moment with the current time
1505+
//let apiDelayEnd;
15031506

1504-
// We don't use the callback function to make sure we don't have to many performance issues
1505-
prepDeviceCall.fetchRuntimeData(() => {
1506-
//apiDelayEnd = moment();
1507+
// We don't use the callback function to make sure we don't have to many performance issues
1508+
prepDeviceCall.fetchRuntimeData(() => {
1509+
//apiDelayEnd = moment();
15071510

1508-
//before we start the interval, we fetch the data once to overwrite, and set them.
1509-
//const delta = apiDelayEnd.diff(apiThirdCallDelayStart, 'milliseconds'); // get the millisecond difference
1510-
//console.log(delta);
1511-
setSanremoData();
1512-
});
1513-
} catch (ex) {}
1514-
}, 250);
1511+
//before we start the interval, we fetch the data once to overwrite, and set them.
1512+
//const delta = apiDelayEnd.diff(apiThirdCallDelayStart, 'milliseconds'); // get the millisecond difference
1513+
//console.log(delta);
1514+
setSanremoData();
1515+
});
1516+
} catch (ex) {}
1517+
}, 250);
1518+
});
15151519
}
15161520

15171521
public startFetchingDataFromMeticulous() {
@@ -2870,7 +2874,11 @@ export class BrewBrewingGraphComponent implements OnInit {
28702874
pressureObj.old
28712875
);
28722876

2873-
this.updateChart('pressure');
2877+
if (!isSmartScaleConnected) {
2878+
//Just update the chart if a smart scale is not connected - else it has huge performance issues on android
2879+
this.updateChart('pressure');
2880+
}
2881+
28742882
if (!isSmartScaleConnected) {
28752883
this.flowSecondTick++;
28762884
}
@@ -2923,7 +2931,11 @@ export class BrewBrewingGraphComponent implements OnInit {
29232931
temperatureObj.old
29242932
);
29252933

2926-
this.updateChart('temperature');
2934+
if (!isSmartScaleConnected) {
2935+
//Just update the chart if a smart scale is not connected - else it has huge performance issues on android
2936+
this.updateChart('temperature');
2937+
}
2938+
29272939
if (!isSmartScaleConnected) {
29282940
this.flowSecondTick++;
29292941
}

0 commit comments

Comments
 (0)