Skip to content

Commit

Permalink
Merge pull request #6 from graphefruit/import_export
Browse files Browse the repository at this point in the history
Import export
  • Loading branch information
graphefruit authored Aug 6, 2018
2 parents b6d4841 + 2998222 commit 0b1dfba
Show file tree
Hide file tree
Showing 13 changed files with 453 additions and 32 deletions.
5 changes: 4 additions & 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="1.2.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<widget id="com.beanconqueror.app" version="1.3.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Beanconqueror</name>
<description />
<author email="[email protected]" href="https://github.com/graphefruit/beanconqueror">Lars Saalbach</author>
Expand Down Expand Up @@ -90,5 +90,8 @@
<variable name="PHOTO_LIBRARY_USAGE_DESCRIPTION" value="Bitte um Freigabe" />
</plugin>
<plugin name="cordova-plugin-statusbar" spec="^2.4.2" />
<plugin name="cordova-plugin-filechooser" spec="^1.0.1" />
<plugin name="cordova-plugin-filepath" spec="^1.4.2" />
<plugin name="cordova-plugin-file" spec="^4.3.3" />
<engine name="android" spec="6.2.3" />
</widget>
12 changes: 12 additions & 0 deletions install.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,15 @@ ionic cordova plugin add cordova-plugin-allow-backup --variable BACKUP=true
http://ionicframework.com/docs/native/android-permissions/
ionic cordova plugin add cordova-plugin-android-permissions
npm install --save @ionic-native/android-permissions

https://ionicframework.com/docs/native/file-chooser/
ionic cordova plugin add cordova-plugin-filechooser
npm install --save @ionic-native/file-chooser

https://ionicframework.com/docs/native/file-path/
ionic cordova plugin add cordova-plugin-filepath
npm install --save @ionic-native/file-path

https://ionicframework.com/docs/native/file/
ionic cordova plugin add cordova-plugin-file
npm install --save @ionic-native/file
33 changes: 29 additions & 4 deletions package-lock.json

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

