diff --git a/app/components/CookingTimer.vue b/app/components/CookingTimer.vue
index b231369c..8c16dd1b 100644
--- a/app/components/CookingTimer.vue
+++ b/app/components/CookingTimer.vue
@@ -12,7 +12,7 @@
-
+
-
+
@@ -115,11 +115,11 @@ export default {
...mapState([
"icon",
"recipes",
- "timerSound",
- "timerVibrate",
- "timerPresets",
- "activeTimers",
- "FGService",
+ "timerS",
+ "timerV",
+ "timerPs",
+ "activeTs",
+ "FGS",
"RTL",
]),
hasBackStack() {
@@ -127,18 +127,10 @@ export default {
},
},
methods: {
- ...mapActions([
- "addActiveTimer",
- "removeActiveTimer",
- "clearTimerInterval",
- "addTimerPreset",
- "updateActiveTimer",
- "setFGService",
- ]),
+ ...mapActions(["addAT", "removeAT", "clearATIs", "updateAT", "setFgS"]),
pgLoad({ object }) {
object.bindingContext = new Observable();
- if (this.activeTimers.filter((e: any) => e.done).length)
- this.openReminder();
+ if (this.activeTs.filter((e: any) => e.done).length) this.openReminder();
setNumber("isTimer", 1);
},
abLoad({ object }) {
@@ -188,8 +180,8 @@ export default {
// NOTIFICATION HANDLERS
timerInfo() {
- let activeCount = this.activeTimers.length;
- let pausedCount = this.activeTimers.filter((e) => e.isPaused).length;
+ let activeCount = this.activeTs.length;
+ let pausedCount = this.activeTs.filter((e) => e.isPaused).length;
let ongoingCount = activeCount - pausedCount;
this.foregroundService(activeCount);
function show() {
@@ -204,13 +196,12 @@ export default {
title: localize("timer"),
});
}
- if (this.FGService)
- setTimeout(() => this.activeTimers.length && show(), 250);
+ if (this.FGS) setTimeout(() => this.activeTs.length && show(), 250);
utils.wakeLock(ongoingCount);
},
timerAlert() {
let title, description, bID;
- let firedTimers = this.activeTimers.filter((e) => e.done);
+ let firedTimers = this.activeTs.filter((e) => e.done);
let timer = firedTimers[0];
if (firedTimers.length > 1) {
title = localize("texp", firedTimers.length);
@@ -235,9 +226,9 @@ export default {
multi: firedTimers.length > 1,
nID: 7,
priority: 1,
- sound: this.timerSound.uri,
+ sound: this.timerS.uri,
title,
- vibrate: this.timerVibrate,
+ vibrate: this.timerV,
});
if (firedTimers.length == 1) {
Application.android.registerBroadcastReceiver(bID, (ctx, intent) => {
@@ -255,7 +246,7 @@ export default {
}
},
openReminder() {
- this.clearTimerInterval();
+ this.clearATIs();
this.$showModal(TimerReminder, {
fullscreen: true,
props: {
@@ -266,7 +257,7 @@ export default {
showToast: this.showToast,
},
}).then(() => {
- this.clearTimerInterval();
+ this.clearATIs();
this.key = Math.floor(Math.random() * 900) + 100;
});
},
@@ -276,16 +267,16 @@ export default {
ctx,
com.tns.ForegroundService.class
);
- if (n && !this.FGService) {
+ if (n && !this.FGS) {
parseInt(Device.sdkVersion) < 26
? ctx.startService(intent)
: ctx.startForegroundService(intent);
- this.setFGService(1);
- setNumber("FGService", 1);
- } else if (!this.activeTimers.length) {
+ this.setFgS(1);
+ setNumber("FGS", 1);
+ } else if (!this.activeTs.length) {
ctx.stopService(intent);
- this.setFGService(0);
- setNumber("FGService", 0);
+ this.setFgS(0);
+ setNumber("FGS", 0);
}
},
@@ -294,14 +285,14 @@ export default {
this.$showModal(TimePickerHMS, {
props: {
title: "ntmr",
- label: `${localize("tmr", this.activeTimers.length + 1)}`,
+ label: `${localize("tmr", this.activeTs.length + 1)}`,
action: "strtBtn",
- showPreset: this.timerPresets.length,
+ showPreset: this.timerPs.length,
},
}).then((res) => {
if (res) {
if (res == "presets") {
- let list = this.timerPresets.map(
+ let list = this.timerPs.map(
(e) => `${e.label} - ${this.formattedTime(e.time)}`
);
this.$showModal(Action, {
@@ -312,22 +303,22 @@ export default {
}).then((preset) => {
if (preset) {
let timer = JSON.parse(
- JSON.stringify(this.timerPresets[list.indexOf(preset)])
+ JSON.stringify(this.timerPs[list.indexOf(preset)])
);
timer.id = utils.getRandomID(1);
timer.recipeID = this.recipeID;
timer.timerInt = timer.isPaused = 0;
timer.preset = timer.mode = 1;
- this.addActiveTimer({
+ this.addAT({
timer,
- i: this.activeTimers.length,
+ i: this.activeTs.length,
});
this.timerInfo();
}
});
} else {
let mode = res.time != "00:00:00" ? 1 : 0;
- this.addActiveTimer({
+ this.addAT({
timer: {
id: utils.getRandomID(1),
label: res.label,
@@ -339,7 +330,7 @@ export default {
done: 0,
mode,
},
- i: this.activeTimers.length,
+ i: this.activeTs.length,
});
this.timerInfo();
}
@@ -347,11 +338,11 @@ export default {
});
},
removeTimer(id, noUndo) {
- let i = this.activeTimers.findIndex((e) => e.id == id);
- let temp = this.activeTimers[i];
+ let i = this.activeTs.findIndex((e) => e.id == id);
+ let temp = this.activeTs[i];
clearInterval(temp.timerInt);
temp.timerInt = 0;
- this.removeActiveTimer(i);
+ this.removeAT(i);
let secs = [getNumber(`${temp.id}c`, 0), getNumber(`${temp.id}d`, 0)];
function removeSettings() {
remove(`${temp.id}c`);
@@ -363,7 +354,7 @@ export default {
.then(() => {
setNumber(`${temp.id}c`, secs[0]),
setNumber(`${temp.id}d`, secs[1]),
- this.addActiveTimer({
+ this.addAT({
timer: temp,
i,
});
@@ -377,7 +368,7 @@ export default {
togglePause(timer, n) {
timer.isPaused =
typeof n === "number" ? n : (!timer.isPaused as boolean | 0);
- this.updateActiveTimer(timer);
+ this.updateAT(timer);
n ? 0 : this.timerInfo();
},
showToast(data) {
@@ -453,7 +444,7 @@ export default {
// HELPERS
},
created() {
- this.clearTimerInterval();
+ this.clearATIs();
this.recipeID && this.addTimer();
},
destroyed() {
diff --git a/app/components/EditRecipe.vue b/app/components/EditRecipe.vue
index d944bc63..94d1dd4b 100644
--- a/app/components/EditRecipe.vue
+++ b/app/components/EditRecipe.vue
@@ -391,7 +391,7 @@ export default {
modalOpen: 0,
saving: 0,
cacheImagePath: null,
- unSyncCombinations: [],
+ unLinkCombs: [],
difficultyLevels: ["Easy", "Moderate", "Challenging"],
appbar: null,
snackbar: null,
@@ -427,11 +427,7 @@ export default {
},
},
methods: {
- ...mapActions([
- "addRecipeAction",
- "addListItemAction",
- "unSyncCombinationsAction",
- ]),
+ ...mapActions(["addR", "addLI", "unLinkCs"]),
pgLoad({ object }) {
object.bindingContext = new Observable();
this.hijackBackEvent();
@@ -491,37 +487,39 @@ export default {
knownFolders.temp().path,
`${utils.getRandomID(0)}.jpg`
);
- utils.copyPhotoToCache(uri, this.cacheImagePath).then((imgPath) => {
- if (imgPath) {
- ImageSource.fromFile(imgPath).then((image) => {
- ImageCropper.prototype
- .show(
- image,
- {
- width: 1080,
- height: 1080,
- },
- {
- hideBottomControls: true,
- toolbarTitle: localize("cPic"),
- statusBarColor: "#ff5200",
- toolbarTextColor: aT == "Light" ? "#212529" : "#f1f3f5",
- toolbarColor:
- aT == "Light"
- ? "#f1f3f5"
- : aT == "Dark"
- ? "#212529"
- : "#000000",
- cropFrameColor: "#ff5200",
- }
- )
- .then((cropped) => {
- cropped.image.saveToFile(this.cacheImagePath, "jpg", 75);
- this.recipe.image = this.cacheImagePath;
- });
- });
- }
- });
+ utils
+ .copyPhotoToCache(uri.toString(), this.cacheImagePath)
+ .then((imgPath) => {
+ if (imgPath) {
+ ImageSource.fromFile(imgPath).then((image) => {
+ ImageCropper.prototype
+ .show(
+ image,
+ {
+ width: 1080,
+ height: 1080,
+ },
+ {
+ hideBottomControls: true,
+ toolbarTitle: localize("cPic"),
+ statusBarColor: "#ff5200",
+ toolbarTextColor: aT == "Light" ? "#212529" : "#f1f3f5",
+ toolbarColor:
+ aT == "Light"
+ ? "#f1f3f5"
+ : aT == "Dark"
+ ? "#212529"
+ : "#000000",
+ cropFrameColor: "#ff5200",
+ }
+ )
+ .then((cropped) => {
+ cropped.image.saveToFile(this.cacheImagePath, "jpg", 75);
+ this.recipe.image = this.cacheImagePath;
+ });
+ });
+ }
+ });
}
});
},
@@ -558,7 +556,7 @@ export default {
this.modalOpen = 0;
if (item.length) {
this.recipe.cuisine = item;
- this.addListItemAction({
+ this.addLI({
item,
listName: "cuisines",
});
@@ -572,7 +570,7 @@ export default {
if (focus) this.autoFocusField("category", 0);
} else
this.cuisines.includes(this.recipe.cuisine)
- ? mull
+ ? null
: (this.recipe.cuisine = "Undefined");
}
});
@@ -597,7 +595,7 @@ export default {
this.modalOpen = 0;
if (item.length) {
this.recipe.category = item;
- this.addListItemAction({
+ this.addLI({
item,
listName: "categories",
});
@@ -611,7 +609,7 @@ export default {
if (focus) this.autoFocusField("tags", 1);
} else
this.categories.includes(this.recipe.category)
- ? mull
+ ? null
: (this.recipe.category = "Undefined");
}
});
@@ -636,7 +634,7 @@ export default {
this.modalOpen = 0;
if (item.length) {
this.recipe.yieldUnit = item;
- this.addListItemAction({
+ this.addLI({
item,
listName: "yieldUnits",
});
@@ -650,7 +648,7 @@ export default {
if (focus) this.autoFocusField("difficultyLevel", 0);
} else
this.yieldUnits.includes(this.recipe.yieldUnit)
- ? mull
+ ? null
: (this.recipe.yieldUnit = "Serving");
}
});
@@ -670,7 +668,7 @@ export default {
if (focus) this.addIngredient();
} else
this.difficultyLevels.includes(this.recipe.difficulty)
- ? mull
+ ? null
: (this.recipe.difficulty = "Easy");
});
},
@@ -694,7 +692,7 @@ export default {
this.modalOpen = 0;
if (item.length) {
this.recipe.ingredients[index].unit = item;
- this.addListItemAction({
+ this.addLI({
item,
listName: "units",
});
@@ -785,7 +783,7 @@ export default {
removeCombination(id) {
let index = this.recipe.combinations.indexOf(id);
this.recipe.combinations.splice(index, 1);
- this.unSyncCombinations.push(id);
+ this.unLinkCombs.push(id);
this.showUndoBar("rmCmb").then((res) =>
this.recipe.combinations.splice(index, 0, id)
);
@@ -832,14 +830,14 @@ export default {
} else if (this.tempRecipe.image) {
getFileAccess().deleteFile(this.tempRecipe.image);
}
- this.unSyncCombinationsAction({
+ this.unLinkCs({
id: this.recipeID,
- combinations: this.unSyncCombinations,
+ combs: this.unLinkCombs,
});
this.saveRecipe();
},
saveRecipe() {
- this.addRecipeAction(this.recipe);
+ this.addR(this.recipe);
this.saving = 0;
this.dupRecipe
? this.$navigateTo(EnRecipes, {
diff --git a/app/components/EnRecipes.vue b/app/components/EnRecipes.vue
index 1bb74d56..9abda719 100644
--- a/app/components/EnRecipes.vue
+++ b/app/components/EnRecipes.vue
@@ -111,7 +111,7 @@
-
+
@@ -246,9 +246,9 @@ export default {
"recipes",
"layout",
"mealPlans",
- "mondayFirst",
+ "startMon",
"RTL",
- "plannerView",
+ "plannerV",
]),
todaysTime() {
return new Date(this.year, this.month, this.date, 0).getTime();
@@ -269,12 +269,12 @@ export default {
calRows() {
let h = (Screen.mainScreen.widthDIPs - 32) / 8;
if (h < 48) h = 48;
- let pv = this.plannerView;
+ let pv = this.plannerV;
return pv != "d" ? `${h}, `.repeat(pv == "wk" ? 1 : 6) + h : 0;
},
getDayNames() {
let dNames =
- this.plannerView != "d" &&
+ this.plannerV != "d" &&
this.getCal.slice(0, 7).map((d) => {
let date = new Date(d.y, d.m, d.d);
return new Intl.DateTimeFormat(null, {
@@ -293,7 +293,7 @@ export default {
) {
a.push({
d: d.getDate(),
- ld: this.getLocaleN(d.getDate()),
+ ld: this.localeN(d.getDate()),
m: d.getMonth(),
y: d.getFullYear(),
});
@@ -301,15 +301,15 @@ export default {
return a;
};
- let pv = this.plannerView;
+ let pv = this.plannerV;
let date = new Date(
this.year,
this.month,
- pv == "mnth" ? 1 : this.date - this.mondayFirst
+ pv == "mnth" ? 1 : this.date - this.startMon
);
return pv != "d"
? getDays(
- date.setDate(date.getDate() - date.getDay() + this.mondayFirst),
+ date.setDate(date.getDate() - date.getDay() + this.startMon),
date.setDate(date.getDate() + (pv == "mnth" ? 41 : 6))
)
: [];
@@ -332,7 +332,7 @@ export default {
return /minimal/.test(this.layout);
},
mpItems() {
- let pv = this.plannerView;
+ let pv = this.plannerV;
let days =
pv == "wk"
? this.getCal.slice(0, 7)
@@ -387,7 +387,7 @@ export default {
},
},
methods: {
- ...mapActions(["addMealPlanAction", "deleteMealPlanAction"]),
+ ...mapActions(["addMP", "deleteMP"]),
pgLoad({ object }) {
object.bindingContext = new Observable();
this.showBar();
@@ -439,7 +439,7 @@ export default {
getYield(id) {
let mp = this.mealPlans.filter((e) => e.id == id)[0];
let r = this.recipes.filter((e) => e.id === mp.recipeID)[0];
- return r ? `${this.getLocaleN(mp.quantity)} ${localize(r.yieldUnit)}` : 0;
+ return r ? `${this.localeN(mp.quantity)} ${localize(r.yieldUnit)}` : 0;
},
// NavigationHandlers
@@ -476,7 +476,7 @@ export default {
// Calendar
navigate(dir) {
if (this.RTL) dir = !dir;
- let pv = this.plannerView;
+ let pv = this.plannerV;
let date = new Date(this.year, this.month, this.date);
let sd =
pv == "mnth"
@@ -557,7 +557,7 @@ export default {
// DataHandlers
newMealPlan({ plan, index, inDB }) {
- this.addMealPlanAction({
+ this.addMP({
plan,
index,
inDB,
@@ -655,7 +655,7 @@ export default {
deleteTempFromDB() {
if (this.temp) {
let { plan, index } = this.temp;
- this.deleteMealPlanAction({ id: plan.id, index, inDB: 1 });
+ this.deleteMP({ id: plan.id, index, inDB: 1 });
this.temp = 0;
}
},
@@ -664,11 +664,11 @@ export default {
let index = this.mealPlans.findIndex((e) => e.id == id);
let plan = this.mealPlans.filter((e) => e.id == id)[0];
this.temp = { plan, index };
- this.deleteMealPlanAction({ id, index });
+ this.deleteMP({ id, index });
this.showUndoBar(plan.note ? "rmN" : "recRm")
.then(() => this.newMealPlan({ plan, index }))
.catch(() => {
- this.deleteMealPlanAction({ id, index, inDB: 1 });
+ this.deleteMP({ id, index, inDB: 1 });
});
},
showUndoBar(message) {
@@ -750,7 +750,7 @@ export default {
options.year = "numeric";
options.month = "long";
}
- if (this.plannerView == "d") {
+ if (this.plannerV == "d") {
options.weekday = "long";
options.day = "numeric";
options.month = "short";
diff --git a/app/components/ViewRecipe.vue b/app/components/ViewRecipe.vue
index d4cc75cd..ae5b6b11 100644
--- a/app/components/ViewRecipe.vue
+++ b/app/components/ViewRecipe.vue
@@ -51,60 +51,57 @@
>
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -139,7 +136,7 @@
:key="index + 'ins'"
class="check"
>
-
+
@@ -152,7 +149,7 @@
@@ -343,7 +340,7 @@ export default {
};
},
computed: {
- ...mapState(["icon", "recipes", "RTL", "awakeViewer"]),
+ ...mapState(["icon", "recipes", "RTL", "awakeV"]),
tempYieldQuantity() {
return Math.abs(this.yieldMultiplier) > 0
? Math.abs(parseFloat(this.yieldMultiplier))
@@ -372,13 +369,13 @@ export default {
},
},
methods: {
- ...mapActions(["toggleStateAction", "setRatingAction", "toggleCartAction"]),
+ ...mapActions(["toggleState", "setR"]),
pgLoad({ object }) {
this.busyDup = this.busyEdit = this.photoOpen = 0;
object.bindingContext = new Observable();
if (this.yieldMultiplier == this.recipe.yieldQuantity)
this.yieldMultiplier = this.recipe.yieldQuantity;
- if (this.awakeViewer) utils.keepScreenOn(1);
+ if (this.awakeV) utils.keepScreenOn(1);
this.syncCombinations();
this.view = object.page.getViewById("printview");
},
@@ -504,8 +501,8 @@ export default {
s = this.stepsDid;
break;
}
- c = this.getLocaleN(c);
- s = s && this.getLocaleN(s);
+ c = this.localeN(c);
+ s = s && this.localeN(s);
let text = s ? ` (${s}/${c})` : ` (${c})`;
return localize(title) + text;
},
@@ -572,48 +569,6 @@ export default {
: this.animateBar(this.appbar, 1);
});
},
- // getMeasure(value: number, unit: string) {
- // let vm = this;
- // function roundedQ(val: number) {
- // return Math.abs(
- // Math.round(
- // (val / vm.recipe.yieldQuantity) * vm.tempYieldQuantity * 100
- // ) / 100
- // );
- // }
- // if (value) {
- // let rounded = Math.abs(
- // Math.round(
- // (value / this.recipe.yieldQuantity) * this.tempYieldQuantity * 100
- // ) / 100
- // );
- // let lUnit = localize(unit);
-
- // switch (unit) {
- // //IMPERIAL
- // case "g":
- // return rounded < 1000
- // ? `${rounded} ${lUnit} `
- // : `${roundedQ(rounded / 1000)} ${localize("kg")} `;
- // case "ml":
- // return rounded < 1000
- // ? `${rounded} ${lUnit} `
- // : `${roundedQ(rounded / 1000)} ${localize("l")} `;
-
- // //METRIC
- // case "tsp":
- // return rounded < 3
- // ? `${rounded} ${lUnit} `
- // : `${roundedQ(rounded / 3)} ${localize("tbsp")} `;
- // case "in":
- // return rounded < 12
- // ? `${rounded} ${lUnit} `
- // : `${roundedQ(rounded / 12)} ${localize("ft")} `;
- // default:
- // return `${rounded} ${lUnit} `;
- // }
- // } else return "";
- // },
roundedQuantity(quantity: number) {
return Math.abs(
Math.round(
@@ -830,7 +785,7 @@ export default {
// DataHandlers
toggle(key: string, setDate: boolean) {
- this.toggleStateAction({
+ this.toggleState({
id: this.currentRecipeID,
key,
setDate,
@@ -844,22 +799,14 @@ export default {
setRating(r) {
if (r !== this.recipe.rating || r === 1) {
if (this.recipe.rating == 1 && r == 1) r = 0;
- this.setRatingAction({
+ this.setR({
id: this.currentRecipeID,
- rating: r,
+ r,
});
}
},
// ShoppingList
- toggleCart() {
- if (!this.recipe.inBag) {
- } else {
- }
- this.toggleCartAction({
- id: this.currentRecipeID,
- });
- },
// Notes
createNote(note) {
diff --git a/app/components/modals/Action.vue b/app/components/modals/Action.vue
index 0304c386..d467ea3a 100644
--- a/app/components/modals/Action.vue
+++ b/app/components/modals/Action.vue
@@ -80,10 +80,10 @@ export default {
};
},
computed: {
- ...mapState(["sortType", "icon", "theme", "RTL"]),
+ ...mapState(["icon", "theme", "RTL"]),
},
methods: {
- ...mapActions(["removeListItemAction", "deleteTimerPreset"]),
+ ...mapActions(["removeLI", "deleteTP"]),
localized(item: string): string {
return this.title !== "lang" ? localize(item) : item;
},
@@ -114,22 +114,22 @@ export default {
let vm = this;
let index = this.newList.findIndex((e) => e === item);
let localizedItem = `"${localize(item)}"`;
- function removeListItem(listName: string, desc: string): void {
+ function removeLI(listName: string, desc: string): void {
vm.removeConfirmation(`${localize(desc, localizedItem)}`).then(
(action: boolean) => {
if (action)
- vm.removeListItemAction({
+ vm.removeLI({
item,
listName,
});
}
);
}
- function deleteTimerPreset(): void {
+ function deleteTP(): void {
vm.deletionConfirmation(`${localize("delPrst", `"${item}"`)}`).then(
(action: boolean) => {
if (action) {
- vm.deleteTimerPreset(index);
+ vm.deleteTP(index);
vm.newList.splice(index, 1);
}
}
@@ -137,19 +137,19 @@ export default {
}
switch (this.title) {
case "cui":
- removeListItem("cuisines", "rmCuiInfo");
+ removeLI("cuisines", "rmCuiInfo");
break;
case "cat":
- removeListItem("categories", "rmCatInfo");
+ removeLI("categories", "rmCatInfo");
break;
case "yieldU":
- removeListItem("yieldUnits", "rmYUInfo");
+ removeLI("yieldUnits", "rmYUInfo");
break;
case "Unit":
- removeListItem("units", "rmUInfo");
+ removeLI("units", "rmUInfo");
break;
case "prsts":
- deleteTimerPreset();
+ deleteTP();
break;
}
},
diff --git a/app/components/modals/Confirm.vue b/app/components/modals/Confirm.vue
index b0c39776..b952b62c 100644
--- a/app/components/modals/Confirm.vue
+++ b/app/components/modals/Confirm.vue
@@ -1,15 +1,11 @@
-
+
diff --git a/app/components/modals/Filter.vue b/app/components/modals/Filter.vue
index b342a363..a96ff09d 100644
--- a/app/components/modals/Filter.vue
+++ b/app/components/modals/Filter.vue
@@ -173,7 +173,7 @@ export default {
},
},
methods: {
- ...mapActions(["setCuisine", "setCategory", "setTag", "clearFilter"]),
+ ...mapActions(["setCuisine", "setCategory", "setTag"]),
pgLoad(args) {
this.mLoad(args);
this.localCuisine = this.selCuisine;
diff --git a/app/components/modals/TimePickerHMS.vue b/app/components/modals/TimePickerHMS.vue
index 17763902..99421cf8 100644
--- a/app/components/modals/TimePickerHMS.vue
+++ b/app/components/modals/TimePickerHMS.vue
@@ -57,7 +57,7 @@
col="3"
class="text tb st fb"
:text="action | L"
- @tap="sendRespose"
+ @tap="respond"
/>
@@ -122,7 +122,7 @@ export default {
object.focus();
setTimeout(() => Utils.ad.showSoftInput(object.android), 100);
},
- sendRespose() {
+ respond() {
this.$modal.close({
label: this.setLabel ? this.setLabel : this.label,
time: this.selectedTime,
diff --git a/app/components/modals/TimerReminder.vue b/app/components/modals/TimerReminder.vue
index bd6d116f..4384ca35 100644
--- a/app/components/modals/TimerReminder.vue
+++ b/app/components/modals/TimerReminder.vue
@@ -21,7 +21,7 @@
:timerAlert="timerAlert"
:showToast="showToast"
/>
-
+
@@ -42,10 +42,9 @@
import { Application, Screen, Device, Color, Utils } from "@nativescript/core";
import Timer from "../sub/Timer.vue";
import * as utils from "~/shared/utils";
-import { mapState, mapActions } from "vuex";
+import { mapState } from "vuex";
const windowMgr = android.view.WindowManager;
-const View = android.view.View as any;
-const ViewGroup = android.view.ViewGroup;
+
export default {
components: { Timer },
props: [
@@ -56,12 +55,12 @@ export default {
"showToast",
],
computed: {
- ...mapState(["icon", "theme", "activeTimers"]),
+ ...mapState(["icon", "theme", "activeTs"]),
screenWidth() {
return Screen.mainScreen.widthDIPs;
},
timers() {
- let timers = this.activeTimers.filter((e) => e.done);
+ let timers = this.activeTs.filter((e) => e.done);
if (!timers.length) {
this.$modal.close(1);
this.isScreenLocked && this.turnOffScreen();
@@ -81,7 +80,6 @@ export default {
},
},
methods: {
- ...mapActions(["clearTimerInterval"]),
pgLoad({ object }) {
let dialog = object._dialogFragment.getDialog();
let dialogWindow = dialog.getWindow();
diff --git a/app/components/settings/About.vue b/app/components/settings/About.vue
index 455426bb..7accd14f 100644
--- a/app/components/settings/About.vue
+++ b/app/components/settings/About.vue
@@ -6,16 +6,16 @@
-
-
+
+
-
+
-
+
-
+
e.n == this.timerDelay)
- ].l,
+ this.delayList[this.delayList.findIndex((e) => e.n == this.timerD)]
+ .l,
action: this.showDelayList,
},
...list,
@@ -87,14 +86,14 @@ export default {
...Array.from(Array(6), (_, x) => (x + 1) * 5),
].map((e) => {
return {
- l: `${this.getLocaleN(e)} ${localize(e > 1 ? "minutes" : "minute")}`,
+ l: `${this.localeN(e)} ${localize(e > 1 ? "minutes" : "minute")}`,
n: e,
};
});
},
},
methods: {
- ...mapActions(["setTimerDelay", "setTimerSound", "setTimerVibrate"]),
+ ...mapActions(["setTD", "setTS", "setTV"]),
pgLoad({ object }) {
object.bindingContext = new Observable();
ApplicationSettings.setNumber("isTimer", 2);
@@ -104,12 +103,12 @@ export default {
props: {
title: "dlyDur",
list: this.delayList.map((e) => e.l),
- selected: this.delayList.findIndex((e) => e.n == this.timerDelay),
+ selected: this.delayList.findIndex((e) => e.n == this.timerD),
},
}).then(
(res) =>
res &&
- this.setTimerDelay(
+ this.setTD(
this.delayList[this.delayList.findIndex((e) => e.l == res)].n
)
);
@@ -121,18 +120,18 @@ export default {
title: "tmrSnd",
list: getTones.tones.map((e) => e.title),
selected: getTones.tones.findIndex(
- (e) => e.title == this.timerSound.title
+ (e) => e.title == this.timerS.title
),
},
}).then(
(tone) =>
tone &&
- tone !== this.timerSound.title &&
- this.setTimerSound(getTones.tones.filter((e) => e.title === tone)[0])
+ tone !== this.timerS.title &&
+ this.setTS(getTones.tones.filter((e) => e.title === tone)[0])
);
},
toggleTimerVibrate() {
- this.setTimerVibrate(!this.timerVibrate | 0);
+ this.setTV(!this.timerV | 0);
},
openNotificationChannelSettings() {
const ctx = Application.android.context;
@@ -147,8 +146,6 @@ export default {
intent.setFlags(android.content.Intent.FLAG_ACTIVITY_NEW_TASK);
ctx.startActivity(intent);
},
-
- // HELPERS
channelExists() {
if (Device.sdkVersion * 1 >= 26) {
const ctx = Utils.ad.getApplicationContext();
diff --git a/app/components/settings/Database.vue b/app/components/settings/Database.vue
index 1f2d7185..0c3bb5bb 100644
--- a/app/components/settings/Database.vue
+++ b/app/components/settings/Database.vue
@@ -75,7 +75,7 @@ export default {
"yieldUnits",
"units",
"mealPlans",
- "importSummary",
+ "impSum",
"RTL",
]),
items() {
@@ -108,14 +108,14 @@ export default {
},
methods: {
...mapActions([
- "importListItems",
- "importRecipesFromJSON",
- "importRecipesFromDB",
- "importMealPlansFromJSON",
- "importMealPlansFromDB",
- "importTimerPresets",
- "unlinkBrokenImages",
- "clearImportSummary",
+ "importLIs",
+ "importRsJSON",
+ "importRsDB",
+ "importMPsJSON",
+ "importMPsDB",
+ "importTPs",
+ "unLinkBIs",
+ "clearIS",
]),
pgLoad({ object }) {
object.bindingContext = new Observable();
@@ -144,10 +144,8 @@ export default {
android.content.Intent.FLAG_GRANT_READ_URI_PERMISSION |
android.content.Intent.FLAG_GRANT_WRITE_URI_PERMISSION;
utils.getBackupFolder().then((uri) => {
- console.log(uri.toString());
if (uri != null) {
// ReleaseExistingPermissions
-
if (this.backupFolder && this.backupFolder != uri.toString())
ContentResolver.releasePersistableUriPermission(
new android.net.Uri.parse(this.backupFolder),
@@ -256,7 +254,7 @@ export default {
function importImages() {
const timer = setInterval(() => {
if (!vm.progress) clearInterval(timer);
- if (vm.progress && vm.importSummary.found) {
+ if (vm.progress && vm.impSum.found) {
Folder.exists(images)
? vm.importImages(uri)
: vm.showImportSummary();
@@ -270,8 +268,6 @@ export default {
importImages();
} else if (File.exists(recipes)) {
// IMPORT FROM JSON FILES
- console.log("import from json");
-
this.isFileDataValid([
{
path: recipes,
@@ -309,7 +305,6 @@ export default {
} else this.failedImport(localize("buInc"));
},
isFileDataValid(file) {
- console.log("isFileDataValid");
const files = file.filter((e) => File.exists(e.path));
if (files.length) {
let isValid = files.map(() => 0);
@@ -362,7 +357,7 @@ export default {
// Import recipes
db.select("SELECT * FROM recipes").then((res) => {
- this.importRecipesFromDB(res);
+ this.importRsDB(res);
});
// Import listitems
@@ -370,7 +365,7 @@ export default {
`SELECT cuisines, categories, yieldUnits, units FROM lists`
).then((res) =>
Object.keys(res[0]).forEach((listName) =>
- this.importListItems({
+ this.importLIs({
data: JSON.parse(res[0][listName]),
listName,
})
@@ -379,46 +374,45 @@ export default {
// Import mealPlans
db.select(`SELECT * FROM mealPlans`).then((res) =>
- this.importMealPlansFromDB(res)
+ this.importMPsDB(res)
);
- // Import timerPresets
+ // Import timerPs
db.select(`SELECT * FROM timerPresets`).then((res) =>
- this.importTimerPresets(res)
+ this.importTPs(res)
);
},
importData(data, db) {
- console.log("importing");
switch (db) {
case "recipes":
- this.importRecipesFromJSON(data);
+ this.importRsJSON(data);
break;
case "userCuisines":
- this.importListItems({
+ this.importLIs({
data,
listName: "cuisines",
});
break;
case "userCategories":
- this.importListItems({
+ this.importLIs({
data,
listName: "categories",
});
break;
case "userYieldUnits":
- this.importListItems({
+ this.importLIs({
data,
listName: "yieldUnits",
});
break;
case "userUnits":
- this.importListItems({
+ this.importLIs({
data,
listName: "units",
});
break;
case "mealPlans":
- this.importMealPlansFromJSON(data);
+ this.importMPsJSON(data);
break;
}
},
@@ -437,14 +431,14 @@ export default {
});
});
this.showImportSummary();
- this.unlinkBrokenImages();
+ this.unLinkBIs();
}
});
},
showImportSummary() {
this.progress = null;
this.releaseBackEvent();
- let { found, imported, updated } = this.importSummary;
+ let { found, imported, updated } = this.impSum;
let exists = Math.abs(found - imported - updated) + updated;
let importedNote = `\n${localize("recI")} ${imported}`;
let existsNote = `\n${localize("recE")} ${exists}`;
@@ -457,7 +451,7 @@ export default {
)}\n${importedNote}${existsNote}${updatedNote}`,
okButtonText: "OK",
},
- }).then(() => this.clearImportSummary());
+ }).then(() => this.clearIS());
},
// NAVIGATION HANDLERS
diff --git a/app/components/settings/Interface.vue b/app/components/settings/Interface.vue
index b604c16c..1cff751e 100644
--- a/app/components/settings/Interface.vue
+++ b/app/components/settings/Interface.vue
@@ -32,7 +32,7 @@ export default {
};
},
computed: {
- ...mapState(["icon", "language", "theme", "layout", "RTL"]),
+ ...mapState(["icon", "langs", "theme", "layout", "RTL"]),
items() {
return [
{},
@@ -65,13 +65,13 @@ export default {
},
},
methods: {
- ...mapActions(["setTheme", "setLayout", "setRTL"]),
+ ...mapActions(["setT", "setL", "setRTL"]),
pgLoad({ object }) {
object.bindingContext = new Observable();
},
- // LANGUAGE SELECTION
+ // LanguageSelection
setAppLang() {
- let languages = this.language.map((e) => e.title);
+ let languages = this.langs.map((e) => e.title);
this.$showModal(Action, {
props: {
title: "lang",
@@ -84,8 +84,7 @@ export default {
"appLocale",
"none"
).split("-");
- let locale = this.language.filter((e) => e.title === action)[0]
- .locale;
+ let locale = this.langs.filter((e) => e.title === action)[0].locale;
if (currentLocale !== locale) {
this.applang = action;
ApplicationSettings.setString("applang", action);
@@ -97,7 +96,7 @@ export default {
}
});
},
- // THEME SELECTION
+ // ThemeSelection
selectThemes() {
this.$showModal(Action, {
props: {
@@ -112,12 +111,12 @@ export default {
? 1
: this.theme != action)
) {
- this.setTheme(action);
+ this.setT(action);
Frame.reloadPage();
}
});
},
- // LAYOUT MODE
+ // LayoutMode
setLayoutMode() {
this.$showModal(Action, {
props: {
@@ -126,7 +125,7 @@ export default {
selected: this.layout,
},
}).then((mode) => {
- if (mode && this.layout !== mode) this.setLayout(mode.toLowerCase());
+ if (mode && this.layout !== mode) this.setL(mode.toLowerCase());
});
},
},
diff --git a/app/components/settings/MPSettings.vue b/app/components/settings/MPSettings.vue
index 898f46ed..fe10400d 100644
--- a/app/components/settings/MPSettings.vue
+++ b/app/components/settings/MPSettings.vue
@@ -26,7 +26,7 @@ import { localize } from "@nativescript/localize";
export default {
components: { OptionsList },
computed: {
- ...mapState(["icon", "mondayFirst", "RTL", "plannerView", "planDeletion"]),
+ ...mapState(["icon", "startMon", "RTL", "plannerV", "planDel"]),
items() {
return [
{},
@@ -34,21 +34,21 @@ export default {
type: "list",
icon: "calv",
title: "calVM",
- subTitle: localize(this.plannerView),
+ subTitle: localize(this.plannerV),
action: this.selectPlannerView,
},
{
type: "switch",
icon: "week",
title: "swm",
- checked: !!this.mondayFirst,
+ checked: !!this.startMon,
action: this.toggleFirstDay,
},
{
type: "list",
icon: "mpd",
title: "admp",
- subTitle: localize(this.planDeletion),
+ subTitle: localize(this.planDel),
action: this.selectDeletionTime,
},
{},
@@ -56,22 +56,22 @@ export default {
},
},
methods: {
- ...mapActions(["setFirstDay", "setPlannerView", "setPlanDeletion"]),
+ ...mapActions(["setFD", "setPlannerV", "setPlanDel"]),
pgLoad({ object }) {
object.bindingContext = new Observable();
},
toggleFirstDay() {
- this.setFirstDay(!this.mondayFirst | 0);
+ this.setFD(!this.startMon | 0);
},
selectPlannerView() {
this.$showModal(Action, {
props: {
title: "calVM",
list: ["d", "wk", "mnth"],
- selected: this.plannerView,
+ selected: this.plannerV,
},
}).then((res) => {
- if (res && this.plannerView != res) this.setPlannerView(res);
+ if (res && this.plannerV != res) this.setPlannerV(res);
});
},
selectDeletionTime() {
@@ -79,10 +79,10 @@ export default {
props: {
title: "admp",
list: ["otaw", "otam", "otay", "nvr"],
- selected: this.planDeletion,
+ selected: this.planDel,
},
}).then((res) => {
- if (res && this.planDeletion != res) this.setPlanDeletion(res);
+ if (res && this.planDel != res) this.setPlanDel(res);
});
},
},
diff --git a/app/components/settings/Options.vue b/app/components/settings/Options.vue
index 8cea49fb..f706824a 100644
--- a/app/components/settings/Options.vue
+++ b/app/components/settings/Options.vue
@@ -42,7 +42,7 @@ export default {
};
},
computed: {
- ...mapState(["icon", "shake", "RTL", "edgeSwipe", "awakeViewer"]),
+ ...mapState(["icon", "shake", "RTL", "edgeS", "awakeV"]),
items() {
return [
{},
@@ -59,7 +59,7 @@ export default {
icon: "awake",
title: "ksavr",
subTitle: localize("ksavrInfo"),
- checked: !!this.awakeViewer,
+ checked: !!this.awakeV,
action: this.toggleAwake,
},
{
@@ -67,7 +67,7 @@ export default {
icon: "edge",
title: "esgb",
subTitle: localize("esgbInfo"),
- checked: !!this.edgeSwipe,
+ checked: !!this.edgeS,
action: this.toggleSwipe,
},
{},
@@ -75,7 +75,7 @@ export default {
},
},
methods: {
- ...mapActions(["setShake", "toggleEdgeSwipe", "toggleAwakeViewer"]),
+ ...mapActions(["setS", "toggleEdgeS", "toggleAwakeV"]),
pgLoad({ object }) {
object.bindingContext = new Observable();
},
@@ -90,13 +90,13 @@ export default {
let checked = this.shake;
if (checked && !utils.hasAccelerometer())
this.showToast(localize("noAccSensor"));
- else this.setShake(+!checked);
+ else this.setS(+!checked);
},
toggleSwipe() {
- this.toggleEdgeSwipe(+!this.edgeSwipe);
+ this.toggleEdgeS(+!this.edgeS);
},
toggleAwake() {
- this.toggleAwakeViewer(+!this.awakeViewer);
+ this.toggleAwakeV(+!this.awakeV);
},
showToast(data) {
diff --git a/app/components/settings/Reset.vue b/app/components/settings/Reset.vue
index d81d0b92..4e5588f4 100644
--- a/app/components/settings/Reset.vue
+++ b/app/components/settings/Reset.vue
@@ -1,7 +1,7 @@
-
+
-
+
diff --git a/app/components/sub/Timer.vue b/app/components/sub/Timer.vue
index 3f53e68a..0ccd8d10 100644
--- a/app/components/sub/Timer.vue
+++ b/app/components/sub/Timer.vue
@@ -82,7 +82,7 @@ export default {
};
},
computed: {
- ...mapState(["icon", "recipes", "timerDelay", "timerPresets", "RTL"]),
+ ...mapState(["icon", "recipes", "timerD", "timerPs", "RTL"]),
getRecipeTitle() {
let { recipeID } = this.timer;
if (recipeID) {
@@ -137,12 +137,7 @@ export default {
},
},
methods: {
- ...mapActions([
- "removeActiveTimer",
- "addTimerPreset",
- "deleteTimerPreset",
- "sortActiveTimers",
- ]),
+ ...mapActions(["addTP", "sortATs"]),
pLoaded({ object }) {
this.pBar = object.android;
this.pBar.setRotation(
@@ -165,7 +160,7 @@ export default {
} else if (res) {
let timer = this.timer;
timer.recipeID = res;
- this.sortActiveTimers();
+ this.sortATs();
}
});
},
@@ -211,7 +206,7 @@ export default {
this.timer.isPaused ? this.resetInterval() : this.initTimer();
},
addPreset() {
- let exist = this.timerPresets.some((e) => e.id == this.timer.id);
+ let exist = this.timerPs.some((e) => e.id == this.timer.id);
this.timer.preset = 1;
if (this.countUp) {
this.timer.time = new Date(this.count * 1000)
@@ -221,14 +216,14 @@ export default {
let timer = JSON.parse(JSON.stringify(this.timer));
let { recipeID, timerInt, isPaused, preset, done, mode, ...presetTimer } =
timer;
- this.addTimerPreset(presetTimer);
+ this.addTP(presetTimer);
exist ? this.showToast("prstTU") : this.showToast("aTPrst");
},
addDelay() {
this.timer.done = 0;
- let td = this.timerDelay;
+ let td = this.timerD;
let delayDur =
- this.getLocaleN(td) + " " + localize(td > 1 ? "minutes" : "minute");
+ this.localeN(td) + " " + localize(td > 1 ? "minutes" : "minute");
this.showToast(localize("wDBy", this.timer.label, delayDur));
let delay = td * 60;
if (this.done) this.delay = delay;
diff --git a/app/main.ts b/app/main.ts
index 67e20a23..b0e6ca4f 100644
--- a/app/main.ts
+++ b/app/main.ts
@@ -40,15 +40,15 @@ Vue.filter('L', localize)
const initFrame = () => {
const s = store
// MainInit
- s.commit('setTheme', getString('theme', 'sysDef'))
- s.commit('initRecipes')
- s.commit('initMealPlans')
- s.commit('initListItems')
- s.commit('initTimerPresets')
- if (!Object.keys(s.state.timerSound).length) {
- let hasTimerSound = getString('timerSound', null)
+ s.commit('setT', getString('theme', 'sysDef'))
+ s.commit('initRs')
+ s.commit('initMPs')
+ s.commit('initLIs')
+ s.commit('initTPs')
+ if (!Object.keys(s.state.timerS).length) {
+ let hasTimerSound = getString('timerS', null)
s.commit(
- 'setTimerSound',
+ 'setTS',
hasTimerSound ? JSON.parse(hasTimerSound) : utils.getTones().defaultTone
)
}
diff --git a/app/store.ts b/app/store.ts
index 2d25ed0e..3bf75ee8 100644
--- a/app/store.ts
+++ b/app/store.ts
@@ -1051,7 +1051,7 @@ export default new Vuex.Store({
// DeleteMealPlan
deleteMP(
state,
- { id, index, inDB }: { id: string; index: number; inDB: number }
+ { id, index, inDB }: { id: string; index: number; inDB?: number }
) {
if (inDB) {
db.execute(`DELETE FROM mealPlans WHERE id = '${id}'`)
@@ -1074,9 +1074,9 @@ export default new Vuex.Store({
}
},
// UnLinkCombinations
- unLinkCs(state, { id, a }) {
+ unLinkCs(state, { id, combs }) {
state.recipes.forEach((e, i) => {
- if (a.includes(e.id)) {
+ if (combs.includes(e.id)) {
state.recipes[i].combinations.splice(e.combinations.indexOf(id), 1)
db.execute(
`UPDATE recipes SET combinations = '${JSON.stringify(
@@ -1092,10 +1092,10 @@ export default new Vuex.Store({
setNumber('shake', n)
},
// SetRating
- setR(state, { id, rating }) {
+ setR(state, { id, r }) {
let i = state.recipes.findIndex((e) => e.id == id)
- state.recipes[i].rating = rating
- db.execute(`UPDATE recipes SET rating = ${rating} WHERE id = '${id}'`)
+ state.recipes[i].rating = r
+ db.execute(`UPDATE recipes SET rating = ${r} WHERE id = '${id}'`)
},
// UnLinkBrokenImages
unLinkBIs(state) {