TagSpaces is an offline, open source, document manager with tagging support
feat: added suggestion for default locations on Android and iOS
Ilian Sapundshiev6ed1e28be6c0
diff --git a/src/renderer/components/dialogs/OnboardingDialog.tsx b/src/renderer/components/dialogs/OnboardingDialog.tsxindex 1ba2ce50e..07792e450 100644--- a/src/renderer/components/dialogs/OnboardingDialog.tsx+++ b/src/renderer/components/dialogs/OnboardingDialog.tsx@@ -37,7 +37,11 @@ import {getDefaultRegularTheme,} from '-/reducers/settings';import i18n from '-/services/i18n';-import { getDevicePaths, setLanguage } from '-/services/utils-io';+import {+ getDevicePaths,+ getICloudContainer,+ setLanguage,+} from '-/services/utils-io';import { CommonLocation } from '-/utils/CommonLocation';import { getDarkThemes, getLightThemes } from '-/utils/Themes';import CheckIcon from '@mui/icons-material/Check';@@ -73,15 +77,22 @@ interface Props {// Names assigned to auto-bootstrapped locations in// CurrentLocationContextProvider.setDefaultLocations(). Used to identify// which locations were created by the bootstrap so the user can review-// and remove any they don't want during onboarding.+// and remove any they don't want during onboarding. Each key must match a+// key returned by getDevicePaths() (per platform) AND a core.json+// translation key. The list mixes desktop, iOS and Android folders — rows+// whose key isn't present in the current device's paths are filtered out,+// so a single ordered list drives every platform.const BOOTSTRAP_NAME_KEYS = [- 'desktopFolder',- 'documentsFolder',- 'downloadsFolder',- 'musicFolder',- 'picturesFolder',- 'videosFolder',- 'iCloudFolder',+ 'desktopFolder', // desktop+ 'appDocumentsFolder', // iOS app sandbox Documents+ 'iCloudFolder', // iOS iCloud Drive (merged in async below)+ 'documentsFolder', // desktop + Android+ 'downloadsFolder', // desktop + Android+ 'dcimFolder', // Android camera roll+ 'picturesFolder', // desktop + Android+ 'moviesFolder', // Android+ 'musicFolder', // desktop+ 'videosFolder', // desktop];type ThemeTileProps = {@@ -209,7 +220,10 @@ function OnboardingDialog(props: Props) {let cancelled = false;getDevicePaths().then((paths) => {- if (!cancelled && paths) setDevicePaths(paths);+ // Merge rather than replace: on iOS the iCloud effect below may have+ // already injected `iCloudFolder`, and a full replace would wipe it.+ if (!cancelled && paths)+ setDevicePaths((prev) => ({ ...prev, ...paths }));}).catch(() => {/* getDevicePaths is best-effort; failure leaves the list empty */@@ -219,6 +233,32 @@ function OnboardingDialog(props: Props) {};}, [open]);+ // iOS only: iCloud Drive lives outside the app sandbox and is resolved+ // asynchronously (requires the user to be signed in to iCloud), so it is+ // not part of getDevicePaths(). Resolve it separately and merge it into the+ // device-path map under the `iCloudFolder` key so slide 2 offers it as a+ // one-tap location alongside the app's Documents folder.+ useEffect(() => {+ if (!open || !AppConfig.isCapacitoriOS) return;+ let cancelled = false;+ getICloudContainer()+ .then((result) => {+ if (!cancelled && result && result.available && result.documentsPath) {+ setDevicePaths((prev) => ({+ ...prev,+ iCloudFolder: result.documentsPath as string,+ }));+ }+ return true;+ })+ .catch(() => {+ /* iCloud is optional; failure simply hides the row */+ });+ return () => {+ cancelled = true;+ };+ }, [open]);+// Drive the tags-demo video play/pause based on slide visibility.// Swiper hides inactive slides (display:none / visibility:hidden), so// Chromium delays preload — when slide 3 first becomes active the@@ -516,7 +556,16 @@ function OnboardingDialog(props: Props) {densesx={{textAlign: 'left',- maxHeight: 180,+ // Grow the list to use the available height instead of a+ // fixed cap. On mobile the dialog is fullScreen, so size+ // relative to the viewport (100dvh) minus the space taken+ // by the slide's image/text above and the action bar+ // below; the list scrolls internally only if it still+ // can't fit. On desktop the dialog has a bounded height,+ // so keep a fixed cap. The old 180px clipped the list to+ // ~3 rows, hiding Pictures and Movies below the fold.+ minHeight: smallScreen ? 160 : undefined,+ maxHeight: smallScreen ? 'calc(100dvh - 400px)' : 360,overflowY: 'auto',border: '1px solid',borderColor: 'divider',diff --git a/src/renderer/locales/en/core.json b/src/renderer/locales/en/core.jsonindex 083274374..92998d672 100644--- a/src/renderer/locales/en/core.json+++ b/src/renderer/locales/en/core.json@@ -575,6 +575,9 @@"musicFolder": "Music","picturesFolder": "Pictures","videosFolder": "Videos",+ "appDocumentsFolder": "App Documents",+ "dcimFolder": "Camera (DCIM)",+ "moviesFolder": "Movies","iCloudFolder": "iCloud Drive","useICloudDrive": "Use iCloud Drive","iCloudNotAvailable": "iCloud Drive is not available. Make sure you are signed in to iCloud and iCloud Drive is enabled in Settings.",diff --git a/src/renderer/services/io-capacitor.ts b/src/renderer/services/io-capacitor.tsindex 9590a24f8..0521cad6f 100644--- a/src/renderer/services/io-capacitor.ts+++ b/src/renderer/services/io-capacitor.ts@@ -324,18 +324,22 @@ function loadSettingsTags() {function getDevicePaths() {let paths;if (Capacitor.getPlatform() === 'ios') {+ // The app's sandboxed Documents directory. iCloud Drive is resolved+ // separately via getICloudContainer() — it is async and only available+ // when the user is signed in to iCloud, so it can't be returned here.paths = {- Documents: '/',- // iCloud: will be available via Directory.Icloud if enabled+ appDocumentsFolder: '/',};} else {+ // Standard Android shared-storage folders. Keys deliberately match the+ // core.json translation keys (*Folder) so auto-created locations and the+ // onboarding slide get localized names instead of raw keys.paths = {- Photos: 'sdcard/DCIM/',- Pictures: 'sdcard/Pictures/',- Download: 'sdcard/Download/',- Music: 'sdcard/Music/',- Movies: 'sdcard/Movies/',- SDCard: 'sdcard/',+ dcimFolder: 'sdcard/DCIM/',+ documentsFolder: 'sdcard/Documents/',+ downloadsFolder: 'sdcard/Download/',+ picturesFolder: 'sdcard/Pictures/',+ moviesFolder: 'sdcard/Movies/',};}return Promise.resolve(paths);