TagSpaces is an offline, open source, document manager with tagging support
added initial support for objectstores
Ilian Sapundshiev2935b98c58c3
diff --git a/app/services/platform-io.js b/app/services/platform-io.jsindex 60e7900e9..0358cec3a 100644--- a/app/services/platform-io.js+++ b/app/services/platform-io.js@@ -18,6 +18,7 @@*/import AppConfig from '../config';+import { Pro } from '../pro';let nativeAPI = {};if (AppConfig.isElectron) {@@ -31,7 +32,22 @@ if (AppConfig.isElectron) {nativeAPI = new CordovaIO();}+let objectStoreAPI;+export default class PlatformIO {+ static enableObjectStoreSupport = (objectStoreConfig: Object): void => {+ if (Pro && Pro.ObjectStoreIO) {+ objectStoreAPI = new Pro.ObjectStoreIO();+ objectStoreAPI.configure(objectStoreConfig);+ } else {+ console.log('ObjectStore support available in the PRO version');+ }+ }++ static disableObjectStoreSupport = (): void => {+ objectStoreAPI = undefined;+ }+static initMainMenu = (menuConfig: Array<Object>): void => {if (nativeAPI.initMainMenu) {nativeAPI.initMainMenu(menuConfig);@@ -73,6 +89,13 @@ export default class PlatformIO {static getUserHomePath = (): string => nativeAPI.getUserHomePath();+ static getURLforPath = (path: string): string => {+ if (objectStoreAPI) {+ return objectStoreAPI.getURLforPath(path);+ }+ // console.log('getURLforPath not supported');+ }+static createDirectoryTree = (directoryPath: string): Object =>nativeAPI.createDirectoryTree(directoryPath);@@ -86,7 +109,12 @@ export default class PlatformIO {static listDirectoryPromise = (path: string,lite: boolean = true- ): Promise<Array<any>> => nativeAPI.listDirectoryPromise(path, lite);+ ): Promise<Array<any>> => {+ if (objectStoreAPI) {+ return objectStoreAPI.listDirectoryPromise(path, lite);+ }+ return nativeAPI.listDirectoryPromise(path, lite);+ };static getPropertiesPromise = (path: string): Promise<any> =>nativeAPI.getPropertiesPromise(path);