refactor: revert constants rename
Signed-off-by: Varun Patil <radialapps@gmail.com>pull/877/head
parent
2c18198c37
commit
0741eeb113
|
@ -13,7 +13,7 @@ import VueVirtualScroller from 'vue-virtual-scroller';
|
||||||
|
|
||||||
// Locals
|
// Locals
|
||||||
import router from './router';
|
import router from './router';
|
||||||
import { c, initState } from './services/utils';
|
import { constants, initstate } from './services/utils';
|
||||||
|
|
||||||
// CSS for components
|
// CSS for components
|
||||||
import 'vue-virtual-scroller/dist/vue-virtual-scroller.css';
|
import 'vue-virtual-scroller/dist/vue-virtual-scroller.css';
|
||||||
|
@ -67,7 +67,7 @@ Vue.component('XImg', XImg);
|
||||||
Vue.component('XLoadingIcon', XLoadingIcon);
|
Vue.component('XLoadingIcon', XLoadingIcon);
|
||||||
|
|
||||||
// Register global constants and functions
|
// Register global constants and functions
|
||||||
Vue.prototype.c = c;
|
Vue.prototype.c = constants;
|
||||||
Vue.prototype.initState = initState;
|
Vue.prototype.initstate = initstate;
|
||||||
Vue.prototype.t = translate;
|
Vue.prototype.t = translate;
|
||||||
Vue.prototype.n = translatePlural;
|
Vue.prototype.n = translatePlural;
|
||||||
|
|
|
@ -206,7 +206,7 @@ export default defineComponent({
|
||||||
icon: DownloadIcon,
|
icon: DownloadIcon,
|
||||||
callback: this.downloadSelection.bind(this),
|
callback: this.downloadSelection.bind(this),
|
||||||
allowPublic: true,
|
allowPublic: true,
|
||||||
if: () => !this.initState.noDownload,
|
if: () => !this.initstate.noDownload,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: t('memories', 'Favorite'),
|
name: t('memories', 'Favorite'),
|
||||||
|
|
|
@ -109,7 +109,7 @@ export default defineComponent({
|
||||||
},
|
},
|
||||||
|
|
||||||
isReal() {
|
isReal() {
|
||||||
return this.name && this.name !== utils.c.FACE_NULL;
|
return this.name && this.name !== this.c.FACE_NULL;
|
||||||
},
|
},
|
||||||
|
|
||||||
displayName() {
|
displayName() {
|
||||||
|
@ -138,7 +138,7 @@ export default defineComponent({
|
||||||
name: this.$route.name as string,
|
name: this.$route.name as string,
|
||||||
params: {
|
params: {
|
||||||
user: utils.uid as string,
|
user: utils.uid as string,
|
||||||
name: utils.c.FACE_NULL,
|
name: this.c.FACE_NULL,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import * as utils from '../../services/utils';
|
import * as utils from '../../services/utils';
|
||||||
|
|
||||||
// Shown in dynamic top matter (Timeline::viewName)
|
// Shown in dynamic top matter (Timeline::viewName)
|
||||||
export const title = utils.initState.shareTitle;
|
export const title = utils.initstate.shareTitle;
|
||||||
|
|
||||||
// Set up hook to monitor recycler scroll to show/hide header
|
// Set up hook to monitor recycler scroll to show/hide header
|
||||||
if (title) {
|
if (title) {
|
||||||
|
|
|
@ -90,7 +90,7 @@
|
||||||
:aria-label="t('memories', 'Download')"
|
:aria-label="t('memories', 'Download')"
|
||||||
@click="downloadCurrent"
|
@click="downloadCurrent"
|
||||||
:close-after-click="true"
|
:close-after-click="true"
|
||||||
v-if="!initState.noDownload && !isLocal"
|
v-if="!initstate.noDownload && !isLocal"
|
||||||
>
|
>
|
||||||
{{ t('memories', 'Download') }}
|
{{ t('memories', 'Download') }}
|
||||||
<template #icon>
|
<template #icon>
|
||||||
|
@ -98,7 +98,7 @@
|
||||||
</template>
|
</template>
|
||||||
</NcActionButton>
|
</NcActionButton>
|
||||||
<NcActionButton
|
<NcActionButton
|
||||||
v-if="!initState.noDownload && currentPhoto?.liveid"
|
v-if="!initstate.noDownload && currentPhoto?.liveid"
|
||||||
:aria-label="t('memories', 'Download Video')"
|
:aria-label="t('memories', 'Download Video')"
|
||||||
@click="downloadCurrentLiveVideo"
|
@click="downloadCurrentLiveVideo"
|
||||||
:close-after-click="true"
|
:close-after-click="true"
|
||||||
|
|
|
@ -7,7 +7,7 @@ import type PlyrType from 'plyr';
|
||||||
import type videojsType from 'video.js';
|
import type videojsType from 'video.js';
|
||||||
|
|
||||||
import type { IPhoto, IRow } from './types';
|
import type { IPhoto, IRow } from './types';
|
||||||
import type { c, initState } from './services/utils';
|
import type { constants, initstate } from './services/utils';
|
||||||
import type { GlobalRouteCheckers } from './router';
|
import type { GlobalRouteCheckers } from './router';
|
||||||
|
|
||||||
// Global exposed variables
|
// Global exposed variables
|
||||||
|
@ -101,8 +101,8 @@ declare module 'vue' {
|
||||||
t: typeof translate;
|
t: typeof translate;
|
||||||
n: typeof translatePlural;
|
n: typeof translatePlural;
|
||||||
|
|
||||||
c: typeof c;
|
c: typeof constants;
|
||||||
initState: typeof initState;
|
initstate: typeof initstate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ import SplitTimeline from './components/SplitTimeline.vue';
|
||||||
import ClusterView from './components/ClusterView.vue';
|
import ClusterView from './components/ClusterView.vue';
|
||||||
import NativeXSetup from './native/Setup.vue';
|
import NativeXSetup from './native/Setup.vue';
|
||||||
|
|
||||||
import { c } from './services/utils';
|
import { constants as c } from './services/utils';
|
||||||
|
|
||||||
// Routes are defined here
|
// Routes are defined here
|
||||||
export type RouteId =
|
export type RouteId =
|
||||||
|
|
|
@ -7,6 +7,7 @@ import { API } from '../API';
|
||||||
import { getAlbumFileInfos } from './albums';
|
import { getAlbumFileInfos } from './albums';
|
||||||
import client from './client';
|
import client from './client';
|
||||||
import * as utils from '../utils';
|
import * as utils from '../utils';
|
||||||
|
import { constants as c } from '../utils';
|
||||||
import * as nativex from '../../native';
|
import * as nativex from '../../native';
|
||||||
|
|
||||||
const GET_FILE_CHUNK_SIZE = 50;
|
const GET_FILE_CHUNK_SIZE = 50;
|
||||||
|
@ -233,7 +234,7 @@ export async function* deletePhotos(photos: IPhoto[], confirm: boolean = true) {
|
||||||
await nativex.deleteLocalPhotos(photos);
|
await nativex.deleteLocalPhotos(photos);
|
||||||
|
|
||||||
// Remove purely local files
|
// Remove purely local files
|
||||||
const deleted = photos.filter((p) => p.flag & utils.c.FLAG_IS_LOCAL);
|
const deleted = photos.filter((p) => p.flag & c.FLAG_IS_LOCAL);
|
||||||
|
|
||||||
// Yield for the fully local files
|
// Yield for the fully local files
|
||||||
if (deleted.length > 0) {
|
if (deleted.length > 0) {
|
||||||
|
|
|
@ -5,7 +5,7 @@ import { generateUrl } from '@nextcloud/router';
|
||||||
import { IFace, IPhoto } from '../../types';
|
import { IFace, IPhoto } from '../../types';
|
||||||
import { API } from '../API';
|
import { API } from '../API';
|
||||||
import client from './client';
|
import client from './client';
|
||||||
import * as utils from '../utils';
|
import { constants as c } from '../utils';
|
||||||
import * as base from './base';
|
import * as base from './base';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -93,7 +93,7 @@ export async function* recognizeMoveFaceImages(user: string, face: string, targe
|
||||||
|
|
||||||
// NULL source needs special handling
|
// NULL source needs special handling
|
||||||
let source = `/recognize/${user}/faces/${face}`;
|
let source = `/recognize/${user}/faces/${face}`;
|
||||||
if (face === utils.c.FACE_NULL) {
|
if (face === c.FACE_NULL) {
|
||||||
source = `/recognize/${user}/unassigned-faces`;
|
source = `/recognize/${user}/unassigned-faces`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { translate as t } from '@nextcloud/l10n';
|
||||||
import { IFileInfo, IPhoto } from '../../types';
|
import { IFileInfo, IPhoto } from '../../types';
|
||||||
import client from './client';
|
import client from './client';
|
||||||
import * as base from './base';
|
import * as base from './base';
|
||||||
import * as utils from '../utils';
|
import { constants as c } from '../utils';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Favorite a file
|
* Favorite a file
|
||||||
|
@ -83,8 +83,8 @@ export async function* favoritePhotos(photos: IPhoto[], favoriteState: boolean)
|
||||||
*/
|
*/
|
||||||
export function favoriteSetFlag(photo: IPhoto, val: boolean) {
|
export function favoriteSetFlag(photo: IPhoto, val: boolean) {
|
||||||
if (val) {
|
if (val) {
|
||||||
photo.flag |= utils.c.FLAG_IS_FAVORITE;
|
photo.flag |= c.FLAG_IS_FAVORITE;
|
||||||
} else {
|
} else {
|
||||||
photo.flag &= ~utils.c.FLAG_IS_FAVORITE;
|
photo.flag &= ~c.FLAG_IS_FAVORITE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { IDay } from '../../types';
|
import { IDay } from '../../types';
|
||||||
import * as utils from '../utils';
|
import { initstate } from '../utils';
|
||||||
|
|
||||||
const { singleItem } = utils.initState;
|
const { singleItem } = initstate;
|
||||||
|
|
||||||
export function isSingleItem(): boolean {
|
export function isSingleItem(): boolean {
|
||||||
return Boolean(singleItem?.fileid);
|
return Boolean(singleItem?.fileid);
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { IPhoto } from '../../types';
|
||||||
import { loadState } from '@nextcloud/initial-state';
|
import { loadState } from '@nextcloud/initial-state';
|
||||||
|
|
||||||
/** Global constants */
|
/** Global constants */
|
||||||
export const c = Object.freeze({
|
export const constants = Object.freeze({
|
||||||
// Flags for photos
|
// Flags for photos
|
||||||
FLAG_PLACEHOLDER: 1 << 0,
|
FLAG_PLACEHOLDER: 1 << 0,
|
||||||
FLAG_LOAD_FAIL: 1 << 1,
|
FLAG_LOAD_FAIL: 1 << 1,
|
||||||
|
@ -19,7 +19,7 @@ export const c = Object.freeze({
|
||||||
/**
|
/**
|
||||||
* Initial state pulled from Nextcloud's HTML page
|
* Initial state pulled from Nextcloud's HTML page
|
||||||
*/
|
*/
|
||||||
export const initState = Object.freeze({
|
export const initstate = Object.freeze({
|
||||||
noDownload: loadState('memories', 'no_download', false) !== false,
|
noDownload: loadState('memories', 'no_download', false) !== false,
|
||||||
shareTitle: loadState('memories', 'share_title', '') as string,
|
shareTitle: loadState('memories', 'share_title', '') as string,
|
||||||
singleItem: loadState('memories', 'single_item', null) as IPhoto | null,
|
singleItem: loadState('memories', 'single_item', null) as IPhoto | null,
|
||||||
|
@ -36,15 +36,15 @@ export function convertFlags(photo: IPhoto) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (photo.isvideo) {
|
if (photo.isvideo) {
|
||||||
photo.flag |= c.FLAG_IS_VIDEO;
|
photo.flag |= constants.FLAG_IS_VIDEO;
|
||||||
delete photo.isvideo;
|
delete photo.isvideo;
|
||||||
}
|
}
|
||||||
if (photo.isfavorite) {
|
if (photo.isfavorite) {
|
||||||
photo.flag |= c.FLAG_IS_FAVORITE;
|
photo.flag |= constants.FLAG_IS_FAVORITE;
|
||||||
delete photo.isfavorite;
|
delete photo.isfavorite;
|
||||||
}
|
}
|
||||||
if (photo.islocal) {
|
if (photo.islocal) {
|
||||||
photo.flag |= c.FLAG_IS_LOCAL;
|
photo.flag |= constants.FLAG_IS_LOCAL;
|
||||||
delete photo.islocal;
|
delete photo.islocal;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ export function copyPhotoFlags(src: IPhoto, dst: IPhoto) {
|
||||||
const copy = (flag: number) => (dst.flag = src.flag & flag ? dst.flag | flag : dst.flag & ~flag);
|
const copy = (flag: number) => (dst.flag = src.flag & flag ? dst.flag | flag : dst.flag & ~flag);
|
||||||
|
|
||||||
// copy all flags
|
// copy all flags
|
||||||
copy(c.FLAG_IS_VIDEO);
|
copy(constants.FLAG_IS_VIDEO);
|
||||||
copy(c.FLAG_IS_FAVORITE);
|
copy(constants.FLAG_IS_FAVORITE);
|
||||||
copy(c.FLAG_IS_LOCAL);
|
copy(constants.FLAG_IS_LOCAL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { showError } from '@nextcloud/dialogs';
|
||||||
import { translate as t } from '@nextcloud/l10n';
|
import { translate as t } from '@nextcloud/l10n';
|
||||||
|
|
||||||
import { API } from '../API';
|
import { API } from '../API';
|
||||||
import { c } from './const';
|
import { constants as c } from './const';
|
||||||
import * as nativex from '../../native';
|
import * as nativex from '../../native';
|
||||||
import type { IImageInfo, IPhoto } from '../../types';
|
import type { IImageInfo, IPhoto } from '../../types';
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue