viewer: reduce round trip for sidebar load
Signed-off-by: Varun Patil <radialapps@gmail.com>pull/803/head
parent
ff481dffbb
commit
224bd3c2c9
|
@ -90,8 +90,8 @@ export default defineComponent({
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
async open(photo: IPhoto | number, filename?: string, forceNative = false) {
|
async open(photo: IPhoto | number, filename?: string, useNative = false) {
|
||||||
if (!this.reducedOpen && this.native && (!photo || forceNative)) {
|
if (!this.reducedOpen && this.native && (!photo || useNative)) {
|
||||||
// Open native sidebar
|
// Open native sidebar
|
||||||
this.native?.setFullScreenMode?.(true);
|
this.native?.setFullScreenMode?.(true);
|
||||||
this.native?.open(filename);
|
this.native?.open(filename);
|
||||||
|
|
|
@ -1046,11 +1046,22 @@ export default defineComponent({
|
||||||
if (this.routeIsPublic || this.isLocal) {
|
if (this.routeIsPublic || this.isLocal) {
|
||||||
globalThis.mSidebar.open(photo);
|
globalThis.mSidebar.open(photo);
|
||||||
} else {
|
} else {
|
||||||
const fileInfo = (await dav.getFiles([photo]))[0];
|
// check if file path is already loaded with image info
|
||||||
if (abort()) return;
|
let filename = photo.imageInfo?.filename;
|
||||||
|
let useNative = !!filename;
|
||||||
|
|
||||||
const forceNative = fileInfo?.originalFilename?.startsWith('/files/');
|
// get filename from DAV if not already loaded
|
||||||
globalThis.mSidebar.open(photo, fileInfo?.filename, forceNative);
|
if (!filename) {
|
||||||
|
const fileInfo = (await dav.getFiles([photo]))[0];
|
||||||
|
if (abort()) return;
|
||||||
|
|
||||||
|
// get filename
|
||||||
|
filename = fileInfo?.filename;
|
||||||
|
useNative = fileInfo?.originalFilename?.startsWith('/files/');
|
||||||
|
}
|
||||||
|
|
||||||
|
// open sidebar
|
||||||
|
globalThis.mSidebar.open(photo, filename, useNative);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue