Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
graphefruit committed Aug 9, 2023
2 parents c4eec36 + 66a7100 commit 93c9c7e
Show file tree
Hide file tree
Showing 65 changed files with 3,687 additions and 1,611 deletions.
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.5.1" xmlns="http://www.w3.org/ns/widgets">
<widget id="com.beanconqueror.app" version="6.6.0" 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
9 changes: 8 additions & 1 deletion package-lock.json

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

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
"long": "^5.2.0",
"luxon": "^2.3.0",
"lz-string": "^1.4.4",
"moment": "^2.29.1",
"moment": "^2.29.4",
"ngx-gauge": "^7.0.0",
"ngx-stars": "^1.6.4",
"postcss": "^8.3.5",
Expand All @@ -101,6 +101,7 @@
"@types/node": "^12.20.5",
"@wisdomgarden/cordova-plugin-filepath": "git+https://github.com/wisdom-garden/cordova-plugin-filepath.git",
"cordova-android": "^10.1.2",
"cordova-clipboard": "^1.3.0",
"cordova-ios": "^6.3.0",
"cordova-plugin-add-swift-support": "^2.0.2",
"cordova-plugin-advanced-http": "^3.3.1",
Expand Down Expand Up @@ -234,7 +235,8 @@
"IOS_INIT_ON_LOAD": "false",
"ACCESS_BACKGROUND_LOCATION": "false",
"BLUETOOTH_RESTORE_STATE": "false"
}
},
"cordova-clipboard": {}
},
"platforms": [
"ios",
Expand Down
47 changes: 44 additions & 3 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ import {
CoffeeBluetoothDevicesService,
CoffeeBluetoothServiceEvent,
} from '../services/coffeeBluetoothDevices/coffee-bluetooth-devices.service';
import { PressureType, ScaleType, TemperatureType } from '../classes/devices';
import { PressureType, ScaleType, TemperatureType, RefractometerType } from '../classes/devices';
import { Logger } from '../classes/devices/common/logger';
import { UIExportImportHelper } from '../services/uiExportImportHelper';

Expand Down Expand Up @@ -601,8 +601,9 @@ export class AppComponent implements AfterViewInit {
const pressure_id: string = checkDevices.pressure_id;
const temperature_id: string = checkDevices.temperature_id;
const scale_id: string = checkDevices.scale_id;
const refractometer_id: string = checkDevices.refractometer_id;
// If one of these is there, enable bluetooth
if (pressure_id || temperature_id || scale_id) {
if (pressure_id || temperature_id || scale_id || refractometer_id) {
await this.bleManager.enableIOSBluetooth();
}
} else {
Expand All @@ -617,13 +618,15 @@ export class AppComponent implements AfterViewInit {
this.__connectPressureDevice();
this.__connectSmartScale();
this.__connectTemperatureDevice();
this.__connectRefractometerDevice();
}, 3000);

const settings = this.uiSettingsStorage.getSettings();
if (
settings.scale_log === true ||
settings.pressure_log === true ||
settings.temperature_log === true
settings.temperature_log === true ||
settings.refractometer_log === true
) {
Logger.enableLog();
} else {
Expand All @@ -646,6 +649,8 @@ export class AppComponent implements AfterViewInit {

const scale_id: string = settings.scale_id;

const refractometer_id: string = settings.refractometer_id;

let isAndroidAndPressureDevice: boolean = false;
if (this.platform.is('android') && pressure_id) {
isAndroidAndPressureDevice = true;
Expand All @@ -661,6 +666,9 @@ export class AppComponent implements AfterViewInit {
if (temperature_id && !this.platform.is('android')) {
searchIds.push(temperature_id);
}
if (refractometer_id && !this.platform.is('android')) {
searchIds.push(refractometer_id);
}
try {
if (searchIds.length > 0) {
// Just search if we raly got id's
Expand Down Expand Up @@ -724,6 +732,25 @@ export class AppComponent implements AfterViewInit {
}
}

private __connectRefractometerDevice() {
const settings = this.uiSettingsStorage.getSettings();
const refractometer_id: string = settings.refractometer_id;
const refractometer_type: RefractometerType = settings.refractometer_type;

this.uiLog.log(`Connect refractometer device? ${refractometer_id}`);
if (refractometer_id !== undefined && refractometer_id !== '') {
this.bleManager.autoConnectRefractometerDevice(
refractometer_type,
refractometer_id,
false,
() => {},
() => {}
);
} else {
this.uiLog.log('Refractometer device not connected, dont try to connect');
}
}

private __attachOnDevicePause() {
this.platform.pause.subscribe(async () => {
const settings: Settings = this.uiSettingsStorage.getSettings();
Expand Down Expand Up @@ -753,6 +780,17 @@ export class AppComponent implements AfterViewInit {
);
}
}

if (settings.refractometer_stay_connected === false) {
const refractometer_id: string = settings.refractometer_id;
if (refractometer_id !== undefined && refractometer_id !== '') {
// Don't show message on device pause.
this.bleManager.disconnectRefractometerDevice(
settings.refractometer_id,
false
);
}
}
});
}
private __attachOnDeviceResume() {
Expand All @@ -767,6 +805,9 @@ export class AppComponent implements AfterViewInit {
if (settings.temperature_stay_connected === false) {
this.__connectTemperatureDevice();
}
if (settings.refractometer_stay_connected === false) {
this.__connectRefractometerDevice();
}
});
}

Expand Down
8 changes: 8 additions & 0 deletions src/app/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -869,7 +869,15 @@ ion-segment.tabs {
}
}
}
.select-max-width {
max-width:100%;
width:100%;
.alert-wrapper {
max-width:100%;
width:90%;

}
}
.xenia-script-chooser {
max-width:100%;
width:100%;
Expand Down
7 changes: 7 additions & 0 deletions src/app/brew/brew-detail/brew-detail.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,8 @@ <h3>{{data?.getFormattedTotalCoffeeTemperatureTime()}}</h3>
class="ion-padding-horizontal">{{"DOWNLOAD_XLSX" | translate}}</ion-item>
<ion-item (click)="downloadJSONProfile()" [button]="true" [detail]="false"
class="ion-padding-horizontal">{{"DOWNLOAD_JSON" | translate}}</ion-item>
<ion-item (click)="downloadVisualizerProfile()" [button]="true" [detail]="false"
class="ion-padding-horizontal">{{"MANUAL_EXPORT_TO_VISUALIZER" | translate}}</ion-item>
</ion-list>
</ion-content>
</ng-template>
Expand Down Expand Up @@ -408,6 +410,11 @@ <h3>{{data.getExtractionYield()}}</h3>
<h2>{{"BREW_DATA_NOTES" | translate }}:</h2>
<pre>{{data.note}}</pre>
</ion-label>
<ion-button (click)='copyNotesToClipboard()'
tabIndex="1" class="big-icon-only" fill="clear" slot="end" tappable>
<ion-icon class="ion-color-accent" name="clipboard-outline" slot="icon-only"></ion-icon>
</ion-button>

</ion-item>

<div *ngIf="uiBrewHelper.fieldVisible(settings.manage_parameters.attachments,
Expand Down
27 changes: 26 additions & 1 deletion src/app/brew/brew-detail/brew-detail.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ import { ScreenOrientation } from '@ionic-native/screen-orientation/ngx';
import moment from 'moment';
import BeanconquerorFlowTestDataDummy from '../../../assets/BeanconquerorFlowTestDataFourth.json';
import { UILog } from '../../../services/uiLog';
import { UIToast } from '../../../services/uiToast';
import { Visualizer } from '../../../classes/visualizer/visualizer';
declare var Plotly;
@Component({
selector: 'brew-detail',
Expand Down Expand Up @@ -77,7 +79,8 @@ export class BrewDetailComponent implements OnInit {
private readonly platform: Platform,
private readonly screenOrientation: ScreenOrientation,
private readonly alertCtrl: AlertController,
private readonly uiLog: UILog
private readonly uiLog: UILog,
private readonly uiToast: UIToast
) {
this.settings = this.uiSettingsStorage.getSettings();
}
Expand Down Expand Up @@ -107,6 +110,9 @@ export class BrewDetailComponent implements OnInit {
this.loaded = true;
}

public copyNotesToClipboard() {
this.uiHelper.copyToClipboard(this.data.note);
}
public async detailBean() {
await this.uiBeanHelper.detailBean(this.data.getBean());
}
Expand Down Expand Up @@ -603,6 +609,25 @@ export class BrewDetailComponent implements OnInit {
return layout;
}

public async downloadVisualizerProfile() {
const vS: Visualizer = new Visualizer();

vS.mapBrew(this.data);
vS.mapBean(this.data.getBean());
vS.mapWater(this.data.getWater());
vS.mapPreparation(this.data.getPreparation());
vS.mapMill(this.data.getMill());
vS.brewFlow = this.flow_profile_raw;

try {
await this.uiHelper.exportJSON(
this.brew.config.uuid + '_visualizer.json',
JSON.stringify(vS),
true
);
} catch (ex) {}
}

public async downloadJSONProfile() {
if (this.data.flow_profile !== '') {
const jsonParsed = await this.uiFileHelper.getJSONFile(
Expand Down
10 changes: 10 additions & 0 deletions src/app/brew/brew-filter/brew-filter.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@
<ion-label position="stacked" style="top: -5px;position: relative;">{{"ONLY_FAVOURITES" | translate }}</ion-label>
<ion-toggle slot="end" [(ngModel)]="filter.favourite"></ion-toggle>
</ion-item>
<ion-item *ngIf='settings.best_brew'>
<ion-label position="stacked" style="top: -5px;position: relative;">{{"ONLY_BEST_BREWS" | translate }}</ion-label>
<ion-toggle slot="end" [(ngModel)]="filter.best_brew"></ion-toggle>
</ion-item>
<ion-item>
<ion-label position="stacked" style="top: -5px;position: relative;">{{"BREW_FILTER_JUST_CHART_DATA" | translate }}</ion-label>
<ion-toggle [(ngModel)]="filter.chart_data" slot="end"></ion-toggle>
Expand All @@ -58,6 +62,12 @@
</ion-range>
</ion-item>

<ion-item *ngIf='profiles?.length>0'>
<ion-label position="stacked" style="top: -5px;position: relative;">{{"BREW_DATA_PRESSURE_PROFILE" | translate }}</ion-label>
<ion-select placeholder='{{"BREW.PLACE_HOLDER.BREW_DATA_PRESSURE_PROFILE"| translate}}' [interfaceOptions]="selectOptions" [(ngModel)]="filter.profiles" [multiple]='true' >
<ion-select-option *ngFor="let data of profiles" value="{{data}}">{{data}}</ion-select-option>
</ion-select>
</ion-item>
<ion-list class="ion-no-padding ion-padding-top ion-margin-horizontal">
<ion-button (click)="useFilter()" color="accent" expand="block" tappable
type="submit">{{"USE_FILTER" | translate}}</ion-button>
Expand Down
27 changes: 27 additions & 0 deletions src/app/brew/brew-filter/brew-filter.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ export class BrewFilterComponent implements OnInit {
public mills: Array<Mill> = [];
public segment: string = 'open';

public profiles: Array<string> = [];
public selectOptions = {
cssClass: 'select-max-width',
};
constructor(
private readonly modalController: ModalController,
private readonly uiBrewHelper: UIBrewHelper,
Expand All @@ -49,6 +53,7 @@ export class BrewFilterComponent implements OnInit {
this.segment = this.navParams.get('segment');
this.filter = this.uiHelper.copyData(this.navParams.get('brew_filter'));
this.__reloadFilterSettings();
this.profiles = this.getProfiles();
}
public getMaxBrewRating() {
const maxSettingsRating = this.settings.brew_rating;
Expand Down Expand Up @@ -118,6 +123,28 @@ export class BrewFilterComponent implements OnInit {
return preparationTools;
}

public getProfiles() {
const brews: Array<Brew> = this.uiBrewStorage
.getAllEntries()
.filter((e) => e.pressure_profile !== '');
const profiles = [];
for (const brew of brews) {
if (profiles.indexOf(brew.pressure_profile) <= -1) {
profiles.push(brew.pressure_profile);
}
}
profiles.sort((a, b) => {
if (a < b) {
return -1;
}
if (a > b) {
return 1;
}
return 0;
});
return profiles;
}

public dismiss(): void {
this.modalController.dismiss({
brew_filter: undefined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
<ion-icon *ngIf="data.favourite" name="heart" slot="start"></ion-icon>
<span>{{"POPOVER_BREWS_OPTION_TOGGLE_FAVOURITE" | translate}}</span>
</ion-item>
<ion-item *ngIf='settings.best_brew' (click)="choose(getStaticActions().TOGGLE_BEST_BREW)" button tappable>
<ion-icon *ngIf="!data.best_brew" name="trophy-outline" slot="start"></ion-icon>
<ion-icon *ngIf="data.best_brew" name="trophy" slot="start"></ion-icon>
<span>{{"POPOVER_BEST_BREW" | translate}}</span>
</ion-item>
<ion-item (click)="choose(getStaticActions().DETAIL)" button tappable>
<ion-icon name="beanconqueror-detail" slot="start"></ion-icon>
<span>{{"POPOVER_BREWS_OPTION_DETAIL" | translate}}</span>
Expand All @@ -23,6 +28,10 @@
<ion-icon name="beanconqueror-edit" slot="start"></ion-icon>
<span>{{"POPOVER_BREWS_OPTION_EDIT" | translate}}</span>
</ion-item>
<ion-item (click)="choose(getStaticActions().RATING)" *ngIf='isRatingEnabled()' button tappable>
<ion-icon name="beanconqueror-brew-rating-empty" slot="start"></ion-icon>
<span>{{"BREW_DATA_RATING" | translate}}</span>
</ion-item>
<ion-item (click)="choose(getStaticActions().CUPPING)" button tappable>
<ion-icon name="beanconqueror-cupping" slot="start"></ion-icon>
<span>{{"POPOVER_BREWS_OPTION_CUPPING" | translate}}</span>
Expand Down
Loading

0 comments on commit 93c9c7e

Please sign in to comment.