TagSpaces is an offline, open source, document manager with tagging support
chore: changes in tagspaces core for supporting capacitor
Ilian Sapundshiev37fd8a7e5dfe
diff --git a/CLAUDE.md b/CLAUDE.mdindex 2a80e1ee2..f47d9e0b7 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -76,3 +76,41 @@ npx playwright test --project=electron-s3 folder.pw.e2e.js- **`openContextEntryMenu()` waits for menu**: The helper waits for the menu item to be visible (5s) before clicking, reducing flakiness from context menu render timing.- **MUI `sx` prop and attribute monitoring**: MUI's `sx` prop generates dynamic CSS class names, not inline `style` attributes. When testing visual changes (e.g., background color), poll the `class` attribute with `waitUntilChanged()`, not `style`.- **Kanban `getDirectoryMenuItems` parameter order**: If the `DirectoryMenuItems.tsx` function signature changes (new parameters added), all callers must be updated — especially `ColumnMenu.tsx` in tagspacespro which uses positional arguments. A misaligned parameter shifts all subsequent callbacks into wrong slots.++## Capacitor Mobile App++### Structure+- **Capacitor project**: `capacitor/` (parallel to `cordova/`, both can coexist)+- **IO package**: `@tagspaces/tagspaces-common-capacitor` (source: `../tagspaces-common/packages/common-capacitor/`)+- **Webpack configs**: `.erb/configs/webpack.config.capacitor.prod.ts` / `.dev.ts`+- **Custom plugins**: `capacitor/android/app/src/main/java/org/tagspaces/plugins/` (StoragePermission, IntentHandler)+- **Platform detection**: `AppConfig.isCapacitor`, `AppConfig.isCapacitorAndroid`, `AppConfig.isCapacitoriOS`, `AppConfig.isNativeMobile` (unified Cordova+Capacitor flag)++### Build & Run+```bash+npm run prepare-capacitor # Copy extensions + node_modules to www/+npm run build:capacitor # Webpack production build+cd capacitor && npx cap sync # Sync web assets + plugins to native projects+npm run run-android-cap # Full pipeline: prepare + build + sync + run+npm run run-ios-cap # Same for iOS+cd capacitor && npx cap open android # Open in Android Studio+cd capacitor && npx cap open ios # Open in Xcode+```++### Local Development Symlinks+The `@tagspaces/tagspaces-common` and `@tagspaces/tagspaces-common-capacitor` packages in `release/app/node_modules/` must be symlinked to the source repos, otherwise `npm install` or `prepare-capacitor` overwrites Capacitor detection code:+```bash+ln -s /path/to/tagspaces-common/packages/common release/app/node_modules/@tagspaces/tagspaces-common+ln -s /path/to/tagspaces-common/packages/common-capacitor release/app/node_modules/@tagspaces/tagspaces-common-capacitor+ln -s /path/to/tagspaces-common/packages/common-capacitor node_modules/@tagspaces/tagspaces-common-capacitor+```++### Key Pitfalls+- **Extension paths**: `prepare-capacitor` must copy `node_modules` directly to `capacitor/www/` (not into a subdirectory). Extensions are loaded as `node_modules/@tagspaces/extensions/{ext}/index.html` in iframes.+- **File URLs**: Native file paths must go through `Capacitor.convertFileSrc()` to be loadable in WebView (`<img>`, iframes). Applied in `CommonLocation.normalizeUrl()`.+- **Empty path = "."**: `resolveCapacitorPath()` in `io-capacitor.js` must return `"."` not `""` for root directories. Capacitor Filesystem fails silently with empty string.+- **CSP must include `capacitor:` scheme**: In `frame-src`, `img-src`, `default-src`, `media-src`. Without it, thumbnails and extension iframes won't load.+- **No `deviceready` event**: Capacitor bridge is ready immediately. `onDeviceReady()` is called via `setTimeout(..., 0)` at module load time.+- **Safe area / notch**: Use `StatusBar.setOverlaysWebView({ overlay: false })` programmatically. CSS `env(safe-area-inset-*)` is unreliable on Android. The `<body>` inline `padding:0` overrides CSS — use `!important`.+- **Android storage**: Uses `MANAGE_EXTERNAL_STORAGE` permission (file manager exemption). Runtime check via custom `StoragePermissionPlugin`. Play Store requires justification.+- **iOS locations**: Sandboxed to Documents + iCloud only. Enable `UIFileSharingEnabled` in Info.plist for Files app visibility.diff --git a/release/app/package-lock.json b/release/app/package-lock.jsonindex 1cde0ce96..7fb1c522c 100644--- a/release/app/package-lock.json+++ b/release/app/package-lock.json@@ -12,8 +12,8 @@"dependencies": {"@elife/pm2": "3.6.1","@tagspaces/extensions": "1.0.237",- "@tagspaces/tagspaces-common-node": "4.5.111",- "@tagspaces/tagspaces-ws": "4.5.111",+ "@tagspaces/tagspaces-common-node": "4.6.0",+ "@tagspaces/tagspaces-ws": "4.6.0","sharp": "0.32.6","ws": "8.19.0"},@@ -138,9 +138,9 @@}},"node_modules/@tagspaces/tagspaces-common": {- "version": "4.5.111",- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common/-/tagspaces-common-4.5.111.tgz",- "integrity": "sha512-GxOivqGNOefWl+DewaJVZN+BfSNM2f896dxatTW39yDrTAGqPdlSF+9lF8LsLUp22bTE2pCrhnDB9icLeGD4EA==",+ "version": "4.6.0",+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common/-/tagspaces-common-4.6.0.tgz",+ "integrity": "sha512-zVWDRz7PxxI3LSw8FHK3O+OPshe9OZhU9upROZU1MJ4LuWrBsbONDu29O9VP81YhMEoC9vWmHMVp+W9XXIyBYg==","license": "MIT","dependencies": {"dompurify": "3.3.1",@@ -150,24 +150,24 @@}},"node_modules/@tagspaces/tagspaces-common-node": {- "version": "4.5.111",- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common-node/-/tagspaces-common-node-4.5.111.tgz",- "integrity": "sha512-KnAzBITW2TkXSgVL0qiEZLCY8F7zU5mUjOTLo/JOT/CNQnURLKTkSyA1p9ZCuiGMthFfmaNF37nvnl1wgf7tew==",+ "version": "4.6.0",+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common-node/-/tagspaces-common-node-4.6.0.tgz",+ "integrity": "sha512-bmkcDBGsZcFLR+o1ClFJG0IDmPVj/gamjtOcAvN2mypNRMg0PyDvSegEa0YWiK1aQFuG7I2sos8s34crvfQkGQ==","license": "MIT","dependencies": {- "@tagspaces/tagspaces-common": "^4.5.111",+ "@tagspaces/tagspaces-common": "^4.6.0","adm-zip": "0.5.16","fs-extra": "11.3.3","klaw": "4.1.0"}},"node_modules/@tagspaces/tagspaces-indexer": {- "version": "4.5.111",- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-indexer/-/tagspaces-indexer-4.5.111.tgz",- "integrity": "sha512-FFJ3QTeOGI6JLo8jnUsLg1it3pBLndan5crjQlHiqsTII1FOtr/JCodRKitqDaQiAea54uvNQpKAGky4g11bhA==",+ "version": "4.6.0",+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-indexer/-/tagspaces-indexer-4.6.0.tgz",+ "integrity": "sha512-eCmfYuHBPgKWZJuXwzBaTzkDAMMMi5kTbp6biJXWA0OsLt2D5kg9wjkJCgU/GOVvQm6/psmbAWws4DCDG7GrVQ==","license": "MIT","dependencies": {- "@tagspaces/tagspaces-common": "^4.5.111"+ "@tagspaces/tagspaces-common": "^4.6.0"}},"node_modules/@tagspaces/tagspaces-pdf-extraction": {@@ -190,26 +190,26 @@}},"node_modules/@tagspaces/tagspaces-workers": {- "version": "4.5.111",- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-workers/-/tagspaces-workers-4.5.111.tgz",- "integrity": "sha512-4V7Gqa1fM2p3y4WJxZkF1H8Thj1gCLGAFDSlkujy2KHYcKn+5zSxdForBoJtDIZRx4KKqHrHgUMp9yKa+LSgDQ==",+ "version": "4.6.0",+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-workers/-/tagspaces-workers-4.6.0.tgz",+ "integrity": "sha512-AFSvVSiOBTBw3QIe7InZi+dnjEH67muTmodqBKT3EV3ofhDO5JZ1jmu5OhmtaLOyNKp0UEcoZKgasKzxWgjcWA==","license": "MIT","dependencies": {- "@tagspaces/tagspaces-common": "^4.5.111",- "@tagspaces/tagspaces-common-node": "^4.5.111",+ "@tagspaces/tagspaces-common": "^4.6.0",+ "@tagspaces/tagspaces-common-node": "^4.6.0","@tagspaces/tagspaces-pdf-extraction": "^4.5.53","@tagspaces/tagspaces-thumbgen-image": "^4.5.60"}},"node_modules/@tagspaces/tagspaces-ws": {- "version": "4.5.111",- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-ws/-/tagspaces-ws-4.5.111.tgz",- "integrity": "sha512-Ys5/GxGC7K71pC1dn3TC0kb79v0ONxpW4tto0x8jX//N6pHORzHAwiPrtoIta06PhrAJBEpiUE+s/CXEab8XQg==",+ "version": "4.6.0",+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-ws/-/tagspaces-ws-4.6.0.tgz",+ "integrity": "sha512-4/im7duHRv1XLltSEb8SYlKoH8M7M0jyXrEPd3I7MYSkGIcBr2+kiFBKpVqqodI5X6IF9O4cBKVyE5gt/lSnpA==","license": "MIT","dependencies": {- "@tagspaces/tagspaces-indexer": "^4.5.111",+ "@tagspaces/tagspaces-indexer": "^4.6.0","@tagspaces/tagspaces-pdf-extraction": "^4.5.53",- "@tagspaces/tagspaces-workers": "^4.5.111",+ "@tagspaces/tagspaces-workers": "^4.6.0","find-free-ports": "3.1.1","jsonwebtoken": "9.0.3","ws": "8.19.0"@@ -1572,9 +1572,9 @@}},"node_modules/picomatch": {- "version": "3.0.1",- "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-3.0.1.tgz",- "integrity": "sha512-I3EurrIQMlRc9IaAZnqRR044Phh2DXY+55o7uJ0V+hYZAcQYSuFWsc9q5PvyDHUSCe1Qxn/iBz+78s86zWnGag==",+ "version": "3.0.2",+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-3.0.2.tgz",+ "integrity": "sha512-cfDHL6LStTEKlNilboNtobT/kEa30PtAf2Q1OgszfrG/rpVl1xaFWT9ktfkS306GmHgmnad1Sw4wabhlvFtsTw==","license": "MIT","engines": {"node": ">=10"@@ -2562,9 +2562,9 @@}},"@tagspaces/tagspaces-common": {- "version": "4.5.111",- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common/-/tagspaces-common-4.5.111.tgz",- "integrity": "sha512-GxOivqGNOefWl+DewaJVZN+BfSNM2f896dxatTW39yDrTAGqPdlSF+9lF8LsLUp22bTE2pCrhnDB9icLeGD4EA==",+ "version": "4.6.0",+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common/-/tagspaces-common-4.6.0.tgz",+ "integrity": "sha512-zVWDRz7PxxI3LSw8FHK3O+OPshe9OZhU9upROZU1MJ4LuWrBsbONDu29O9VP81YhMEoC9vWmHMVp+W9XXIyBYg==","requires": {"dompurify": "3.3.1","marked": "^15.0.4",@@ -2573,22 +2573,22 @@}},"@tagspaces/tagspaces-common-node": {- "version": "4.5.111",- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common-node/-/tagspaces-common-node-4.5.111.tgz",- "integrity": "sha512-KnAzBITW2TkXSgVL0qiEZLCY8F7zU5mUjOTLo/JOT/CNQnURLKTkSyA1p9ZCuiGMthFfmaNF37nvnl1wgf7tew==",+ "version": "4.6.0",+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common-node/-/tagspaces-common-node-4.6.0.tgz",+ "integrity": "sha512-bmkcDBGsZcFLR+o1ClFJG0IDmPVj/gamjtOcAvN2mypNRMg0PyDvSegEa0YWiK1aQFuG7I2sos8s34crvfQkGQ==","requires": {- "@tagspaces/tagspaces-common": "^4.5.111",+ "@tagspaces/tagspaces-common": "^4.6.0","adm-zip": "0.5.16","fs-extra": "11.3.3","klaw": "4.1.0"}},"@tagspaces/tagspaces-indexer": {- "version": "4.5.111",- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-indexer/-/tagspaces-indexer-4.5.111.tgz",- "integrity": "sha512-FFJ3QTeOGI6JLo8jnUsLg1it3pBLndan5crjQlHiqsTII1FOtr/JCodRKitqDaQiAea54uvNQpKAGky4g11bhA==",+ "version": "4.6.0",+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-indexer/-/tagspaces-indexer-4.6.0.tgz",+ "integrity": "sha512-eCmfYuHBPgKWZJuXwzBaTzkDAMMMi5kTbp6biJXWA0OsLt2D5kg9wjkJCgU/GOVvQm6/psmbAWws4DCDG7GrVQ==","requires": {- "@tagspaces/tagspaces-common": "^4.5.111"+ "@tagspaces/tagspaces-common": "^4.6.0"}},"@tagspaces/tagspaces-pdf-extraction": {@@ -2609,24 +2609,24 @@}},"@tagspaces/tagspaces-workers": {- "version": "4.5.111",- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-workers/-/tagspaces-workers-4.5.111.tgz",- "integrity": "sha512-4V7Gqa1fM2p3y4WJxZkF1H8Thj1gCLGAFDSlkujy2KHYcKn+5zSxdForBoJtDIZRx4KKqHrHgUMp9yKa+LSgDQ==",+ "version": "4.6.0",+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-workers/-/tagspaces-workers-4.6.0.tgz",+ "integrity": "sha512-AFSvVSiOBTBw3QIe7InZi+dnjEH67muTmodqBKT3EV3ofhDO5JZ1jmu5OhmtaLOyNKp0UEcoZKgasKzxWgjcWA==","requires": {- "@tagspaces/tagspaces-common": "^4.5.111",- "@tagspaces/tagspaces-common-node": "^4.5.111",+ "@tagspaces/tagspaces-common": "^4.6.0",+ "@tagspaces/tagspaces-common-node": "^4.6.0","@tagspaces/tagspaces-pdf-extraction": "^4.5.53","@tagspaces/tagspaces-thumbgen-image": "^4.5.60"}},"@tagspaces/tagspaces-ws": {- "version": "4.5.111",- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-ws/-/tagspaces-ws-4.5.111.tgz",- "integrity": "sha512-Ys5/GxGC7K71pC1dn3TC0kb79v0ONxpW4tto0x8jX//N6pHORzHAwiPrtoIta06PhrAJBEpiUE+s/CXEab8XQg==",+ "version": "4.6.0",+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-ws/-/tagspaces-ws-4.6.0.tgz",+ "integrity": "sha512-4/im7duHRv1XLltSEb8SYlKoH8M7M0jyXrEPd3I7MYSkGIcBr2+kiFBKpVqqodI5X6IF9O4cBKVyE5gt/lSnpA==","requires": {- "@tagspaces/tagspaces-indexer": "^4.5.111",+ "@tagspaces/tagspaces-indexer": "^4.6.0","@tagspaces/tagspaces-pdf-extraction": "^4.5.53",- "@tagspaces/tagspaces-workers": "^4.5.111",+ "@tagspaces/tagspaces-workers": "^4.6.0","find-free-ports": "3.1.1","jsonwebtoken": "9.0.3","ws": "8.19.0"@@ -3502,9 +3502,9 @@"integrity": "sha512-DgtH8GId1/+oj8n9yYEmhTq1QkxOZZzqHJhHEa1bmtV3t3/u2YsE3LSvRUNpVRWVXRcCdn+3Tu6+mD2YXKL7lA=="},"picomatch": {- "version": "3.0.1",- "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-3.0.1.tgz",- "integrity": "sha512-I3EurrIQMlRc9IaAZnqRR044Phh2DXY+55o7uJ0V+hYZAcQYSuFWsc9q5PvyDHUSCe1Qxn/iBz+78s86zWnGag=="+ "version": "3.0.2",+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-3.0.2.tgz",+ "integrity": "sha512-cfDHL6LStTEKlNilboNtobT/kEa30PtAf2Q1OgszfrG/rpVl1xaFWT9ktfkS306GmHgmnad1Sw4wabhlvFtsTw=="},"postal-mime": {"version": "2.7.3",diff --git a/release/app/package.json b/release/app/package.jsonindex 50ba5cadf..c37d49a53 100644--- a/release/app/package.json+++ b/release/app/package.json@@ -19,8 +19,8 @@"dependencies": {"@elife/pm2": "3.6.1","@tagspaces/extensions": "1.0.237",- "@tagspaces/tagspaces-common-node": "4.5.111",- "@tagspaces/tagspaces-ws": "4.5.111",+ "@tagspaces/tagspaces-common-node": "4.6.0",+ "@tagspaces/tagspaces-ws": "4.6.0","sharp": "0.32.6","ws": "8.19.0"},diff --git a/src/renderer/components/EntryContainerMenu.tsx b/src/renderer/components/EntryContainerMenu.tsxindex d2ceca9e7..519188ec7 100644--- a/src/renderer/components/EntryContainerMenu.tsx+++ b/src/renderer/components/EntryContainerMenu.tsx@@ -282,7 +282,7 @@ function EntryContainerMenu(props: Props) {<ListItemText primary={t('core:navigateToParentDirectory')} /></MenuItem>,);- if (!AppConfig.isCordova) {+ if (!AppConfig.isNativeMobile) {menuItems.push(<MenuItemkey={'openInWindowKey'}@@ -297,7 +297,7 @@ function EntryContainerMenu(props: Props) {</MenuItem>,);}- if (AppConfig.isCordova) {+ if (AppConfig.isNativeMobile) {menuItems.push(<MenuItemkey={'shareFileKey'}@@ -373,7 +373,7 @@ function EntryContainerMenu(props: Props) {<ListItemText primary={t('core:openInMainArea')} /></MenuItem>,);- if (!AppConfig.isCordova) {+ if (!AppConfig.isNativeMobile) {menuItems.push(<MenuItemkey={'openInWindowKey'}diff --git a/src/renderer/components/MobileNavigation.tsx b/src/renderer/components/MobileNavigation.tsxindex 230f2e071..ba988cdac 100644--- a/src/renderer/components/MobileNavigation.tsx+++ b/src/renderer/components/MobileNavigation.tsx@@ -558,7 +558,7 @@ function MobileNavigation(props: Props) {<ListItemText primary={t('core:createLocation')} /></MenuItem>)}- {!AppConfig.isCordova && (+ {!AppConfig.isNativeMobile && (<MenuItemkey="createWindow"data-tid="createWindowTID"diff --git a/src/renderer/components/dialogs/CreateEditLocationDialog.tsx b/src/renderer/components/dialogs/CreateEditLocationDialog.tsxindex 642d893ff..994bccf91 100644--- a/src/renderer/components/dialogs/CreateEditLocationDialog.tsx+++ b/src/renderer/components/dialogs/CreateEditLocationDialog.tsx@@ -859,7 +859,7 @@ function CreateEditLocationDialog(props: Props) {disabled={!Pro ||type === locationType.TYPE_CLOUD ||- AppConfig.isCordova+ AppConfig.isNativeMobile}labelPlacement="start"sx={{ justifyContent: 'space-between', marginLeft: 0 }}diff --git a/src/renderer/components/dialogs/components/LocalForm.tsx b/src/renderer/components/dialogs/components/LocalForm.tsxindex ae1da85d9..8bc7fe0e7 100644--- a/src/renderer/components/dialogs/components/LocalForm.tsx+++ b/src/renderer/components/dialogs/components/LocalForm.tsx@@ -91,7 +91,7 @@ function LocalForm(props: Props) {}}label={t('core:createLocationPath') + ' *'}/>- {AppConfig.isCordovaAndroid && (+ {(AppConfig.isCordovaAndroid || AppConfig.isCapacitorAndroid) && (<FormHelperText>Examples: sdcard/DCIM, sdcard/Downloads or /storage/899D-1617 forext. sd-carddiff --git a/src/renderer/components/menus/TagLibraryMenu.tsx b/src/renderer/components/menus/TagLibraryMenu.tsxindex d99dca88a..c0b161509 100644--- a/src/renderer/components/menus/TagLibraryMenu.tsx+++ b/src/renderer/components/menus/TagLibraryMenu.tsx@@ -159,7 +159,7 @@ function TagLibraryMenu(props: Props) {</ListItemIcon><ListItemText primary={t('core:importTags')} /></MenuItem>- {!AppConfig.isCordovaAndroid && (+ {!AppConfig.isCordovaAndroid && !AppConfig.isCapacitorAndroid && (<MenuItem data-tid="exportTagGroup" onClick={handleExportTagGroup}><ListItemIcon><ExportIcon />diff --git a/src/renderer/containers/MainPage.tsx b/src/renderer/containers/MainPage.tsxindex e910b1ab0..c26657442 100644--- a/src/renderer/containers/MainPage.tsx+++ b/src/renderer/containers/MainPage.tsx@@ -138,7 +138,7 @@ function MainPage() {});useEffect(() => {- if (!AppConfig.isCordova) {+ if (!AppConfig.isNativeMobile) {updateDimensions();}// eslint-disable-next-line@@ -156,7 +156,7 @@ function MainPage() {}, [openedEntry]);useEventListener('resize', () => {- if (!AppConfig.isCordova) {+ if (!AppConfig.isNativeMobile) {updateDimensions();}});diff --git a/src/renderer/hooks/IOActionsContextProvider.tsx b/src/renderer/hooks/IOActionsContextProvider.tsxindex 71844eec8..17cd27270 100644--- a/src/renderer/hooks/IOActionsContextProvider.tsx+++ b/src/renderer/hooks/IOActionsContextProvider.tsx@@ -1033,7 +1033,11 @@ export const IOActionsContextProvider = ({onUploadProgress({ key: key, loaded: 0, total: 0 }, undefined);}}- if (AppConfig.isElectron || AppConfig.isCordovaiOS) {+ if (+ AppConfig.isElectron ||+ AppConfig.isCordovaiOS ||+ AppConfig.isCapacitoriOS+ ) {return uploadFiles(files.map((f) => f.path),targetPath,@@ -1703,7 +1707,7 @@ export const IOActionsContextProvider = ({function openFsEntryNatively(fsEntry: TS.FileSystemEntry) {if (fsEntry.isFile) {- if (AppConfig.isCordova) {+ if (AppConfig.isNativeMobile) {currentLocation.openFile(fsEntry);} else {openFileMessage(fsEntry.path, warningOpeningFilesExternally);diff --git a/src/renderer/hooks/LocationIndexContextProvider.tsx b/src/renderer/hooks/LocationIndexContextProvider.tsxindex ec4821e8c..ddd9007f1 100644--- a/src/renderer/hooks/LocationIndexContextProvider.tsx+++ b/src/renderer/hooks/LocationIndexContextProvider.tsx@@ -356,7 +356,7 @@ export const LocationIndexContextProvider = ({enableWS &&!loc.haveObjectStoreSupport() &&!loc.haveWebDavSupport() &&- !AppConfig.isCordova+ !AppConfig.isNativeMobile) {// Start indexing in worker if not in the object store modereturn locdiff --git a/src/renderer/perspectives/common/DirectoryMenuItems.tsx b/src/renderer/perspectives/common/DirectoryMenuItems.tsxindex 612c48264..caabe3497 100644--- a/src/renderer/perspectives/common/DirectoryMenuItems.tsx+++ b/src/renderer/perspectives/common/DirectoryMenuItems.tsx@@ -533,7 +533,7 @@ export function getDirectoryMenuItems();}- if (AppConfig.isCordova && cameraTakePicture) {+ if (AppConfig.isNativeMobile && cameraTakePicture) {menuItems.push(<MenuItemkey="takePicture"diff --git a/src/renderer/perspectives/grid/components/GridCell.tsx b/src/renderer/perspectives/grid/components/GridCell.tsxindex c5ee35d11..ef052600a 100644--- a/src/renderer/perspectives/grid/components/GridCell.tsx+++ b/src/renderer/perspectives/grid/components/GridCell.tsx@@ -320,7 +320,7 @@ function GridCell(props: Props) {const handleCellClick = useCallback((event: React.MouseEvent) => {event.stopPropagation();- AppConfig.isCordovaiOS+ AppConfig.isCordovaiOS || AppConfig.isCapacitoriOS? handleGridCellDblClick(event, fsEntry): handleGridCellClick(event, fsEntry);},diff --git a/src/renderer/perspectives/grid/components/GridPagination.tsx b/src/renderer/perspectives/grid/components/GridPagination.tsxindex 717bea2b3..0966a135e 100644--- a/src/renderer/perspectives/grid/components/GridPagination.tsx+++ b/src/renderer/perspectives/grid/components/GridPagination.tsx@@ -390,7 +390,7 @@ function GridPagination(props: Props) {>{message}</Typography>- {!AppConfig.isCordova && (+ {!AppConfig.isNativeMobile && (<Typography sx={{ color: theme.palette.text.secondary }}>{t('core:dragAndDropToImport')}</Typography>diff --git a/src/renderer/perspectives/grid/components/MainToolbar.tsx b/src/renderer/perspectives/grid/components/MainToolbar.tsxindex bd2682dcc..2eb45f669 100644--- a/src/renderer/perspectives/grid/components/MainToolbar.tsx+++ b/src/renderer/perspectives/grid/components/MainToolbar.tsx@@ -124,7 +124,8 @@ function MainToolbar(props: Props) {AppConfig.isWeb &&selectedEntries?.length > 0 &&// (PlatformIO.haveObjectStoreSupport() || PlatformIO.haveWebDavSupport()) &&- !AppConfig.isCordovaAndroid; // saveAs do not work on Android+ !AppConfig.isCordovaAndroid &&+ !AppConfig.isCapacitorAndroid; // saveAs do not work on Androidconst folderSettingsAvailable = haveLocalSetting();@@ -289,7 +290,8 @@ function MainToolbar(props: Props) {)}{!AppConfig.ExtHideProFeatures &&Pro &&- !AppConfig.isCordovaAndroid && ( // SaveAs do not work on Android+ !AppConfig.isCordovaAndroid &&+ !AppConfig.isCapacitorAndroid && ( // SaveAs do not work on Android<TsToolbarButtontooltip={t('core:exportCsv')}title={t('core:startExportButton')}diff --git a/src/renderer/perspectives/list/components/RowCell.tsx b/src/renderer/perspectives/list/components/RowCell.tsxindex 823aaf87a..2168d4ad8 100644--- a/src/renderer/perspectives/list/components/RowCell.tsx+++ b/src/renderer/perspectives/list/components/RowCell.tsx@@ -258,7 +258,7 @@ function RowCell(props: Props) {const handlePaperClick = useCallback((event: React.MouseEvent) => {event.stopPropagation();- AppConfig.isCordovaiOS+ AppConfig.isCordovaiOS || AppConfig.isCapacitoriOS? handleGridCellDblClick(event, fsEntry): handleGridCellClick(event, fsEntry);},diff --git a/src/renderer/services/thumbsgenerator.ts b/src/renderer/services/thumbsgenerator.tsindex e2014e63f..01715021e 100644--- a/src/renderer/services/thumbsgenerator.ts+++ b/src/renderer/services/thumbsgenerator.ts@@ -438,7 +438,7 @@ export async function generateImageThumbnail(}// --- STANDARD IMAGE LOGIC ---- if (AppConfig.isCordova) {+ if (AppConfig.isNativeMobile) {objectURL = await cordovaCreateObjectURL(blob);} else {objectURL = URL.createObjectURL(blob);@@ -451,7 +451,7 @@ export async function generateImageThumbnail(// Cleanup Memory// We must revoke the URL after processing to free up the original image bytes- if (objectURL && !AppConfig.isCordova) {+ if (objectURL && !AppConfig.isNativeMobile) {URL.revokeObjectURL(objectURL);objectURL = null;}@@ -462,7 +462,7 @@ export async function generateImageThumbnail(return '';} finally {// Safety Cleanup for errors- if (objectURL && !AppConfig.isCordova) {+ if (objectURL && !AppConfig.isNativeMobile) {URL.revokeObjectURL(objectURL);}}diff --git a/src/renderer/services/utils-io.ts b/src/renderer/services/utils-io.tsindex 9eccd4a92..c162e0bd0 100644--- a/src/renderer/services/utils-io.ts+++ b/src/renderer/services/utils-io.ts@@ -145,7 +145,7 @@ export function findExtensionPathForId(if (AppConfig.isWeb) {return 'modules/' + extensionId;}- if (AppConfig.isCordova) {+ if (AppConfig.isNativeMobile) {return 'node_modules/' + extensionId;}return process.env.NODE_ENV === 'development'@@ -811,7 +811,7 @@ export function openFileMessage() {if (AppConfig.isElectron) {window.electronIO.ipcRenderer.sendMessage('openFile', filePath);- } else if (AppConfig.isCordova) {+ } else if (AppConfig.isNativeMobile) {} else {console.error('Is supported only in Electron');}@@ -867,6 +867,11 @@ export function uploadAbort(path?: string): Promise<any> {export function getDevicePaths(): Promise<any> {if (AppConfig.isElectron) {return window.electronIO.ipcRenderer.invoke('getDevicePaths');+ } else if (AppConfig.isCapacitor) {+ // Dynamic require to avoid webpack resolving this for Electron/web builds+ const capPkg = '@tagspaces/tagspaces-common-capacitor';+ const ioAPI = require(capPkg);+ return ioAPI.getDevicePaths();} else if (AppConfig.isCordova) {const ioAPI = require('@tagspaces/tagspaces-common-cordova');return ioAPI.getDevicePaths();@@ -936,7 +941,7 @@ export function downloadFile(const entryName = `${baseName(filePath, dirSeparator)}`;const fileName = extractFileName(entryName, dirSeparator);- if (AppConfig.isCordova) {+ if (AppConfig.isNativeMobile) {if (fileUrl) {const downloadCordova = (uri, filename) => {const { Downloader } = window.plugins;@@ -1011,6 +1016,10 @@ export function downloadFile(export function selectDirectoryDialog(): Promise<any> {if (AppConfig.isElectron) {return window.electronIO.ipcRenderer.invoke('selectDirectoryDialog');+ } else if (AppConfig.isCapacitor) {+ const capPkg = '@tagspaces/tagspaces-common-capacitor';+ const ioAPI = require(capPkg);+ return ioAPI.selectDirectoryDialog();} else if (AppConfig.isCordova) {const ioAPI = require('@tagspaces/tagspaces-common-cordova');return ioAPI.selectDirectoryDialog();diff --git a/src/renderer/utils/CommonLocation.ts b/src/renderer/utils/CommonLocation.tsindex aef4df408..af506b499 100644--- a/src/renderer/utils/CommonLocation.ts+++ b/src/renderer/utils/CommonLocation.ts@@ -20,6 +20,19 @@ import { getFulfilledResults, getMimeType } from '-/services/utils-io';import { TS } from '-/tagspaces.namespace';import * as cordovaIO from '@tagspaces/tagspaces-common-cordova';+// Capacitor IO is loaded dynamically to avoid breaking Electron/web builds+// where the package isn't available. The variable indirection prevents+// webpack from resolving the module statically.+let capacitorIO: any;+if (AppConfig.isCapacitor) {+ try {+ const capPkg = '@tagspaces/tagspaces-common-capacitor';+ capacitorIO = require(capPkg);+ } catch (e) {+ console.warn('tagspaces-common-capacitor not available');+ }+}+export class CommonLocation implements TS.Location {uuid: string;newuuid?: string;@@ -101,6 +114,8 @@ export class CommonLocation implements TS.Location {this.ioAPI = require('@tagspaces/tagspaces-common-aws3'); //objectStoreAPI.getS3Api(location);} else if (location.type === locationType.TYPE_WEBDAV) {// TODO impl+ } else if (AppConfig.isCapacitor) {+ this.ioAPI = capacitorIO;} else if (AppConfig.isCordova) {this.ioAPI = cordovaIO;}@@ -196,6 +211,18 @@ export class CommonLocation implements TS.Location {return AppConfig.mediaProtocol + '://' + localRest;}+ // 8) In Capacitor, native file paths must be converted to WebView-accessible+ // URLs using Capacitor.convertFileSrc(). This maps file:///... paths to+ // https://localhost/_capacitor_file_/... (Android) or+ // capacitor://localhost/_capacitor_file_/... (iOS).+ if (!protocol && AppConfig.isCapacitor) {+ const Capacitor = (window as any).Capacitor;+ if (Capacitor && Capacitor.convertFileSrc) {+ const filePath = rest.startsWith('/') ? rest : '/' + rest;+ return Capacitor.convertFileSrc('file://' + filePath);+ }+ }+return protocol + rest;};@@ -448,7 +475,7 @@ export class CommonLocation implements TS.Location {...(this.encryptionKey &&useEncryption && { encryptionKey: this.encryptionKey }),});- } else if (AppConfig.isCordova) {+ } else if (AppConfig.isNativeMobile) {return this.ioAPI.checkFileExist(file);}return this.ioAPI@@ -470,7 +497,7 @@ export class CommonLocation implements TS.Location {location: this,}).then((stats) => stats && !stats.isFile);- } else if (AppConfig.isCordova) {+ } else if (AppConfig.isNativeMobile) {return this.ioAPI.checkDirExist(dir);}return this.ioAPI@@ -836,7 +863,7 @@ export class CommonLocation implements TS.Location {overwrite,onUploadProgress,);- } else if (AppConfig.isCordova) {+ } else if (AppConfig.isNativeMobile) {return this.ioAPI.saveBinaryFilePromise(param, content, overwrite).then((succeeded) => {@@ -914,10 +941,12 @@ export class CommonLocation implements TS.Location {};shareFiles = (files: Array<string>): void => {- if (AppConfig.isCordova) {+ if (AppConfig.isCapacitor) {+ capacitorIO.shareFiles(files);+ } else if (AppConfig.isCordova) {cordovaIO.shareFiles(files);} else {- console.log('shareFiles is implemented in Cordova only.');+ console.log('shareFiles is implemented in Cordova/Capacitor only.');}};@@ -1176,7 +1205,7 @@ export class CommonLocation implements TS.Location {};openFile = (file: TS.FileSystemEntry): void => {- if (AppConfig.isCordova) {+ if (AppConfig.isNativeMobile) {this.ioAPI.openFile(file.path, getMimeType(file.extension));}};