refactor: make selection manager methods private

old-stable24
Varun Patil 2022-10-14 16:29:37 -07:00
parent b088730507
commit 0a7432bd2c
1 changed files with 14 additions and 14 deletions

View File

@ -144,7 +144,7 @@ export default class SelectionHandler extends Mixins(GlobalMixin) {
} }
/** Check if the day for a photo is selected entirely */ /** Check if the day for a photo is selected entirely */
updateHeadSelected(head: IHeadRow) { private updateHeadSelected(head: IHeadRow) {
let selected = true; let selected = true;
// Check if all photos are selected // Check if all photos are selected
@ -162,7 +162,7 @@ export default class SelectionHandler extends Mixins(GlobalMixin) {
} }
/** Add a photo to selection list */ /** Add a photo to selection list */
selectPhoto(photo: IPhoto, val?: boolean, noUpdate?: boolean) { public selectPhoto(photo: IPhoto, val?: boolean, noUpdate?: boolean) {
if (photo.flag & this.c.FLAG_PLACEHOLDER || if (photo.flag & this.c.FLAG_PLACEHOLDER ||
photo.flag & this.c.FLAG_IS_FOLDER || photo.flag & this.c.FLAG_IS_FOLDER ||
photo.flag & this.c.FLAG_IS_TAG photo.flag & this.c.FLAG_IS_TAG
@ -186,7 +186,7 @@ export default class SelectionHandler extends Mixins(GlobalMixin) {
} }
/** Select or deselect all photos in a head */ /** Select or deselect all photos in a head */
selectHead(head: IHeadRow) { public selectHead(head: IHeadRow) {
head.selected = !head.selected; head.selected = !head.selected;
for (const row of head.day.rows) { for (const row of head.day.rows) {
for (const photo of row.photos) { for (const photo of row.photos) {
@ -199,7 +199,7 @@ export default class SelectionHandler extends Mixins(GlobalMixin) {
/** /**
* Download the currently selected files * Download the currently selected files
*/ */
async downloadSelection() { private async downloadSelection() {
if (this.selection.size >= 100) { if (this.selection.size >= 100) {
if (!confirm(this.t("memories", "You are about to download a large number of files. Are you sure?"))) { if (!confirm(this.t("memories", "You are about to download a large number of files. Are you sure?"))) {
return; return;
@ -211,14 +211,14 @@ export default class SelectionHandler extends Mixins(GlobalMixin) {
/** /**
* Check if all files selected currently are favorites * Check if all files selected currently are favorites
*/ */
allSelectedFavorites() { private allSelectedFavorites() {
return Array.from(this.selection.values()).every(p => p.flag & this.c.FLAG_IS_FAVORITE); return Array.from(this.selection.values()).every(p => p.flag & this.c.FLAG_IS_FAVORITE);
} }
/** /**
* Favorite the currently selected photos * Favorite the currently selected photos
*/ */
async favoriteSelection() { private async favoriteSelection() {
try { try {
const val = !this.allSelectedFavorites(); const val = !this.allSelectedFavorites();
this.updateLoading(1); this.updateLoading(1);
@ -245,7 +245,7 @@ export default class SelectionHandler extends Mixins(GlobalMixin) {
/** /**
* Delete the currently selected photos * Delete the currently selected photos
*/ */
async deleteSelection() { private async deleteSelection() {
if (this.selection.size >= 100) { if (this.selection.size >= 100) {
if (!confirm(this.t("memories", "You are about to delete a large number of files. Are you sure?"))) { if (!confirm(this.t("memories", "You are about to delete a large number of files. Are you sure?"))) {
return; return;
@ -268,7 +268,7 @@ export default class SelectionHandler extends Mixins(GlobalMixin) {
/** /**
* Open the edit date dialog * Open the edit date dialog
*/ */
async editDateSelection() { private async editDateSelection() {
(<any>this.$refs.editDate).open(Array.from(this.selection.values())); (<any>this.$refs.editDate).open(Array.from(this.selection.values()));
} }
@ -276,7 +276,7 @@ export default class SelectionHandler extends Mixins(GlobalMixin) {
* Open the files app with the selected file (one) * Open the files app with the selected file (one)
* Opens a new window. * Opens a new window.
*/ */
async viewInFolder() { private async viewInFolder() {
if (this.selection.size !== 1) return; if (this.selection.size !== 1) return;
const photo: IPhoto = this.selection.values().next().value; const photo: IPhoto = this.selection.values().next().value;
@ -292,7 +292,7 @@ export default class SelectionHandler extends Mixins(GlobalMixin) {
/** /**
* Archive the currently selected photos * Archive the currently selected photos
*/ */
async archiveSelection() { private async archiveSelection() {
if (this.selection.size >= 100) { if (this.selection.size >= 100) {
if (!confirm(this.t("memories", "You are about to touch a large number of files. Are you sure?"))) { if (!confirm(this.t("memories", "You are about to touch a large number of files. Are you sure?"))) {
return; return;
@ -317,7 +317,7 @@ export default class SelectionHandler extends Mixins(GlobalMixin) {
} }
/** Archive is allowed only on timeline routes */ /** Archive is allowed only on timeline routes */
allowArchive() { private allowArchive() {
return this.$route.name === 'timeline' || return this.$route.name === 'timeline' ||
this.$route.name === 'favorites' || this.$route.name === 'favorites' ||
this.$route.name === 'videos' || this.$route.name === 'videos' ||
@ -326,14 +326,14 @@ export default class SelectionHandler extends Mixins(GlobalMixin) {
} }
/** Is archive route */ /** Is archive route */
routeIsArchive() { private routeIsArchive() {
return this.$route.name === 'archive'; return this.$route.name === 'archive';
} }
/** /**
* Remove currently selected photos from person * Remove currently selected photos from person
*/ */
async removeSelectionFromPerson() { private async removeSelectionFromPerson() {
// Make sure route is valid // Make sure route is valid
const { user, name } = this.$route.params; const { user, name } = this.$route.params;
if (this.$route.name !== "people" || !user || !name) { if (this.$route.name !== "people" || !user || !name) {