Change folder tag to int

pull/62/head
Varun Patil 2022-09-16 14:37:52 -07:00
parent 2853db1b66
commit eaeb7af274
5 changed files with 20 additions and 6 deletions

View File

@ -203,7 +203,7 @@ class ApiController extends Controller {
// Map sub to JSON array
$subdirArray = [
"dayid" => -0.1,
"dayid" => \OCA\Memories\Util::$TAG_DAYID_FOLDERS,
"detail" => array_map(function ($node) {
return [
"fileid" => $node->getId(),

View File

@ -7,6 +7,9 @@ use OCA\Memories\AppInfo\Application;
use OCP\IConfig;
class Util {
public static $TAG_DAYID_START = -(1 << 30); // the world surely didn't exist
public static $TAG_DAYID_FOLDERS = -(1 << 30) + 1;
/**
* Get the path to the user's configured photos directory.
* @param IConfig $config

View File

@ -308,7 +308,7 @@ export default class Timeline extends Mixins(GlobalMixin) {
this.rowHeight = Math.floor(width / this.numCols);
// Set heights of rows
this.list.filter(r => r.type === IRowType.PHOTOS).forEach(row => {
this.list.filter(r => r.type !== IRowType.HEAD).forEach(row => {
row.size = this.rowHeight;
});
this.reflowTimeline(true);
@ -432,8 +432,8 @@ export default class Timeline extends Mixins(GlobalMixin) {
}
// Special headers
if (head.dayId === -0.1) {
head.name = "Folders";
if (head.dayId === this.TagDayID.FOLDERS) {
head.name = this.t("memories", "Folders");
return head.name;
}
@ -803,10 +803,15 @@ export default class Timeline extends Mixins(GlobalMixin) {
/** Get a new blank photos row */
getBlankRow(day: IDay): IRow {
let rowType = IRowType.PHOTOS;
if (day.dayid === this.TagDayID.FOLDERS) {
rowType = IRowType.FOLDERS;
}
return {
id: ++this.numRows,
photos: [],
type: IRowType.PHOTOS,
type: rowType,
size: this.rowHeight,
dayId: day.dayid,
day: day,
@ -882,7 +887,7 @@ export default class Timeline extends Mixins(GlobalMixin) {
/** Add a photo to selection list */
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) {
return; // ignore placeholders
}

View File

@ -19,4 +19,9 @@ export default class GlobalMixin extends Vue {
FLAG_ENTER_RIGHT: 1 << 9,
FLAG_FORCE_RELOAD: 1 << 10,
}
public readonly TagDayID = {
START: -(1 << 30),
FOLDERS: -(1 << 30) + 1,
}
}

View File

@ -74,6 +74,7 @@ export type IHeadRow = IRow & {
export enum IRowType {
HEAD = 0,
PHOTOS = 1,
FOLDERS = 2,
}
export type ITick = {