16 changes: 12 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "beanconqueror",
"version": "1.2.0",
"version": "1.3.0",
"author": "Lars Saalbach, Richard Polzin",
"homepage": "https://github.com/graphefruit/beanconqueror",
"private": true,
Expand Down Expand Up @@ -28,6 +28,9 @@
"@ionic-native/app-minimize": "4.9.0",
"@ionic-native/app-version": "4.9.0",
"@ionic-native/core": "4.9.0",
"@ionic-native/file": "^4.11.0",
"@ionic-native/file-chooser": "^4.11.0",
"@ionic-native/file-path": "^4.11.0",
"@ionic-native/image-picker": "4.9.0",
"@ionic-native/media-capture": "4.9.0",
"@ionic-native/splash-screen": "4.9.0",
Expand All @@ -42,13 +45,15 @@
"cordova-plugin-compat": "^1.2.0",
"cordova-plugin-device": "^1.1.7",
"cordova-plugin-file": "^4.3.3",
"cordova-plugin-filechooser": "^1.0.1",
"cordova-plugin-filepath": "^1.4.2",
"cordova-plugin-ionic-webview": "^1.2.1",
"cordova-plugin-media-capture": "^1.4.3",
"cordova-plugin-splashscreen": "^4.1.0",
"cordova-plugin-statusbar": "^2.4.2",
"cordova-plugin-telerik-imagepicker": "^2.1.8",
"cordova-plugin-whitelist": "^1.3.3",
"cordova-sqlite-storage": "^2.3.2",
"cordova-sqlite-storage": "^2.3.3",
"ionic-angular": "3.9.2",
"ionic-plugin-keyboard": "^2.2.1",
"ionicons": "3.0.0",
Expand Down Expand Up @@ -77,10 +82,13 @@
"cordova-plugin-app-version": {},
"com.synconset.imagepicker": {
"PHOTO_LIBRARY_USAGE_DESCRIPTION": "Bitte um Freigabe"
}
},
"cordova-plugin-filechooser": {},
"cordova-plugin-filepath": {},
"cordova-plugin-file": {}
},
"platforms": [
"android"
]
}
}
}
6 changes: 6 additions & 0 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ import {MediaCapture} from '@ionic-native/media-capture';
import {ImagePicker} from '@ionic-native/image-picker';
import { AndroidPermissions } from '@ionic-native/android-permissions';
import { AppVersion } from '@ionic-native/app-version';
import { FileChooser } from '@ionic-native/file-chooser';
import {FilePath} from "@ionic-native/file-path";
import {File} from "@ionic-native/file";
/**Pages**/
import {MyApp} from './app.component';
import {HomePage} from '../pages/home/home';
Expand Down Expand Up @@ -108,6 +111,9 @@ import {TimerComponent} from '../components/timer/timer';
providers: [
StatusBar,
AppVersion,
FileChooser,
FilePath,
File,
SplashScreen,
UIStorage,
UISettingsStorage,
Expand Down
4 changes: 4 additions & 0 deletions src/classes/storageClass.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ export abstract class StorageClass {
return promise;
}

public reinitializeStorage(){
this.isInitialized = -1;
this.__initializeStorage();
}
private __initializeStorage() {
this.uiStorage.get(this.DB_PATH).then((_data) => {
if (_data === null || _data === undefined) {
Expand Down
5 changes: 4 additions & 1 deletion src/pages/brews/table/brews-table.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@
</ion-buttons>
<ion-buttons end>
<button ion-button icon-only (click)="scaleFontSmaller()">
<ion-icon name="remove"></ion-icon>
<ion-icon class="fa fa-search-minus"></ion-icon>
</button>
<button ion-button icon-only (click)="scaleFontBigger()">
<ion-icon class="fa fa-search-plus"></ion-icon>
</button>
<button [disabled]="!hasBeans || !hasPreparationMethods" ion-button icon-only (click)="addBrew()">
<ion-icon name="add"></ion-icon>
</button>
</ion-buttons>
Expand Down
45 changes: 30 additions & 15 deletions src/pages/brews/table/brews-table.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**Core**/
import {Component, ViewChild, ElementRef,Renderer2} from '@angular/core';
import {Component, ViewChild, ElementRef, Renderer2} from '@angular/core';
/**Ionic**/
import {ViewController, NavParams, Slides} from 'ionic-angular';
import {ViewController, NavParams, Slides, ModalController} from 'ionic-angular';
/**Services**/
import {UIBeanStorage} from '../../../services/uiBeanStorage';
import {UISettingsStorage} from '../../../services/uiSettingsStorage';
Expand All @@ -19,6 +19,7 @@ import {IBean} from '../../../interfaces/bean/iBean';
import {IBrew} from '../../../interfaces/brew/iBrew';
import {BrewView} from "../../../classes/brew/brewView";
import {UIBrewStorage} from "../../../services/uiBrewStorage";
import {BrewsAddModal} from "../add/brews-add";


@Component({
Expand All @@ -27,44 +28,58 @@ import {UIBrewStorage} from "../../../services/uiBrewStorage";
})
export class BrewsTableModal {

@ViewChild("tableEl", ) tableEl: ElementRef;
public brews: Array<Brew>=[];
@ViewChild("tableEl",) tableEl: ElementRef;
public brews: Array<Brew> = [];



private startingFontSize:number=14;
private startingFontSize: number = 14;

method_of_preparations: Array<IPreparation> = [];
beans: Array<IBean> = [];

public settings:Settings;
public settings: Settings;

public hasBeans: boolean = false;
public hasPreparationMethods: boolean = false;

constructor(private viewCtrl: ViewController, private navParams: NavParams, private uiBeanStorage: UIBeanStorage,
private uiPreparationStorage: UIPreparationStorage,
public uiHelper: UIHelper, private uiImage: UIImage, private uiSettingsStorage:UISettingsStorage, private uiBrewStorage:UIBrewStorage, private renderer:Renderer2) {
public uiHelper: UIHelper, private uiImage: UIImage,
private uiSettingsStorage: UISettingsStorage, private uiBrewStorage: UIBrewStorage,
private renderer: Renderer2, private modalCtrl:ModalController) {
this.settings = this.uiSettingsStorage.getSettings();

//Moved from ionViewDidEnter, because of Ionic issues with ion-range

this.method_of_preparations = this.uiPreparationStorage.getAllEntries();
this.beans = this.uiBeanStorage.getAllEntries();
this.hasBeans = (this.uiBeanStorage.getAllEntries().length > 0);
this.hasPreparationMethods = (this.uiPreparationStorage.getAllEntries().length > 0);
this.__initializeBrews();
}


scaleFontBigger(){
this.startingFontSize ++;
this.renderer.setStyle(this.tableEl.nativeElement,"fontSize",this.startingFontSize + "px");

public addBrew() {
let addBrewsModal = this.modalCtrl.create(BrewsAddModal, {});
addBrewsModal.onDidDismiss(() => {
this.__initializeBrews();
});
addBrewsModal.present({animate: false});
}

scaleFontBigger() {
this.startingFontSize++;
this.renderer.setStyle(this.tableEl.nativeElement, "fontSize", this.startingFontSize + "px");

}
scaleFontSmaller(){

scaleFontSmaller() {
this.startingFontSize--;
if (this.startingFontSize <6)
{
if (this.startingFontSize < 6) {
this.startingFontSize = 6;
}
this.renderer.setStyle(this.tableEl.nativeElement,"fontSize",this.startingFontSize + "px");
this.renderer.setStyle(this.tableEl.nativeElement, "fontSize", this.startingFontSize + "px");
}

dismiss() {
Expand Down
11 changes: 9 additions & 2 deletions src/pages/settings/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@
<p>Hier findest du alle spezifischen Einstellungen der App</p>
</ion-card-content>
</ion-card>
<ion-list>
<ion-item-divider color="light">Datenübertragen</ion-item-divider>
<button ion-item (click)="import()">
Import
</button>
<button ion-item (click)="export()">
Export
</button>
</ion-list>
<ion-list>
<ion-item-divider color="light">Allgemeine Einstellungen</ion-item-divider>
<ion-item>
Expand Down Expand Up @@ -87,8 +96,6 @@
</ion-item>
</div>
</ion-list>


<ion-list>


Expand Down
Loading

0 comments on commit 0b1dfba

Please sign in to comment.