Skip to content

Commit

Permalink
#407 - Reconnect scale/pressure
Browse files Browse the repository at this point in the history
#404 - closed because of fix
#370 - Error information if bean was not approved yet
#368 - Displays brews for bean
#365 - Popsicle & pressure graph supported
#359 - Some graph enhancements
  • Loading branch information
graphefruit committed Oct 29, 2022
1 parent 040334c commit 75f0a1e
Show file tree
Hide file tree
Showing 71 changed files with 9,637 additions and 3,183 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ https://stackoverflow.com/questions/60357663/do-apple-app-site-association-files

### Upgrade Ionic if needed:

`npm install @ionic/angular@6.2.4`
`npm install @ionic/angular@6.3.1`
-> Or the actual active version

### Installing AAB on your android (mac)
Expand Down
2 changes: 1 addition & 1 deletion config.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.beanconqueror.app" version="6.1.6" xmlns="http://www.w3.org/ns/widgets">
<widget id="com.beanconqueror.app" version="6.1.7" xmlns="http://www.w3.org/ns/widgets">
<name>Beanconqueror</name>
<description />
<author email="[email protected]" href="https://github.com/graphefruit/beanconqueror">Lars Saalbach</author>
Expand Down
122 changes: 81 additions & 41 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"sonar": "sh /Users/larssaalbach/Downloads/sonarqube-7.0/bin/macosx-universal-64/sonar.sh console",
"sonar_scan": "/Users/larssaalbach/Downloads/sonar-scanner-4.2.0.1873-macosx/bin/sonar-scanner",
"prepare": "husky install",
"generate_proto": "protoc --plugin=node_modules/ts-proto/protoc-gen-ts_proto --ts_proto_opt=snakeToCamel=false --ts_proto_out ./src/generated ./src/classes/bean/bean.proto"
},
Expand All @@ -23,7 +21,7 @@
"@angular/platform-browser": "^14.1.0",
"@angular/platform-browser-dynamic": "^14.1.0",
"@angular/router": "^14.1.0",
"@graphefruit/coffee-bluetooth-devices": "file:../../graphefruit-coffee-bluetooth-devices-0.0.17.tgz",
"@graphefruit/coffee-bluetooth-devices": "file:../../graphefruit-coffee-bluetooth-devices-0.0.33.tgz",
"@ionic-native/android-permissions": "^5.33.1",
"@ionic-native/app-minimize": "^5.33.1",
"@ionic-native/app-version": "^5.33.1",
Expand All @@ -47,12 +45,12 @@
"@ionic-native/splash-screen": "^5.33.1",
"@ionic-native/status-bar": "^5.33.1",
"@ionic-native/three-dee-touch": "^5.33.1",
"@ionic/angular": "^6.2.5",
"@ionic/angular": "^6.3.1",
"@ionic/cli": "^6.18.1",
"@ionic/storage": "^2.3.1",
"@ngx-translate/core": "^11.0.1",
"@ngx-translate/http-loader": "^4.0.0",
"ag-virtual-scroll": "^1.3.0",
"ag-virtual-scroll": "^1.5.2",
"chart.js": "^3.9.1",
"chartjs-adapter-luxon": "^1.1.0",
"chartjs-plugin-annotation": "^1.3.0",
Expand All @@ -71,6 +69,7 @@
"cordova-plugin-statusbar": "^2.4.3",
"core-js": "^3.19.3",
"currency-symbol-map": "^5.0.1",
"html-to-image": "^1.10.8",
"javascript-color-gradient": "^1.3.2",
"jsurl": "^0.1.5",
"lodash": "^4.17.21",
Expand Down
44 changes: 38 additions & 6 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ import annotationPlugin from 'chartjs-plugin-annotation';

import {
CoffeeBluetoothServiceEvent,
Logger,
PressureType,
ScaleType,
} from '@graphefruit/coffee-bluetooth-devices';
Expand Down Expand Up @@ -280,6 +281,22 @@ export class AppComponent implements AfterViewInit {
this.uiLog.log(`Storage-Driver: ${this.storage.driver}`);
}
} catch (ex) {}
try {
Logger.attachOnLog().subscribe((_msg) => {
if (_msg.type === 'LOG') {
this.uiLog.log(_msg.log);
}
if (_msg.type === 'INFO') {
this.uiLog.info(_msg.log);
}
if (_msg.type === 'ERROR') {
this.uiLog.error(_msg.log);
}
if (_msg.type === 'DEBUG') {
this.uiLog.debug(_msg.log);
}
});
} catch (ex) {}

// Okay, so the platform is ready and our plugins are available.
// Here you can do any higher level native things you might need.
Expand All @@ -292,6 +309,7 @@ export class AppComponent implements AfterViewInit {
// When we're in cordova, disable the log messages
this.uiLog.disable();
}
Logger.disableLog();

if (this.platform.is('ios')) {
this.uiLog.log(`iOS Device - attach to home icon pressed`);
Expand Down Expand Up @@ -575,6 +593,13 @@ export class AppComponent implements AfterViewInit {
this.__connectPressureDevice();
}, 5000);

const settings = this.uiSettingsStorage.getSettings();
if (settings.scale_log === true || settings.pressure_log === true) {
Logger.enableLog();
} else {
Logger.disableLog();
}

await this.__checkStartupView();
this.__instanceAppRating();
this.__attachOnDevicePause();
Expand Down Expand Up @@ -618,12 +643,6 @@ export class AppComponent implements AfterViewInit {
this.uiLog.log(`Connect smartscale? ${scale_id}`);
if (scale_id !== undefined && scale_id !== '') {
this.bleManager.autoConnectScale(scale_type, scale_id, true);
/**setTimeout(() => {
this.bleManager.disconnect(scale_id);
setTimeout(() => {
this.bleManager.autoConnectScale(scale_type, scale_id, true);
}, 2000);
}, 10000);**/
} else {
this.uiLog.log('Smartscale not connected, dont try to connect');
}
Expand Down Expand Up @@ -655,6 +674,16 @@ export class AppComponent implements AfterViewInit {
this.bleManager.disconnect(settings.scale_id, false);
}
}

if (settings.pressure_stay_connected === false) {
const pressure_id: string = settings.pressure_id;
if (pressure_id !== undefined && pressure_id !== '') {
// Don't show message on device pause.
this.bleManager.disconnect(settings.pressure_id, false);
}
}

/// Add pressure profile.
});
}
private __attachOnDeviceResume() {
Expand All @@ -663,6 +692,9 @@ export class AppComponent implements AfterViewInit {
if (settings.bluetooth_scale_stay_connected === false) {
this.__connectSmartScale();
}
if (settings.pressure_stay_connected === false) {
this.__connectPressureDevice();
}
});
}

Expand Down
Loading

0 comments on commit 75f0a1e

Please sign in to comment.