Change folder tag to int
parent
2853db1b66
commit
eaeb7af274
|
@ -203,7 +203,7 @@ class ApiController extends Controller {
|
||||||
|
|
||||||
// Map sub to JSON array
|
// Map sub to JSON array
|
||||||
$subdirArray = [
|
$subdirArray = [
|
||||||
"dayid" => -0.1,
|
"dayid" => \OCA\Memories\Util::$TAG_DAYID_FOLDERS,
|
||||||
"detail" => array_map(function ($node) {
|
"detail" => array_map(function ($node) {
|
||||||
return [
|
return [
|
||||||
"fileid" => $node->getId(),
|
"fileid" => $node->getId(),
|
||||||
|
|
|
@ -7,6 +7,9 @@ use OCA\Memories\AppInfo\Application;
|
||||||
use OCP\IConfig;
|
use OCP\IConfig;
|
||||||
|
|
||||||
class Util {
|
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.
|
* Get the path to the user's configured photos directory.
|
||||||
* @param IConfig $config
|
* @param IConfig $config
|
||||||
|
|
|
@ -308,7 +308,7 @@ export default class Timeline extends Mixins(GlobalMixin) {
|
||||||
this.rowHeight = Math.floor(width / this.numCols);
|
this.rowHeight = Math.floor(width / this.numCols);
|
||||||
|
|
||||||
// Set heights of rows
|
// 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;
|
row.size = this.rowHeight;
|
||||||
});
|
});
|
||||||
this.reflowTimeline(true);
|
this.reflowTimeline(true);
|
||||||
|
@ -432,8 +432,8 @@ export default class Timeline extends Mixins(GlobalMixin) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Special headers
|
// Special headers
|
||||||
if (head.dayId === -0.1) {
|
if (head.dayId === this.TagDayID.FOLDERS) {
|
||||||
head.name = "Folders";
|
head.name = this.t("memories", "Folders");
|
||||||
return head.name;
|
return head.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -803,10 +803,15 @@ export default class Timeline extends Mixins(GlobalMixin) {
|
||||||
|
|
||||||
/** Get a new blank photos row */
|
/** Get a new blank photos row */
|
||||||
getBlankRow(day: IDay): IRow {
|
getBlankRow(day: IDay): IRow {
|
||||||
|
let rowType = IRowType.PHOTOS;
|
||||||
|
if (day.dayid === this.TagDayID.FOLDERS) {
|
||||||
|
rowType = IRowType.FOLDERS;
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id: ++this.numRows,
|
id: ++this.numRows,
|
||||||
photos: [],
|
photos: [],
|
||||||
type: IRowType.PHOTOS,
|
type: rowType,
|
||||||
size: this.rowHeight,
|
size: this.rowHeight,
|
||||||
dayId: day.dayid,
|
dayId: day.dayid,
|
||||||
day: day,
|
day: day,
|
||||||
|
@ -882,7 +887,7 @@ export default class Timeline extends Mixins(GlobalMixin) {
|
||||||
|
|
||||||
/** Add a photo to selection list */
|
/** Add a photo to selection list */
|
||||||
selectPhoto(photo: IPhoto, val?: boolean, noUpdate?: boolean) {
|
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
|
return; // ignore placeholders
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,4 +19,9 @@ export default class GlobalMixin extends Vue {
|
||||||
FLAG_ENTER_RIGHT: 1 << 9,
|
FLAG_ENTER_RIGHT: 1 << 9,
|
||||||
FLAG_FORCE_RELOAD: 1 << 10,
|
FLAG_FORCE_RELOAD: 1 << 10,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public readonly TagDayID = {
|
||||||
|
START: -(1 << 30),
|
||||||
|
FOLDERS: -(1 << 30) + 1,
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -74,6 +74,7 @@ export type IHeadRow = IRow & {
|
||||||
export enum IRowType {
|
export enum IRowType {
|
||||||
HEAD = 0,
|
HEAD = 0,
|
||||||
PHOTOS = 1,
|
PHOTOS = 1,
|
||||||
|
FOLDERS = 2,
|
||||||
}
|
}
|
||||||
|
|
||||||
export type ITick = {
|
export type ITick = {
|
||||||
|
|
Loading…
Reference in New Issue