Skip to content

TagSpaces is an offline, open source, document manager with tagging support

chore: ux improvements for the mobile apps

Ilian Sapundshievcbab8ba1b5b7
diff --git a/src/renderer/components/HelpFeedbackPanel.tsx b/src/renderer/components/HelpFeedbackPanel.tsx
index 8215decad..fefdaccc3 100644
--- a/src/renderer/components/HelpFeedbackPanel.tsx
+++ b/src/renderer/components/HelpFeedbackPanel.tsx
@@ -29,6 +29,7 @@ import {
NewFeatureIcon,
OnboardingIcon,
ProTeaserIcon,
+ RestoreIcon,
TranslationIcon,
WebClipperIcon,
XIcon,
@@ -37,7 +38,9 @@ import { useAboutDialogContext } from '-/components/dialogs/hooks/useAboutDialog
import { useKeyboardDialogContext } from '-/components/dialogs/hooks/useKeyboardDialogContext';
import { useOnboardingDialogContext } from '-/components/dialogs/hooks/useOnboardingDialogContext';
import { useProTeaserDialogContext } from '-/components/dialogs/hooks/useProTeaserDialogContext';
+import AppConfig from '-/AppConfig';
import { Pro } from '-/pro';
+import { restoreProPurchase } from '-/services/iap';
import { AppDispatch } from '-/reducers/app';
import {
actions as SettingsActions,
@@ -220,19 +223,34 @@ function HelpFeedbackPanel(props: Props) {
<ListItemText>{t('core:emailContact')}</ListItemText>
</ListItemButton>
</ListItem>
- {Pro && (
+ {AppConfig.isCapacitor ? (
+ // Mobile Pro is a one-time non-consumable IAP — there is no
+ // subscription to cancel. Offer Restore Purchases instead, gated
+ // on the platform (not on Pro) so a reinstalled user can restore
+ // before the entitlement has been re-applied.
<ListItem disablePadding>
- <ListItemButton
- onClick={() =>
- openURLExternally(Links.links.cancelSubscription, true)
- }
- >
+ <ListItemButton onClick={() => restoreProPurchase()}>
<ListItemIcon>
- <CancelSubscriptionIcon />
+ <RestoreIcon />
</ListItemIcon>
- <ListItemText>{t('core:cancelSubscription')}</ListItemText>
+ <ListItemText>{t('core:restorePurchases')}</ListItemText>
</ListItemButton>
</ListItem>
+ ) : (
+ Pro && (
+ <ListItem disablePadding>
+ <ListItemButton
+ onClick={() =>
+ openURLExternally(Links.links.cancelSubscription, true)
+ }
+ >
+ <ListItemIcon>
+ <CancelSubscriptionIcon />
+ </ListItemIcon>
+ <ListItemText>{t('core:cancelSubscription')}</ListItemText>
+ </ListItemButton>
+ </ListItem>
+ )
)}
<ListItem disablePadding>
<ListItemButton
diff --git a/src/renderer/components/dialogs/AboutDialog.tsx b/src/renderer/components/dialogs/AboutDialog.tsx
index d46271fa5..692af5475 100644
--- a/src/renderer/components/dialogs/AboutDialog.tsx
+++ b/src/renderer/components/dialogs/AboutDialog.tsx
@@ -25,6 +25,7 @@ import TsTooltip from '-/components/TsTooltip';
import TranslucentDialog from '-/components/dialogs/components/TranslucentDialog';
import TsDialogActions from '-/components/dialogs/components/TsDialogActions';
import TsDialogTitle from '-/components/dialogs/components/TsDialogTitle';
+import { BuyProDialogContext } from '-/components/dialogs/hooks/BuyProDialogContextProvider';
import { useLicenseDialogContext } from '-/components/dialogs/hooks/useLicenseDialogContext';
import { useThirdPartyLibsDialogContext } from '-/components/dialogs/hooks/useThirdPartyLibsDialogContext';
import { Pro } from '-/pro';
@@ -37,7 +38,7 @@ import Typography from '@mui/material/Typography';
import { useTheme } from '@mui/material/styles';
import useMediaQuery from '@mui/material/useMediaQuery';
import Links from 'assets/links';
-import { useState } from 'react';
+import { useContext, useState } from 'react';
import { useTranslation } from 'react-i18next';
import semver from 'semver';
@@ -58,6 +59,14 @@ function AboutDialog(props: Props) {
const { t } = useTranslation();
const { openLicenseDialog } = useLicenseDialogContext();
const { openThirdPartyLibsDialog } = useThirdPartyLibsDialogContext();
+ const { openBuyProDialog } = useContext(BuyProDialogContext);
+
+ // On Capacitor mobile the upgrade CTA opens the in-app StoreKit / Play
+ // Billing sheet (both stores forbid linking out from the purchase flow).
+ // Desktop and web keep the external products page. Mirrors ProTeaserDialog.
+ const onUpgradeClick = AppConfig.isCapacitor
+ ? () => openBuyProDialog?.()
+ : () => openURLExternally(Links.links.productsOverview, true);
const [updateAvailable, setUpdateAvailable] = useState(false);
const [newVersion, setNewVersion] = useState('');
const { open, onClose } = props;
@@ -243,11 +252,9 @@ function AboutDialog(props: Props) {
<span>
{!Pro && (
<TsButton
- data-tid="checkForUpdates"
- title={t('core:checkForNewVersion')}
- onClick={() => {
- openURLExternally(Links.links.productsOverview, true);
- }}
+ data-tid="upgradeToProButton"
+ title={t('core:upgradeToProButton')}
+ onClick={onUpgradeClick}
sx={{ marginRight: AppConfig.defaultSpaceBetweenButtons }}
>
{t('core:upgradeToProButton')}
diff --git a/src/renderer/components/dialogs/BuyProDialog.tsx b/src/renderer/components/dialogs/BuyProDialog.tsx
index c09b08e00..f4441f3ad 100644
--- a/src/renderer/components/dialogs/BuyProDialog.tsx
+++ b/src/renderer/components/dialogs/BuyProDialog.tsx
@@ -29,6 +29,7 @@ import {
getProProduct,
IAPProduct,
isIapAvailable,
+ presentCodeRedemption,
purchasePro,
restoreProPurchase,
} from '-/services/iap';
@@ -302,18 +303,35 @@ function BuyProDialog(props: Props) {
t('core:buyProAction', { price: product?.price ?? '' })
)}
</TsButton>
- <TsButton
- data-tid="buyProRestoreTID"
- variant="text"
- onClick={onRestoreClick}
- disabled={purchaseInFlight || restoreInFlight}
+ <Box
+ sx={{
+ display: 'flex',
+ gap: 1,
+ justifyContent: 'center',
+ flexWrap: 'wrap',
+ }}
>
- {restoreInFlight ? (
- <CircularProgress size={18} />
- ) : (
- t('core:restorePurchases')
- )}
- </TsButton>
+ <TsButton
+ data-tid="buyProRestoreTID"
+ variant="text"
+ onClick={onRestoreClick}
+ disabled={purchaseInFlight || restoreInFlight}
+ >
+ {restoreInFlight ? (
+ <CircularProgress size={18} />
+ ) : (
+ t('core:restorePurchases')
+ )}
+ </TsButton>
+ <TsButton
+ data-tid="buyProRedeemTID"
+ variant="text"
+ onClick={() => presentCodeRedemption()}
+ disabled={purchaseInFlight || restoreInFlight}
+ >
+ {t('core:redeemCode')}
+ </TsButton>
+ </Box>
</DialogActions>
</Dialog>
);
diff --git a/src/renderer/components/dialogs/components/SettingsGeneral.tsx b/src/renderer/components/dialogs/components/SettingsGeneral.tsx
index e2061881f..735079b55 100644
--- a/src/renderer/components/dialogs/components/SettingsGeneral.tsx
+++ b/src/renderer/components/dialogs/components/SettingsGeneral.tsx
@@ -70,7 +70,6 @@ import {
} from '-/services/secure-crypto';
import { isAnotherTabOpen } from '-/services/credentialsTabGuard';
import CredentialsPasswordSetupDialog from '-/components/dialogs/CredentialsPasswordSetupDialog';
-import { presentCodeRedemption, restoreProPurchase } from '-/services/iap';
import { isWorkerAvailable, setLanguage } from '-/services/utils-io';
import { TS } from '-/tagspaces.namespace';
import { clearAllURLParams } from '-/utils/dom';
@@ -1804,39 +1803,6 @@ function SettingsGeneral() {
</ListItem>
),
},
- // Capacitor-only: in-app purchase management. Apple App Review
- // requires a visible "Restore Purchases" entry for any app that
- // ships IAP. Redeem Code surfaces promo codes (Apple offer codes
- // / Play promo codes) so users who got a free Pro code via a
- // desktop bundle have a clear way to apply it.
- AppConfig.isCapacitor && {
- label: t('core:restorePurchases'),
- jsx: (
- <ListItem>
- <ListItemText primary={t('core:restorePurchases')} />
- <TsButton
- data-tid="settingsRestoreProTID"
- onClick={() => restoreProPurchase()}
- >
- {t('core:restorePurchases')}
- </TsButton>
- </ListItem>
- ),
- },
- AppConfig.isCapacitor && {
- label: t('core:redeemCode'),
- jsx: (
- <ListItem>
- <ListItemText primary={t('core:redeemCode')} />
- <TsButton
- data-tid="settingsRedeemCodeTID"
- onClick={() => presentCodeRedemption()}
- >
- {t('core:redeemCode')}
- </TsButton>
- </ListItem>
- ),
- },
].filter(Boolean),
[
t,
diff --git a/src/renderer/containers/DialogsRoot.tsx b/src/renderer/containers/DialogsRoot.tsx
index af6a1fc73..1fca9f3a0 100644
--- a/src/renderer/containers/DialogsRoot.tsx
+++ b/src/renderer/containers/DialogsRoot.tsx
@@ -73,17 +73,17 @@ const providers = [
OnboardingDialogContextProvider,
LicenseDialogContextProvider,
ThirdPartyLibsDialogContextProvider,
+ // BuyProDialogContextProvider must wrap every dialog whose CTA opens the
+ // Buy Pro sheet on Capacitor — currently AboutDialog ("Upgrade to Pro")
+ // and ProTeaserDialog ("Upgrade"). Each of those dialogs renders as a
+ // sibling of {children}, and reduceRight makes earlier array entries the
+ // outer (ancestor) providers, so BuyProDialogContextProvider must be
+ // listed BEFORE all of them or useContext(BuyProDialogContext) resolves to
+ // the default (undefined) and the CTA silently no-ops.
+ BuyProDialogContextProvider,
AboutDialogContextProvider,
KeyboardDialogContextProvider,
LinkDialogContextProvider,
- // BuyProDialogContextProvider must wrap ProTeaserDialogContextProvider so
- // the "Compare and Upgrade" CTA inside ProTeaserDialog can call
- // openBuyProDialog() on Capacitor mobile (replaces the external URL link
- // — both stores forbid linking out from the actual purchase flow).
- // It must be listed BEFORE ProTeaserDialogContextProvider: reduceRight
- // makes earlier entries the outer (ancestor) providers, and ProTeaserDialog
- // renders as a sibling of {children}, so it only sees providers above it.
- BuyProDialogContextProvider,
ProTeaserDialogContextProvider,
AiGenerationDialogContextProvider,
ResolveConflictContextProvider,
diff --git a/src/renderer/locales/en/core.json b/src/renderer/locales/en/core.json
index 4511e4458..2d7382630 100644
--- a/src/renderer/locales/en/core.json
+++ b/src/renderer/locales/en/core.json
@@ -1153,7 +1153,7 @@
"buyProSubtitle": "Unlock TagSpaces Pro on this device — one-time purchase, yours forever.",
"buyProFeaturesList": "Includes Kanban, Calendar, Mapique and FolderViz perspectives, annotations, AI chat, and more.",
"buyProFeaturePerspectives": "All Pro perspectives — Kanban, Calendar, Mapique, FolderViz & Gallery",
- "buyProFeatureAI": "AI chat & smart assistance",
+ "buyProFeatureAI": "Local AI — auto-generated tags, descriptions & photo analysis",
"buyProFeatureRevisions": "File revisions & autosave",
"buyProFeatureFolderColor": "Custom folder colors & backgrounds",
"buyProAction": "Buy TagSpaces Pro for {{price}}",