Skip to content

Commit

Permalink
Added autodelete feature
Browse files Browse the repository at this point in the history
  • Loading branch information
Darius Musiolik authored and Darius Musiolik committed Jul 6, 2017
1 parent a976976 commit daaebd1
Show file tree
Hide file tree
Showing 11 changed files with 121 additions and 49 deletions.
Binary file modified platforms/android/.gradle/3.3/taskArtifacts/fileHashes.bin
Binary file not shown.
Binary file modified platforms/android/.gradle/3.3/taskArtifacts/fileSnapshots.bin
Binary file not shown.
Binary file modified platforms/android/.gradle/3.3/taskArtifacts/taskArtifacts.bin
Binary file not shown.
Binary file modified platforms/android/.gradle/3.3/taskArtifacts/taskArtifacts.lock
Binary file not shown.
68 changes: 45 additions & 23 deletions platforms/android/assets/www/build/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -57177,6 +57177,11 @@ var AboutPage = (function () {
_this.autosave = val;
console.log("[INFO] DB loaded autosave");
});
//Read DB and get confirmdelete
storage.get("confirmdelete").then(function (val) {
_this.confirmdelete = val;
console.log("[INFO] DB loaded confirmdelete");
});
//Waiting for Promise
if (this.save_hint == "0") {
setTimeout(function () {
Expand All @@ -57193,6 +57198,7 @@ var AboutPage = (function () {
this.storage.set("fontcolor", this.font_color);
this.storage.set("bgcolor", this.bg_color);
this.storage.set("autosave", this.autosave);
this.storage.set("confirmdelete", this.confirmdelete);
console.log("[INFO] Wrote new data to DB");
this.toastSTRG(this.wrotedata, "top");
//Refresh - Help me navCtrl, you're my only hope
Expand Down Expand Up @@ -57232,6 +57238,7 @@ var AboutPage = (function () {
_this.green = "Green";
_this.tardis = "Tardis Blue";
_this.autosave_text = "Enable autosave on BackBtnEvent";
_this.confirm_delete_text = "Confirm delete";
break;
case "de":
console.log("[INFO] Settings loading lang: >de<");
Expand All @@ -57252,6 +57259,7 @@ var AboutPage = (function () {
_this.green = "Grün";
_this.tardis = "Tardis Blau";
_this.autosave_text = "Automatisch speichern bei Zurücktastendruck";
_this.confirm_delete_text = "Löschen bestätigen";
break;
default:
console.log("[FAIL] Micro$oft be like: Something happend.. (Maybe the Promise was not send, slow device ?)");
Expand All @@ -57263,7 +57271,7 @@ var AboutPage = (function () {
}());
AboutPage = __decorate([
__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["_6" /* Component */])({
selector: 'page-about',template:/*ion-inline-start:"/home/dmusiolik/Desktop/Ionic Framework/klebezettel/src/pages/about/about.html"*/'<ion-header>\n <ion-navbar color="dark">\n <ion-title>{{ header }}</ion-title>\n <ion-buttons end>\n <button ion-button icon-only color="royal" (click)="saveSettings()">\n <ion-icon name="md-checkmark"></ion-icon>\n </button>\n </ion-buttons>\n </ion-navbar>\n</ion-header>\n<ion-content padding>\n<ion-item>\n <ion-label>{{ lang_text }}</ion-label>\n <ion-select [(ngModel)]="lang">\n <ion-option value="en">English</ion-option>\n <ion-option value="de">Deutsch</ion-option>\n </ion-select>\n </ion-item>\n <ion-item>\n <ion-label>{{ fontsite_text }}</ion-label>\n <ion-select [(ngModel)]="fontsize">\n <ion-option value="40">40 pt</ion-option>\n <ion-option value="35">35 pt</ion-option>\n <ion-option value="30">30 pt</ion-option>\n <ion-option value="25">25 pt</ion-option>\n <ion-option value="20">20 pt</ion-option>\n <ion-option value="15">15 pt</ion-option>\n <ion-option value="10">10 pt</ion-option>\n </ion-select>\n </ion-item>\n <ion-item>\n <ion-label>{{ welcomemsg_toogle }}</ion-label>\n <ion-toggle [(ngModel)]="welcomemsg_toogler" checked="{{ welcomemsg_toogler }}"></ion-toggle>\n </ion-item>\n <ion-item>\n <ion-label>{{ font_color_text }}</ion-label>\n <ion-select [(ngModel)]="font_color">\n <ion-option value="black">{{ black }}</ion-option>\n <ion-option value="white">{{ white }}</ion-option>\n <ion-option value="red">{{ red }}</ion-option>\n <ion-option value="blue">{{ blue }}</ion-option>\n <ion-option value="yellow">{{ yellow }}</ion-option>\n <ion-option value="orange">{{ orange }}</ion-option>\n <ion-option value="green">{{ green }}</ion-option>\n <ion-option value="#003B6F">{{ tardis }}</ion-option>\n </ion-select>\n </ion-item>\n <ion-item>\n <ion-label>{{ bg_color_text }}</ion-label>\n <ion-select [(ngModel)]="bg_color">\n <ion-option value="black">{{ black }}</ion-option>\n <ion-option value="white">{{ white }}</ion-option>\n <ion-option value="red">{{ red }}</ion-option>\n <ion-option value="blue">{{ blue }}</ion-option>\n <ion-option value="yellow">{{ yellow }}</ion-option>\n <ion-option value="orange">{{ orange }}</ion-option>\n <ion-option value="green">{{ green }}</ion-option>\n <ion-option value="#003B6F">{{ tardis }}</ion-option>\n </ion-select>\n </ion-item>\n <ion-item>\n <ion-label>{{ autosave_text }}</ion-label>\n <ion-toggle [(ngModel)]="autosave" checked="{{ autosave }}"></ion-toggle>\n </ion-item>\n</ion-content>\n'/*ion-inline-end:"/home/dmusiolik/Desktop/Ionic Framework/klebezettel/src/pages/about/about.html"*/
selector: 'page-about',template:/*ion-inline-start:"/home/dmusiolik/Desktop/Ionic Framework/klebezettel/src/pages/about/about.html"*/'<ion-header>\n <ion-navbar color="dark">\n <ion-title>{{ header }}</ion-title>\n <ion-buttons end>\n <button ion-button icon-only color="royal" (click)="saveSettings()">\n <ion-icon name="md-checkmark"></ion-icon>\n </button>\n </ion-buttons>\n </ion-navbar>\n</ion-header>\n<ion-content padding>\n<ion-item>\n <ion-label>{{ lang_text }}</ion-label>\n <ion-select [(ngModel)]="lang">\n <ion-option value="en">English</ion-option>\n <ion-option value="de">Deutsch</ion-option>\n </ion-select>\n </ion-item>\n <ion-item>\n <ion-label>{{ fontsite_text }}</ion-label>\n <ion-select [(ngModel)]="fontsize">\n <ion-option value="40">40 pt</ion-option>\n <ion-option value="35">35 pt</ion-option>\n <ion-option value="30">30 pt</ion-option>\n <ion-option value="25">25 pt</ion-option>\n <ion-option value="20">20 pt</ion-option>\n <ion-option value="15">15 pt</ion-option>\n <ion-option value="10">10 pt</ion-option>\n </ion-select>\n </ion-item>\n <ion-item>\n <ion-label>{{ welcomemsg_toogle }}</ion-label>\n <ion-toggle [(ngModel)]="welcomemsg_toogler" checked="{{ welcomemsg_toogler }}"></ion-toggle>\n </ion-item>\n <ion-item>\n <ion-label>{{ font_color_text }}</ion-label>\n <ion-select [(ngModel)]="font_color">\n <ion-option value="black">{{ black }}</ion-option>\n <ion-option value="white">{{ white }}</ion-option>\n <ion-option value="red">{{ red }}</ion-option>\n <ion-option value="blue">{{ blue }}</ion-option>\n <ion-option value="yellow">{{ yellow }}</ion-option>\n <ion-option value="orange">{{ orange }}</ion-option>\n <ion-option value="green">{{ green }}</ion-option>\n <ion-option value="#003B6F">{{ tardis }}</ion-option>\n </ion-select>\n </ion-item>\n <ion-item>\n <ion-label>{{ bg_color_text }}</ion-label>\n <ion-select [(ngModel)]="bg_color">\n <ion-option value="black">{{ black }}</ion-option>\n <ion-option value="white">{{ white }}</ion-option>\n <ion-option value="red">{{ red }}</ion-option>\n <ion-option value="blue">{{ blue }}</ion-option>\n <ion-option value="yellow">{{ yellow }}</ion-option>\n <ion-option value="orange">{{ orange }}</ion-option>\n <ion-option value="green">{{ green }}</ion-option>\n <ion-option value="#003B6F">{{ tardis }}</ion-option>\n </ion-select>\n </ion-item>\n <ion-item>\n <ion-label>{{ autosave_text }}</ion-label>\n <ion-toggle [(ngModel)]="autosave" checked="{{ autosave }}"></ion-toggle>\n </ion-item>\n <ion-item>\n <ion-label>{{ confirm_delete_text }}</ion-label>\n <ion-toggle [(ngModel)]="confirmdelete" checked="{{ confirmdelete }}"></ion-toggle>\n </ion-item>\n</ion-content>\n'/*ion-inline-end:"/home/dmusiolik/Desktop/Ionic Framework/klebezettel/src/pages/about/about.html"*/
}),
__metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_1_ionic_angular__["f" /* NavController */], __WEBPACK_IMPORTED_MODULE_2__ionic_storage__["b" /* Storage */], __WEBPACK_IMPORTED_MODULE_1_ionic_angular__["i" /* ToastController */], __WEBPACK_IMPORTED_MODULE_1_ionic_angular__["n" /* Events */]])
], AboutPage);
Expand Down Expand Up @@ -57405,6 +57413,7 @@ var HomePage = (function () {
storage.set("fontcolor", "black");
storage.set("bgcolor", "white");
storage.set("autosave", "false");
storage.set("confirmdelete", "true");
storage.set("welcomemsg_toogler", "true");
storage.set("save_hint", "0");
}
Expand Down Expand Up @@ -57538,29 +57547,37 @@ var HomePage = (function () {
};
HomePage.prototype.showConfirm = function (item) {
var _this = this;
var confirm = this.alertCtrl.create({
title: this.confirm,
message: this.confirm_msg,
buttons: [
{
text: this.disagree,
handler: function () {
console.log('Disagree clicked');
}
},
{
text: this.agree,
handler: function () {
console.log('Agree clicked');
_this.file.removeFile(_this.file.dataDirectory, item);
console.log("[WARN] Removed: >" + item + "< ");
_this.readFiles();
_this.toastSTRG(_this.file_removed_msg, "top");
if (this.confirmdelete) {
var confirm_1 = this.alertCtrl.create({
title: this.confirm,
message: this.confirm_msg,
buttons: [
{
text: this.disagree,
handler: function () {
console.log('Disagree clicked');
}
},
{
text: this.agree,
handler: function () {
console.log('Agree clicked');
_this.file.removeFile(_this.file.dataDirectory, item);
console.log("[WARN] Removed: >" + item + "< ");
_this.readFiles();
_this.toastSTRG(_this.file_removed_msg, "top");
}
}
}
]
});
confirm.present();
]
});
confirm_1.present();
}
else {
this.file.removeFile(this.file.dataDirectory, item);
console.log("[WARN] Removed: >" + item + "< ");
this.readFiles();
this.toastSTRG(this.file_removed_msg, "top");
}
};
HomePage.prototype.readFiles = function () {
var _this = this;
Expand Down Expand Up @@ -57621,6 +57638,11 @@ var HomePage = (function () {
_this.welcomemsg_toogler = val;
console.log("[INFO] DB loaded welcomemsg_toogler");
});
//Read DB and get confirmdelete
this.storage.get("confirmdelete").then(function (val) {
_this.confirmdelete = val;
console.log("[INFO] DB loaded confirmdelete");
});
//Wait for Promise
setTimeout(function () {
console.log("[INFO] Starting langSetup for >" + _this.lang + "<");
Expand Down
2 changes: 1 addition & 1 deletion platforms/android/assets/www/build/main.js.map

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions src/pages/about/about.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,8 @@
<ion-label>{{ autosave_text }}</ion-label>
<ion-toggle [(ngModel)]="autosave" checked="{{ autosave }}"></ion-toggle>
</ion-item>
<ion-item>
<ion-label>{{ confirm_delete_text }}</ion-label>
<ion-toggle [(ngModel)]="confirmdelete" checked="{{ confirmdelete }}"></ion-toggle>
</ion-item>
</ion-content>
11 changes: 10 additions & 1 deletion src/pages/about/about.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ white:string;
green:string;
tardis:string;
autosave_text:string;
confirm_delete_text:string;
confirmdelete:string;

constructor(public navCtrl: NavController, private storage: Storage, public toastCtrl: ToastController, public events: Events) {

Expand Down Expand Up @@ -88,7 +90,11 @@ autosave_text:string;
this.autosave = val;
console.log("[INFO] DB loaded autosave");
});

//Read DB and get confirmdelete
storage.get("confirmdelete").then((val) => {
this.confirmdelete = val;
console.log("[INFO] DB loaded confirmdelete");
});
//Waiting for Promise
if(this.save_hint == "0") {
setTimeout(() => {
Expand All @@ -106,6 +112,7 @@ autosave_text:string;
this.storage.set("fontcolor", this.font_color);
this.storage.set("bgcolor", this.bg_color);
this.storage.set("autosave", this.autosave);
this.storage.set("confirmdelete", this.confirmdelete);
console.log("[INFO] Wrote new data to DB");
this.toastSTRG(this.wrotedata, "top");
//Refresh - Help me navCtrl, you're my only hope
Expand Down Expand Up @@ -146,6 +153,7 @@ autosave_text:string;
this.green = "Green";
this.tardis = "Tardis Blue";
this.autosave_text = "Enable autosave on BackBtnEvent";
this.confirm_delete_text = "Confirm delete";
break;
case "de":
console.log("[INFO] Settings loading lang: >de<");
Expand All @@ -166,6 +174,7 @@ autosave_text:string;
this.green = "Grün";
this.tardis = "Tardis Blau";
this.autosave_text = "Automatisch speichern bei Zurücktastendruck";
this.confirm_delete_text = "Löschen bestätigen";
break;
default:
console.log("[FAIL] Micro$oft be like: Something happend.. (Maybe the Promise was not send, slow device ?)");
Expand Down
15 changes: 15 additions & 0 deletions src/pages/home/home.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export class HomePage {
//Global Varz
items = [];
welcomemsg_toogler:boolean;
confirmdelete:boolean;
//Lang Varz
lang:string;
welcomemsg:string;
Expand Down Expand Up @@ -61,6 +62,7 @@ export class HomePage {
storage.set("fontcolor", "black");
storage.set("bgcolor", "white");
storage.set("autosave", "false");
storage.set("confirmdelete", "true");
storage.set("welcomemsg_toogler", "true");
storage.set("save_hint", "0");
}
Expand Down Expand Up @@ -195,6 +197,8 @@ itemSelected(item: string) {
}

showConfirm(item:string) {

if(this.confirmdelete) {
let confirm = this.alertCtrl.create({
title: this.confirm,
message: this.confirm_msg,
Expand All @@ -218,7 +222,13 @@ showConfirm(item:string) {
]
});
confirm.present();
}else {
this.file.removeFile(this.file.dataDirectory, item);
console.log("[WARN] Removed: >" + item + "< ");
this.readFiles();
this.toastSTRG(this.file_removed_msg, "top");
}
}

readFiles() {
console.log("[INFO] Starting refresh");
Expand Down Expand Up @@ -280,6 +290,11 @@ createFileAndWrite(text: string, filename: string) {
this.welcomemsg_toogler = val;
console.log("[INFO] DB loaded welcomemsg_toogler");
});
//Read DB and get confirmdelete
this.storage.get("confirmdelete").then((val) => {
this.confirmdelete = val;
console.log("[INFO] DB loaded confirmdelete");
});
//Wait for Promise
setTimeout(() => {
console.log("[INFO] Starting langSetup for >" + this.lang + "<");
Expand Down
Loading

0 comments on commit daaebd1

Please sign in to comment.