refine platform check for native functionality in AccountSettings and Settings components

This commit is contained in:
Mo Tarbin
2025-12-02 00:23:13 -05:00
parent 09f89afe2a
commit 7cb2f203b1
2 changed files with 13 additions and 7 deletions

View File

@@ -1,5 +1,5 @@
import { Capacitor } from '@capacitor/core' import { Capacitor } from '@capacitor/core'
import { Box, Button, Container, Divider, Typography } from '@mui/joy' import { Box, Button, Typography } from '@mui/joy'
import { Purchases } from '@revenuecat/purchases-capacitor' import { Purchases } from '@revenuecat/purchases-capacitor'
import { useQueryClient } from '@tanstack/react-query' import { useQueryClient } from '@tanstack/react-query'
import moment from 'moment' import moment from 'moment'
@@ -48,7 +48,7 @@ const AccountSettings = () => {
return `You are currently on the Free plan. Upgrade to the Plus plan to unlock more features.` return `You are currently on the Free plan. Upgrade to the Plus plan to unlock more features.`
} }
} }
const getSubscriptionStatus = () => { const getSubscriptionStatus = () => {
if (userProfile?.subscription === 'active') { if (userProfile?.subscription === 'active') {
return `Plus` return `Plus`
@@ -66,14 +66,14 @@ const AccountSettings = () => {
if (!userProfile) { if (!userProfile) {
return ( return (
<SettingsLayout title="Account Settings"> <SettingsLayout title='Account Settings'>
<div>Loading...</div> <div>Loading...</div>
</SettingsLayout> </SettingsLayout>
) )
} }
return ( return (
<SettingsLayout title="Account Settings"> <SettingsLayout title='Account Settings'>
<div className='grid gap-4'> <div className='grid gap-4'>
<Typography level='body-md'> <Typography level='body-md'>
Change your account settings, type or update your password Change your account settings, type or update your password
@@ -94,7 +94,10 @@ const AccountSettings = () => {
userProfile?.subscription !== 'cancelled') userProfile?.subscription !== 'cancelled')
} }
onClick={async () => { onClick={async () => {
if (Capacitor.isNativePlatform()) { if (
Capacitor.isNativePlatform() &&
Capacitor.getPlatform() === 'ios'
) {
try { try {
const { RevenueCatUI } = await import( const { RevenueCatUI } = await import(
'@revenuecat/purchases-capacitor-ui' '@revenuecat/purchases-capacitor-ui'
@@ -305,4 +308,4 @@ const AccountSettings = () => {
) )
} }
export default AccountSettings export default AccountSettings

View File

@@ -712,7 +712,10 @@ const Settings = () => {
userProfile?.subscription !== 'cancelled') userProfile?.subscription !== 'cancelled')
} }
onClick={async () => { onClick={async () => {
if (Capacitor.isNativePlatform()) { if (
Capacitor.isNativePlatform() &&
Capacitor.getPlatform() === 'ios'
) {
try { try {
const { RevenueCatUI } = await import( const { RevenueCatUI } = await import(
'@revenuecat/purchases-capacitor-ui' '@revenuecat/purchases-capacitor-ui'