TagSpaces is an offline, open source, document manager with tagging support
chore: mobile improvements
Ilian Sapundshiev96fad3fea123
diff --git a/assets/links.ts b/assets/links.tsindex 025071e18..04fc8bef8 100644--- a/assets/links.ts+++ b/assets/links.ts@@ -56,6 +56,7 @@ const Links = {webClipper: 'https://www.tagspaces.org/products/webclipper/' + urlParams,twitter: 'https://x.com/tagspaces',mastodon: 'https://fosstodon.org/@tagspaces',+ playStoreRedeem: 'https://play.google.com/redeem',emailContact: 'mailto:[email protected]?subject=App',cancelSubscription:'mailto:[email protected]?subject=Cancel%20subscription&body=Please%20enter%20here%20you%20order%20ID%20or%20the%20email%20with%20which%20the%20purchase%20was%20made.', // 'https://fastspring.com/consumer-support-form/?ulCase.Primary_Category__c=Cancel%20/%20Refund&Case.Category__c=Cancel%20Subscription'diff --git a/src/renderer/components/ProTeaser.tsx b/src/renderer/components/ProTeaser.tsxindex 5f1ccda35..5c6d9df75 100644--- a/src/renderer/components/ProTeaser.tsx+++ b/src/renderer/components/ProTeaser.tsx@@ -16,9 +16,11 @@**/+import AppConfig from '-/AppConfig';import { CloseDialogIcon } from '-/components/CommonIcons';import TsButton from '-/components/TsButton';import TsIconButton from '-/components/TsIconButton';+import { BuyProDialogContext } from '-/components/dialogs/hooks/BuyProDialogContextProvider';import { useProTeaserDialogContext } from '-/components/dialogs/hooks/useProTeaserDialogContext';import { openURLExternally } from '-/services/utils-io';import { keyframes } from '@emotion/react';@@ -37,7 +39,7 @@ import CardContent from '@mui/material/CardContent';import { OverridableComponent } from '@mui/material/OverridableComponent';import Typography from '@mui/material/Typography';import Links from 'assets/links';-import { useState } from 'react';+import { useContext, useState } from 'react';import { useTranslation } from 'react-i18next';const floatAnim = keyframes`@@ -139,8 +141,16 @@ interface Props {function ProTeaser(props: Props) {const { setShowTeaserBanner } = props;const { openProTeaserDialog } = useProTeaserDialogContext();+ const { openBuyProDialog } = useContext(BuyProDialogContext);const { t } = useTranslation();+ // 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 [adIndex] = useState<number>(getNextAdIndex);const ad = proAds[adIndex];const { Icon } = ad;@@ -239,7 +249,7 @@ function ProTeaser(props: Props) {onClick={(event: any) => {event.preventDefault();event.stopPropagation();- openURLExternally(Links.links.productsOverview, true);+ onUpgradeClick();}}>{t('upgrade')}diff --git a/src/renderer/components/dialogs/OnboardingDialog.tsx b/src/renderer/components/dialogs/OnboardingDialog.tsxindex 07792e450..8e4bd6a2a 100644--- a/src/renderer/components/dialogs/OnboardingDialog.tsx+++ b/src/renderer/components/dialogs/OnboardingDialog.tsx@@ -22,8 +22,10 @@ import WizardFinished from '-/assets/images/computer-desk.svg';import NewLook from '-/assets/images/desktop.svg';import LocationConcept from '-/assets/images/organize.svg';import TagsDemoVideo from '-/assets/videos/tags-demo.mp4';+import { NavigateBeforeIcon, NavigateNextIcon } from '-/components/CommonIcons';import TsTooltip from '-/components/TsTooltip';import TsButton from '-/components/TsButton';+import TsIconButton from '-/components/TsIconButton';import TsSelect from '-/components/TsSelect';import TsDialogTitle from '-/components/dialogs/components/TsDialogTitle';import { useCreateEditLocationDialogContext } from '-/components/dialogs/hooks/useCreateEditLocationDialogContext';@@ -837,24 +839,23 @@ function OnboardingDialog(props: Props) {gap: 1,}}>- <TsButton+ <TsIconButtondata-tid="onboardingBackTID"+ tooltip={t('core:goback')}onClick={() => (swiperRef.current as any)?.swiper?.slidePrev()}disabled={activeIndex === 0}- sx={{ minWidth: 80 }}>- {t('core:goback')}- </TsButton>+ <NavigateBeforeIcon />+ </TsIconButton><Box className="onboarding-pagination" />{activeIndex < TOTAL_SLIDES - 1 ? (- <TsButton- variant="contained"+ <TsIconButtondata-tid="onboardingNextTID"+ tooltip={t('core:next')}onClick={() => (swiperRef.current as any)?.swiper?.slideNext()}- sx={{ minWidth: 80 }}>- {t('core:next')}- </TsButton>+ <NavigateNextIcon />+ </TsIconButton>) : primaryLocation ? (<TsButtonvariant="contained"diff --git a/src/renderer/components/dialogs/ProTeaserDialog.tsx b/src/renderer/components/dialogs/ProTeaserDialog.tsxindex a9d313df7..3aa14575d 100644--- a/src/renderer/components/dialogs/ProTeaserDialog.tsx+++ b/src/renderer/components/dialogs/ProTeaserDialog.tsx@@ -17,8 +17,10 @@*/import AppConfig from '-/AppConfig';+import { NavigateBeforeIcon, NavigateNextIcon } from '-/components/CommonIcons';import DraggablePaper from '-/components/DraggablePaper';import TsButton from '-/components/TsButton';+import TsIconButton from '-/components/TsIconButton';import TsDialogTitle from '-/components/dialogs/components/TsDialogTitle';import { BuyProDialogContext } from '-/components/dialogs/hooks/BuyProDialogContextProvider';import { getProTeaserSlides } from '-/content/ProTeaserSlides';@@ -74,14 +76,18 @@ function Slide(props: SlideProps) {// On Capacitor mobile (App Store / Play) we cannot link out to an// external upgrade page from the purchase CTA — both stores reject- // builds that do. Route to the in-app StoreKit / Play Billing sheet- // via BuyProDialog instead. Desktop and web keep the external link.+ // builds that do. Route the upgrade CTA to the in-app StoreKit / Play+ // Billing sheet via BuyProDialog instead. Desktop and web keep the+ // external link. The "Show me more" / image CTA points at documentation+ // (and the AI/Pro-Web slides at a contact mailto) — these are+ // informational, not purchase links, so they open externally on every+ // platform (App Store allows non-purchase outbound links).const onUpgradeClick = AppConfig.isCapacitor? () => openBuyProDialog?.(): () => openURLExternally(Links.links.productsOverview, true);- const onCtaClick = AppConfig.isCapacitor- ? () => openBuyProDialog?.()- : () => openURLExternally(ctaURL, true);+ const onCtaClick = () => {+ if (ctaURL) openURLExternally(ctaURL, true);+ };return (<Box@@ -148,11 +154,12 @@ function Slide(props: SlideProps) {<br /><Box sx={{ whiteSpace: 'nowrap' }}><ButtonGroup>- <TsButton onClick={onUpgradeClick}>+ <TsButton variant="contained" onClick={onUpgradeClick}>{t('core:compareAndUpgrade')}</TsButton>{ctaTitle && (<TsButton+ variant="contained"onClick={onCtaClick}sx={{ marginLeft: AppConfig.defaultSpaceBetweenButtons }}>@@ -221,6 +228,25 @@ function ProTeaserDialog(props: Props) {box-sizing: border-box;height: auto;}+ ${+ smallScreen+ ? `+ /* Fullscreen (mobile) dialog: the Swiper container has a+ fixed height and overflow:hidden, so a slide taller than+ the screen would be clipped and unscrollable — Swiper also+ eats the vertical drag on iOS. Give each slide its own+ vertical scroll area with native momentum scrolling. */+ .pro-teaser-swiper,+ .pro-teaser-swiper .swiper-wrapper {+ height: 100%;+ }+ .pro-teaser-swiper .swiper-slide {+ height: 100%;+ overflow-y: auto;+ -webkit-overflow-scrolling: touch;+ }`+ : ''+ }.proteaser-pagination {display: flex;justify-content: center;@@ -285,34 +311,23 @@ function ProTeaserDialog(props: Props) {gap: 1,}}>- <TsButton+ <TsIconButtondata-tid="proTeaserBackTID"+ tooltip={t('core:goback')}onClick={() => (swiperRef.current as any)?.swiper?.slidePrev()}disabled={activeIndex === 0}- sx={{ minWidth: 80 }}>- {t('core:goback')}- </TsButton>+ <NavigateBeforeIcon />+ </TsIconButton><Box className="proteaser-pagination" />- {activeIndex < totalSlides - 1 ? (- <TsButton- variant="contained"- data-tid="proTeaserNextTID"- onClick={() => (swiperRef.current as any)?.swiper?.slideNext()}- sx={{ minWidth: 80 }}- >- {t('core:next')}- </TsButton>- ) : (- <TsButton- variant="contained"- data-tid="proTeaserCloseTID"- onClick={onClose}- sx={{ minWidth: 80 }}- >- {t('core:closeButton')}- </TsButton>- )}+ <TsIconButton+ data-tid="proTeaserNextTID"+ tooltip={t('core:next')}+ onClick={() => (swiperRef.current as any)?.swiper?.slideNext()}+ disabled={activeIndex === totalSlides - 1}+ >+ <NavigateNextIcon />+ </TsIconButton></DialogActions></Dialog>);diff --git a/src/renderer/containers/DialogsRoot.tsx b/src/renderer/containers/DialogsRoot.tsxindex 71cf6d116..af6a1fc73 100644--- a/src/renderer/containers/DialogsRoot.tsx+++ b/src/renderer/containers/DialogsRoot.tsx@@ -76,12 +76,15 @@ const providers = [AboutDialogContextProvider,KeyboardDialogContextProvider,LinkDialogContextProvider,- ProTeaserDialogContextProvider,// 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,DownloadUrlContextProvider,diff --git a/src/renderer/perspectives/grid/components/MainToolbar.tsx b/src/renderer/perspectives/grid/components/MainToolbar.tsxindex 40469cbd4..fd5ed27de 100644--- a/src/renderer/perspectives/grid/components/MainToolbar.tsx+++ b/src/renderer/perspectives/grid/components/MainToolbar.tsx@@ -269,7 +269,7 @@ function MainToolbar(props: Props) {)}<Divider flexItem orientation="vertical" sx={{ mx: 0.5, my: 1 }} /></Box>- <Box sx={{ display: { xs: 'none', sm: 'flex' } }}>+ <Box sx={{ display: 'flex' }}><ZoomComponent preview={false} /><Divider flexItem orientation="vertical" sx={{ mx: 0.5, my: 1 }} /></Box>diff --git a/src/renderer/services/iap.ts b/src/renderer/services/iap.tsindex 5afbb8629..bd143785f 100644--- a/src/renderer/services/iap.ts+++ b/src/renderer/services/iap.ts@@ -32,6 +32,8 @@// No-op on desktop and web.import AppConfig from '-/AppConfig';+import { openURLExternally } from '-/services/utils-io';+import Links from 'assets/links';const PRO_PRODUCT_ID = 'org.tagspaces.mobileapp.pro';const TS_IAP_PRO_KEY = 'tsIapProEntitlement';@@ -346,9 +348,11 @@ export async function presentCodeRedemption(): Promise<void> {return;}if (AppConfig.isCapacitorAndroid) {- // Play has no in-app API for promo code redemption. Deep-link to- // the Play Store redemption page; user pastes the code there.- window.open('https://play.google.com/redeem', '_blank');+ // Play has no in-app API for promo code redemption. Open the Play+ // Store redemption page in the system browser (Custom Tab) so the+ // user can paste the code; raw window.open is unreliable in the+ // Capacitor WebView.+ openURLExternally(Links.links.playStoreRedeem, true);}} catch (e) {console.warn('[iap] redeem code failed:', e);