refine platform check for native functionality in AccountSettings and Settings components
This commit is contained in:
@@ -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'
|
||||||
@@ -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'
|
||||||
|
|||||||
@@ -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'
|
||||||
|
|||||||
Reference in New Issue
Block a user