TagSpaces is an offline, open source, document manager with tagging support
fix creating tsi.json on Cordova (#1767)
Stanimir7a177c6b2934
diff --git a/app/components/FolderContainer.tsx b/app/components/FolderContainer.tsxindex 7ce236287..7d3811b9d 100644--- a/app/components/FolderContainer.tsx+++ b/app/components/FolderContainer.tsx@@ -218,12 +218,14 @@ interface Props {}function FolderContainer(props: Props) {+ const havePrevOpenedFile = React.useRef<boolean>(false);+useEffect(() => {setSearchVisible(false);}, [props.currentDirectoryPath]);useEffect(() => {- if (props.selectedEntries.length < 2) {+ if (havePrevOpenedFile.current && props.selectedEntries.length < 2) {if (props.openedFiles.length > 0) {const openedFile = props.openedFiles[0];if (openedFile.path === props.currentDirectoryPath) {@@ -244,6 +246,7 @@ function FolderContainer(props: Props) {}}}+ havePrevOpenedFile.current = props.openedFiles.length > 0;}, [props.openedFiles]);useEffect(() => {diff --git a/app/components/PathBreadcrumbs.tsx b/app/components/PathBreadcrumbs.tsxindex ac967d7b6..8ecaddce7 100644--- a/app/components/PathBreadcrumbs.tsx+++ b/app/components/PathBreadcrumbs.tsx@@ -175,7 +175,7 @@ function PathBreadcrumbs(props: Props) {pathPart,PlatformIO.getDirSeparator())}- onClick={() => loadDirectoryContent(pathPart, false)}+ onClick={() => loadDirectoryContent(pathPart, false, true)}/></Tooltip>))}diff --git a/app/components/menus/FileMenu.tsx b/app/components/menus/FileMenu.tsxindex 00a8eb5c0..63b0c7c5d 100644--- a/app/components/menus/FileMenu.tsx+++ b/app/components/menus/FileMenu.tsx@@ -220,7 +220,7 @@ function FileMenu(props: Props) {PlatformIO.copyFilePromise(selectedFilePath, newFilePath).then(() => {- props.loadDirectoryContent(dirPath, true);+ props.loadDirectoryContent(dirPath, true, true);return true;}).catch(error => {@@ -243,7 +243,7 @@ function FileMenu(props: Props) {selectedFilePath,PlatformIO.getDirSeparator());- props.loadDirectoryContent(parentFolder, false);+ props.loadDirectoryContent(parentFolder, false, true);}}diff --git a/app/package.json b/app/package.jsonindex eab8a7571..e1c290fcc 100644--- a/app/package.json+++ b/app/package.json@@ -16,7 +16,7 @@"@tagspaces/extensions": "1.0.32"},"nodeDependencies": {- "@tagspaces/tagspaces-ws": "2.0.31",+ "@tagspaces/tagspaces-ws": "2.0.39","@tagspaces/extensions": "1.0.32","sharp": "^0.30.7"}diff --git a/app/perspectives/list/components/MainContainer.tsx b/app/perspectives/list/components/MainContainer.tsxindex c928bc498..456cb69c7 100644--- a/app/perspectives/list/components/MainContainer.tsx+++ b/app/perspectives/list/components/MainContainer.tsx@@ -572,8 +572,8 @@ function GridPerspective(props: Props) {const doubleClickAction = (fsEntry: TS.FileSystemEntry) => {if (fsEntry.isFile) {props.setSelectedEntries([fsEntry]);- props.openFileNatively(fsEntry.path);- // props.openFsEntry(fsEntry);+ // props.openFileNatively(fsEntry.path);+ props.openFsEntry(fsEntry);} else {console.log('Handle Grid cell db click, selected path : ', fsEntry.path);props.loadDirectoryContent(fsEntry.path, true, true);diff --git a/app/services/platform-facade.ts b/app/services/platform-facade.tsindex 0ffb0b1f0..a184040e0 100644--- a/app/services/platform-facade.ts+++ b/app/services/platform-facade.ts@@ -63,7 +63,9 @@ import {platformSelectDirectoryDialog,platformShareFiles,platformCreateIndex,- platformCreateNewInstance+ platformCreateNewInstance,+ platformCheckFileExist,+ platformCheckDirExist} from '@tagspaces/tagspaces-platforms/platform-io';import AppConfig from '@tagspaces/tagspaces-platforms/AppConfig';import { Pro } from '../pro';@@ -211,6 +213,12 @@ export default class PlatformFacade {static getPropertiesPromise = (path: string): Promise<any> =>platformGetPropertiesPromise(path);+ static checkDirExist = (dir: string): Promise<boolean> =>+ platformCheckDirExist(dir);++ static checkFileExist = (file: string): Promise<boolean> =>+ platformCheckFileExist(file);+static ignoreByWatcher = (...paths) => {if (Pro && Pro.Watcher && Pro.Watcher.isWatching()) {for (let i = 0; i < paths.length; i += 1) {diff --git a/app/services/thumbsgenerator.ts b/app/services/thumbsgenerator.tsindex b015a5656..9affe9a81 100644--- a/app/services/thumbsgenerator.ts+++ b/app/services/thumbsgenerator.ts@@ -240,8 +240,8 @@ export function createThumbnailPromise(resolve(undefined); // prevent creating thumbs in meta/.ts folderreturn true;}- const stats = await PlatformIO.getPropertiesPromise(metaDirectory); // TODO In cordova this check is too expensive for dirs like /.ts (replace it with checkDirExist)- if (!stats || stats.isFile) {+ const exist = await PlatformIO.checkDirExist(metaDirectory);+ if (!exist) {await PlatformIO.createDirectoryPromise(metaDirectory);}diff --git a/app/services/utils-io.ts b/app/services/utils-io.tsindex 20e1c73c2..dd77ebf1b 100644--- a/app/services/utils-io.ts+++ b/app/services/utils-io.ts@@ -477,18 +477,25 @@ export function getPrevFile(}/**- * persistIndex based on location - S3 or Native+ * persistIndex based on location - used for S3 and cordova only+ * for native used common-platform/indexer.js -> persistIndex instead* @param param* @param directoryIndex*/-function persistIndex(param: string | any, directoryIndex: any) {+async function persistIndex(param: string | any, directoryIndex: any) {let directoryPath;if (typeof param === 'object' && param !== null) {directoryPath = param.path;} else {directoryPath = param;}- const folderIndexPath = getMetaIndexFilePath(directoryPath);+ const metaDirectory = getMetaDirectoryPath(directoryPath);+ const exist = await PlatformIO.checkDirExist(metaDirectory);+ if (!exist) {+ await PlatformIO.createDirectoryPromise(metaDirectory);+ }+ const folderIndexPath =+ metaDirectory + PlatformIO.getDirSeparator() + AppConfig.folderIndexFile; // getMetaIndexFilePath(directoryPath);return PlatformIO.saveTextFilePlatform({ ...param, path: folderIndexPath },JSON.stringify(directoryIndex), // relativeIndex),diff --git a/package-lock.json b/package-lock.jsonindex b7b71c1ef..a09a99b05 100644--- a/package-lock.json+++ b/package-lock.json@@ -19,7 +19,7 @@"@mui/lab": "^5.0.0-alpha.92","@mui/material": "^5.9.2","@mui/styles": "^5.9.2",- "@tagspaces/tagspaces-platforms": "2.0.31",+ "@tagspaces/tagspaces-platforms": "2.0.39","aws-amplify": "^4.3.8","aws-sdk": "^2.1036.0","babel-polyfill": "^6.26.0",@@ -11721,9 +11721,9 @@}},"node_modules/@tagspaces/tagspaces-platforms": {- "version": "2.0.31",- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-platforms/-/tagspaces-platforms-2.0.31.tgz",- "integrity": "sha512-dNnLFquo9u83M4TRv2sApzTIGvzQjionGla5fT4TmL1zSusI8cyJngxlyL5h/hkS4DsLevXJRXMFOEiyF1jmCw==",+ "version": "2.0.39",+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-platforms/-/tagspaces-platforms-2.0.39.tgz",+ "integrity": "sha512-AjrMKTsfG75/zcmsQHknojv8tutH8y+VroqUsn3dsjVf1FmN0Zi3MOAoH+8eiO05A6dZmMO3UjuXPGXnCsYiGA==","hasInstallScript": true},"node_modules/@testim/chrome-version": {@@ -59596,9 +59596,9 @@}},"@tagspaces/tagspaces-platforms": {- "version": "2.0.31",- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-platforms/-/tagspaces-platforms-2.0.31.tgz",- "integrity": "sha512-dNnLFquo9u83M4TRv2sApzTIGvzQjionGla5fT4TmL1zSusI8cyJngxlyL5h/hkS4DsLevXJRXMFOEiyF1jmCw=="+ "version": "2.0.39",+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-platforms/-/tagspaces-platforms-2.0.39.tgz",+ "integrity": "sha512-AjrMKTsfG75/zcmsQHknojv8tutH8y+VroqUsn3dsjVf1FmN0Zi3MOAoH+8eiO05A6dZmMO3UjuXPGXnCsYiGA=="},"@testim/chrome-version": {"version": "1.1.2",diff --git a/package.json b/package.jsonindex 353f9d17f..faadf6e33 100644--- a/package.json+++ b/package.json@@ -156,7 +156,7 @@"@mui/lab": "^5.0.0-alpha.92","@mui/material": "^5.9.2","@mui/styles": "^5.9.2",- "@tagspaces/tagspaces-platforms": "2.0.31",+ "@tagspaces/tagspaces-platforms": "2.0.39","aws-amplify": "^4.3.8","aws-sdk": "^2.1036.0","babel-polyfill": "^6.26.0",