Add Capacitor Browser dependency and update safe area handling in components

This commit is contained in:
Mo Tarbin
2025-08-30 01:35:38 -04:00
parent e99a06654e
commit 4e31190291
11 changed files with 98 additions and 50 deletions

View File

@@ -11,6 +11,7 @@ apply from: "../capacitor-cordova-android-plugins/cordova.variables.gradle"
dependencies { dependencies {
implementation project(':capacitor-community-sqlite') implementation project(':capacitor-community-sqlite')
implementation project(':capacitor-app') implementation project(':capacitor-app')
implementation project(':capacitor-browser')
implementation project(':capacitor-device') implementation project(':capacitor-device')
implementation project(':capacitor-local-notifications') implementation project(':capacitor-local-notifications')
implementation project(':capacitor-network') implementation project(':capacitor-network')
@@ -21,7 +22,7 @@ dependencies {
implementation project(':revenuecat-purchases-capacitor') implementation project(':revenuecat-purchases-capacitor')
implementation project(':revenuecat-purchases-capacitor-ui') implementation project(':revenuecat-purchases-capacitor-ui')
implementation project(':capacitor-plugin-safe-area') implementation project(':capacitor-plugin-safe-area')
implementation "com.android.billingclient:billing:7.1.1"
} }

View File

@@ -8,6 +8,9 @@ project(':capacitor-community-sqlite').projectDir = new File('../node_modules/@c
include ':capacitor-app' include ':capacitor-app'
project(':capacitor-app').projectDir = new File('../node_modules/@capacitor/app/android') project(':capacitor-app').projectDir = new File('../node_modules/@capacitor/app/android')
include ':capacitor-browser'
project(':capacitor-browser').projectDir = new File('../node_modules/@capacitor/browser/android')
include ':capacitor-device' include ':capacitor-device'
project(':capacitor-device').projectDir = new File('../node_modules/@capacitor/device/android') project(':capacitor-device').projectDir = new File('../node_modules/@capacitor/device/android')

View File

@@ -4,5 +4,9 @@
<dict> <dict>
<key>aps-environment</key> <key>aps-environment</key>
<string>development</string> <string>development</string>
<key>com.apple.developer.applesignin</key>
<array>
<string>Default</string>
</array>
</dict> </dict>
</plist> </plist>

View File

@@ -42,14 +42,15 @@
<string>UIInterfaceOrientationLandscapeRight</string> <string>UIInterfaceOrientationLandscapeRight</string>
</array> </array>
<key>UIViewControllerBasedStatusBarAppearance</key> <key>UIViewControllerBasedStatusBarAppearance</key>
<true/> <array>
<dict>
<!-- Camera permissions --> <key>CFBundleURLName</key>
<string></string>
</dict>
</array>
<key>NSCameraUsageDescription</key> <key>NSCameraUsageDescription</key>
<string>This app needs access to camera to take photos for your profile picture.</string> <string>This app needs access to camera to take photos to attach to task or use as profile photo</string>
<key>NSPhotoLibraryUsageDescription</key> <key>NSPhotoLibraryUsageDescription</key>
<string>This app needs access to photo library to select photos for your profile picture.</string> <string>This app needs access to photo library to select images to attach to task or use as profile photo</string>
<key>NSPhotoLibraryAddUsageDescription</key>
<string>This app needs access to save photos to your photo library.</string>
</dict> </dict>
</plist> </plist>

View File

@@ -13,6 +13,7 @@ def capacitor_pods
pod 'CapacitorCordova', :path => '../../node_modules/@capacitor/ios' pod 'CapacitorCordova', :path => '../../node_modules/@capacitor/ios'
pod 'CapacitorCommunitySqlite', :path => '../../node_modules/@capacitor-community/sqlite' pod 'CapacitorCommunitySqlite', :path => '../../node_modules/@capacitor-community/sqlite'
pod 'CapacitorApp', :path => '../../node_modules/@capacitor/app' pod 'CapacitorApp', :path => '../../node_modules/@capacitor/app'
pod 'CapacitorBrowser', :path => '../../node_modules/@capacitor/browser'
pod 'CapacitorDevice', :path => '../../node_modules/@capacitor/device' pod 'CapacitorDevice', :path => '../../node_modules/@capacitor/device'
pod 'CapacitorLocalNotifications', :path => '../../node_modules/@capacitor/local-notifications' pod 'CapacitorLocalNotifications', :path => '../../node_modules/@capacitor/local-notifications'
pod 'CapacitorNetwork', :path => '../../node_modules/@capacitor/network' pod 'CapacitorNetwork', :path => '../../node_modules/@capacitor/network'
@@ -23,7 +24,6 @@ def capacitor_pods
pod 'RevenuecatPurchasesCapacitor', :path => '../../node_modules/@revenuecat/purchases-capacitor' pod 'RevenuecatPurchasesCapacitor', :path => '../../node_modules/@revenuecat/purchases-capacitor'
pod 'RevenuecatPurchasesCapacitorUi', :path => '../../node_modules/@revenuecat/purchases-capacitor-ui' pod 'RevenuecatPurchasesCapacitorUi', :path => '../../node_modules/@revenuecat/purchases-capacitor-ui'
pod 'CapacitorPluginSafeArea', :path => '../../node_modules/capacitor-plugin-safe-area' pod 'CapacitorPluginSafeArea', :path => '../../node_modules/capacitor-plugin-safe-area'
pod 'CordovaPlugins', :path => '../capacitor-cordova-ios-plugins'
end end
target 'App' do target 'App' do

View File

@@ -10,15 +10,17 @@ PODS:
- GoogleUtilities/Environment (~> 8.0) - GoogleUtilities/Environment (~> 8.0)
- GoogleUtilities/UserDefaults (~> 8.0) - GoogleUtilities/UserDefaults (~> 8.0)
- PromisesObjC (~> 2.4) - PromisesObjC (~> 2.4)
- Capacitor (7.4.2): - Capacitor (7.4.0):
- CapacitorCordova - CapacitorCordova
- CapacitorApp (7.0.1): - CapacitorApp (7.0.1):
- Capacitor - Capacitor
- CapacitorCommunitySqlite (7.0.1): - CapacitorBrowser (7.0.2):
- Capacitor
- CapacitorCommunitySqlite (7.0.0):
- Capacitor - Capacitor
- SQLCipher - SQLCipher
- ZIPFoundation - ZIPFoundation
- CapacitorCordova (7.4.2) - CapacitorCordova (7.4.0)
- CapacitorDevice (7.0.1): - CapacitorDevice (7.0.1):
- Capacitor - Capacitor
- CapacitorLocalNotifications (7.0.1): - CapacitorLocalNotifications (7.0.1):
@@ -39,8 +41,6 @@ PODS:
- FBSDKCoreKit (= 17.4.0) - FBSDKCoreKit (= 17.4.0)
- FBSDKLoginKit (= 17.4.0) - FBSDKLoginKit (= 17.4.0)
- GoogleSignIn (~> 8.0.0) - GoogleSignIn (~> 8.0.0)
- CordovaPlugins (7.4.2):
- CapacitorCordova
- FBAEMKit (17.4.0): - FBAEMKit (17.4.0):
- FBSDKCoreKit_Basics (= 17.4.0) - FBSDKCoreKit_Basics (= 17.4.0)
- FBSDKCoreKit (17.4.0): - FBSDKCoreKit (17.4.0):
@@ -68,20 +68,20 @@ PODS:
- GTMSessionFetcher/Core (< 4.0, >= 3.3) - GTMSessionFetcher/Core (< 4.0, >= 3.3)
- GTMSessionFetcher/Core (3.5.0) - GTMSessionFetcher/Core (3.5.0)
- PromisesObjC (2.4.0) - PromisesObjC (2.4.0)
- PurchasesHybridCommon (16.1.0): - PurchasesHybridCommon (16.2.0):
- RevenueCat (= 5.33.1) - RevenueCat (= 5.34.0)
- PurchasesHybridCommonUI (16.1.0): - PurchasesHybridCommonUI (16.2.0):
- PurchasesHybridCommon (= 16.1.0) - PurchasesHybridCommon (= 16.2.0)
- RevenueCatUI (= 5.33.1) - RevenueCatUI (= 5.34.0)
- RevenueCat (5.33.1) - RevenueCat (5.34.0)
- RevenuecatPurchasesCapacitor (11.1.0): - RevenuecatPurchasesCapacitor (11.1.1):
- Capacitor - Capacitor
- PurchasesHybridCommon (= 16.1.0) - PurchasesHybridCommon (= 16.2.0)
- RevenuecatPurchasesCapacitorUi (11.1.0): - RevenuecatPurchasesCapacitorUi (11.1.1):
- Capacitor - Capacitor
- PurchasesHybridCommonUI (= 16.1.0) - PurchasesHybridCommonUI (= 16.2.0)
- RevenueCatUI (5.33.1): - RevenueCatUI (5.34.0):
- RevenueCat (= 5.33.1) - RevenueCat (= 5.34.0)
- SQLCipher (4.7.0): - SQLCipher (4.7.0):
- SQLCipher/standard (= 4.7.0) - SQLCipher/standard (= 4.7.0)
- SQLCipher/common (4.7.0) - SQLCipher/common (4.7.0)
@@ -92,6 +92,7 @@ PODS:
DEPENDENCIES: DEPENDENCIES:
- "Capacitor (from `../../node_modules/@capacitor/ios`)" - "Capacitor (from `../../node_modules/@capacitor/ios`)"
- "CapacitorApp (from `../../node_modules/@capacitor/app`)" - "CapacitorApp (from `../../node_modules/@capacitor/app`)"
- "CapacitorBrowser (from `../../node_modules/@capacitor/browser`)"
- "CapacitorCommunitySqlite (from `../../node_modules/@capacitor-community/sqlite`)" - "CapacitorCommunitySqlite (from `../../node_modules/@capacitor-community/sqlite`)"
- "CapacitorCordova (from `../../node_modules/@capacitor/ios`)" - "CapacitorCordova (from `../../node_modules/@capacitor/ios`)"
- "CapacitorDevice (from `../../node_modules/@capacitor/device`)" - "CapacitorDevice (from `../../node_modules/@capacitor/device`)"
@@ -102,7 +103,6 @@ DEPENDENCIES:
- "CapacitorPushNotifications (from `../../node_modules/@capacitor/push-notifications`)" - "CapacitorPushNotifications (from `../../node_modules/@capacitor/push-notifications`)"
- "CapacitorStatusBar (from `../../node_modules/@capacitor/status-bar`)" - "CapacitorStatusBar (from `../../node_modules/@capacitor/status-bar`)"
- "CapgoCapacitorSocialLogin (from `../../node_modules/@capgo/capacitor-social-login`)" - "CapgoCapacitorSocialLogin (from `../../node_modules/@capgo/capacitor-social-login`)"
- CordovaPlugins (from `../capacitor-cordova-ios-plugins`)
- "RevenuecatPurchasesCapacitor (from `../../node_modules/@revenuecat/purchases-capacitor`)" - "RevenuecatPurchasesCapacitor (from `../../node_modules/@revenuecat/purchases-capacitor`)"
- "RevenuecatPurchasesCapacitorUi (from `../../node_modules/@revenuecat/purchases-capacitor-ui`)" - "RevenuecatPurchasesCapacitorUi (from `../../node_modules/@revenuecat/purchases-capacitor-ui`)"
@@ -132,6 +132,8 @@ EXTERNAL SOURCES:
:path: "../../node_modules/@capacitor/ios" :path: "../../node_modules/@capacitor/ios"
CapacitorApp: CapacitorApp:
:path: "../../node_modules/@capacitor/app" :path: "../../node_modules/@capacitor/app"
CapacitorBrowser:
:path: "../../node_modules/@capacitor/browser"
CapacitorCommunitySqlite: CapacitorCommunitySqlite:
:path: "../../node_modules/@capacitor-community/sqlite" :path: "../../node_modules/@capacitor-community/sqlite"
CapacitorCordova: CapacitorCordova:
@@ -152,8 +154,6 @@ EXTERNAL SOURCES:
:path: "../../node_modules/@capacitor/status-bar" :path: "../../node_modules/@capacitor/status-bar"
CapgoCapacitorSocialLogin: CapgoCapacitorSocialLogin:
:path: "../../node_modules/@capgo/capacitor-social-login" :path: "../../node_modules/@capgo/capacitor-social-login"
CordovaPlugins:
:path: "../capacitor-cordova-ios-plugins"
RevenuecatPurchasesCapacitor: RevenuecatPurchasesCapacitor:
:path: "../../node_modules/@revenuecat/purchases-capacitor" :path: "../../node_modules/@revenuecat/purchases-capacitor"
RevenuecatPurchasesCapacitorUi: RevenuecatPurchasesCapacitorUi:
@@ -163,10 +163,11 @@ SPEC CHECKSUMS:
Alamofire: 7193b3b92c74a07f85569e1a6c4f4237291e7496 Alamofire: 7193b3b92c74a07f85569e1a6c4f4237291e7496
AppAuth: d4f13a8fe0baf391b2108511793e4b479691fb73 AppAuth: d4f13a8fe0baf391b2108511793e4b479691fb73
AppCheckCore: cc8fd0a3a230ddd401f326489c99990b013f0c4f AppCheckCore: cc8fd0a3a230ddd401f326489c99990b013f0c4f
Capacitor: 9d9e481b79ffaeacaf7a85d6a11adec32bd33b59 Capacitor: 10feab36396883c55373328124a677f118cd4b5f
CapacitorApp: febecbb9582cb353aed037e18ec765141f880fe9 CapacitorApp: febecbb9582cb353aed037e18ec765141f880fe9
CapacitorCommunitySqlite: 8b2c6bab33e3519280811d481f8bd0fa90343e1b CapacitorBrowser: 22541e48442de44dc629c214388290d6eecc6ae9
CapacitorCordova: 5e58d04631bc5094894ac106e2bf1da18a9e6151 CapacitorCommunitySqlite: b11e556cf5d149f9e0b6fbbb47959a6cd718c3d0
CapacitorCordova: 723e017d8a80ab2ede9959fbe37556c35ac860d5
CapacitorDevice: c6f6d587dd310527f8a48bf09c4e7b4a4cf14329 CapacitorDevice: c6f6d587dd310527f8a48bf09c4e7b4a4cf14329
CapacitorLocalNotifications: c2212755b33d2513b8bb325096ce3a64d4039ae3 CapacitorLocalNotifications: c2212755b33d2513b8bb325096ce3a64d4039ae3
CapacitorNetwork: 15cb4385f0913a8ceb5e9a4d7af1ec554bdb8de8 CapacitorNetwork: 15cb4385f0913a8ceb5e9a4d7af1ec554bdb8de8
@@ -174,8 +175,7 @@ SPEC CHECKSUMS:
CapacitorPreferences: 6c98117d4d7508034a4af9db64d6b26fc75d7b94 CapacitorPreferences: 6c98117d4d7508034a4af9db64d6b26fc75d7b94
CapacitorPushNotifications: 6a2794788c583dd89215f1805ca4bced1b13dbdf CapacitorPushNotifications: 6a2794788c583dd89215f1805ca4bced1b13dbdf
CapacitorStatusBar: 6e7af040d8fc4dd655999819625cae9c2d74c36f CapacitorStatusBar: 6e7af040d8fc4dd655999819625cae9c2d74c36f
CapgoCapacitorSocialLogin: 0daa087f32775c656fbfba09b8eae7c089b85ce2 CapgoCapacitorSocialLogin: 001d85f081a5167bde4ec4456353dbe4c03d4cd2
CordovaPlugins: b2618e17f8dd580d2354710b7b52b0af9d6f03f2
FBAEMKit: 58cb5f302cdd715a56d4c1d0dfdd2e423ac1421a FBAEMKit: 58cb5f302cdd715a56d4c1d0dfdd2e423ac1421a
FBSDKCoreKit: 94d7461d0cecf441b1ba7c41acfff41daa8ccd41 FBSDKCoreKit: 94d7461d0cecf441b1ba7c41acfff41daa8ccd41
FBSDKCoreKit_Basics: 151b43db8b834d3f0e02f95d36a44ffd36265e45 FBSDKCoreKit_Basics: 151b43db8b834d3f0e02f95d36a44ffd36265e45
@@ -185,15 +185,15 @@ SPEC CHECKSUMS:
GTMAppAuth: f69bd07d68cd3b766125f7e072c45d7340dea0de GTMAppAuth: f69bd07d68cd3b766125f7e072c45d7340dea0de
GTMSessionFetcher: 5aea5ba6bd522a239e236100971f10cb71b96ab6 GTMSessionFetcher: 5aea5ba6bd522a239e236100971f10cb71b96ab6
PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47 PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47
PurchasesHybridCommon: acbd336f8248da5599893ecf9ac32c561a2fd446 PurchasesHybridCommon: 55e97b4e090015ed138988e6559def2bd4c50ebe
PurchasesHybridCommonUI: cf20e6ac6f148385bdb6a15db38c4c0c7377f480 PurchasesHybridCommonUI: 25c66f6ddcf8856ecbcffee897b2525eb272a5e7
RevenueCat: b0ed01125b05a45b8264a2951ad68acb61942038 RevenueCat: eb2aa042789d9c99ad5172bd96e28b96286d6ada
RevenuecatPurchasesCapacitor: 554b5d4711cac8df01feed6333b075296b5d9082 RevenuecatPurchasesCapacitor: 420b762736c2842bfb64436b7e0b88d2f672c943
RevenuecatPurchasesCapacitorUi: 7863f7e39e940d937925b085a67369feecb048e4 RevenuecatPurchasesCapacitorUi: 0cf343ae4e1c8b30b294c971a50827316b210a63
RevenueCatUI: e6fad6a8bec67d910da78cd171328f1104afea77 RevenueCatUI: 03025a80b64ce8ff8e43f47a7eb9dbbb6b4f486e
SQLCipher: ba9d0076041ed767c5bd3d3f77098318d04a403c SQLCipher: ba9d0076041ed767c5bd3d3f77098318d04a403c
ZIPFoundation: b8c29ea7ae353b309bc810586181fd073cb3312c ZIPFoundation: b8c29ea7ae353b309bc810586181fd073cb3312c
PODFILE CHECKSUM: 8a9fb4ff57aa677972b999357aa5abe97d1f2b30 PODFILE CHECKSUM: 289063dee9cd9d5cc8abd18e13b4153b38864021
COCOAPODS: 1.16.2 COCOAPODS: 1.16.2

View File

@@ -44,7 +44,6 @@ export const AlertsProvider = ({ children }) => {
{visibleAlert && ( {visibleAlert && (
<Box <Box
sx={{ sx={{
pt: `calc( env(safe-area-inset-top, 0px))`,
position: 'fixed', position: 'fixed',
top: 0, top: 0,
left: 0, left: 0,
@@ -67,6 +66,8 @@ export const AlertsProvider = ({ children }) => {
justifyContent: 'center', justifyContent: 'center',
alignItems: 'center', alignItems: 'center',
padding: '4px', padding: '4px',
paddingTop: `calc(var(--safe-area-inset-top, 0px))`,
fontSize: '10px', fontSize: '10px',
fontWeight: 'md', fontWeight: 'md',
}} }}

View File

@@ -109,6 +109,16 @@ class StatusBarManager {
// Note: We no longer apply padding directly to the body to avoid double // Note: We no longer apply padding directly to the body to avoid double
// application with component-level safe area handling. Components should // application with component-level safe area handling. Components should
// use the CSS custom properties or the utility classes from safe-area.css // use the CSS custom properties or the utility classes from safe-area.css
// Let's apply it directly to body for now:
if (Capacitor.getPlatform() === 'android') {
// removing the top padding on android as it is handled by the navbar
// and adding it causes double padding
// document.body.style.paddingTop = `${insets.top}px`
document.body.style.paddingRight = `${insets.right}px`
document.body.style.paddingBottom = `${insets.bottom}px`
document.body.style.paddingLeft = `${insets.left}px`
}
} }
/** /**

View File

@@ -67,7 +67,7 @@ export async function UploadFile(url, options) {
export async function Fetch(url, options) { export async function Fetch(url, options) {
if (!isTokenValid()) { if (!isTokenValid()) {
Cookies.set('ca_redirect', window.location.pathname) Cookies.set('ca_redirect', window.location.pathname)
if (!window.location.pathname === '/login') { if (window.location.pathname !== '/login') {
window.location.href = '/login' window.location.href = '/login'
} }
} }

View File

@@ -1,4 +1,4 @@
import Logo from '@/assets/logo.svg' import { Capacitor } from '@capacitor/core'
import { import {
Archive, Archive,
ArrowBack, ArrowBack,
@@ -22,7 +22,7 @@ import {
Typography, Typography,
} from '@mui/joy' } from '@mui/joy'
import { useState } from 'react' import { useEffect, useState } from 'react'
import { useLocation, useNavigate } from 'react-router-dom' import { useLocation, useNavigate } from 'react-router-dom'
import { version } from '../../../package.json' import { version } from '../../../package.json'
import UserProfileAvatar from '../../components/UserProfileAvatar' import UserProfileAvatar from '../../components/UserProfileAvatar'
@@ -87,6 +87,7 @@ const links = [
}, },
] ]
import { SafeArea } from 'capacitor-plugin-safe-area'
import Z_INDEX from '../../constants/zIndex' import Z_INDEX from '../../constants/zIndex'
const NavBar = () => { const NavBar = () => {
@@ -97,12 +98,35 @@ const NavBar = () => {
() => setDrawerOpen(false), () => setDrawerOpen(false),
] ]
const location = useLocation() const location = useLocation()
// if url has /landing then remove the navbar: useEffect(() => {
SafeArea.getSafeAreaInsets().then(data => {
const { insets } = data
const drawerContent = document.querySelector('.drawer-content')
if (drawerContent) {
drawerContent.style.paddingTop = `${insets.top}px`
drawerContent.style.paddingRight = `${insets.right}px`
drawerContent.style.paddingBottom = `${insets.bottom}px`
drawerContent.style.paddingLeft = `${insets.left}px`
}
})
}, [])
if ( if (
['/signup', '/login', '/landing', '/forgot-password'].includes( ['/signup', '/login', '/forgot-password', '/login/settings'].includes(
location.pathname, location.pathname,
) )
) { ) {
return (
// no navbar but show the safe area padding
<div
style={{
paddingTop: `calc(var(--safe-area-inset-top, 0px))`,
top: 0,
}}
/>
)
}
// if url has /landing then remove the navbar:
if (location.pathname === '/landing') {
return null return null
} }
if ( if (
@@ -116,11 +140,14 @@ const NavBar = () => {
<nav <nav
className='flex gap-2 p-3' className='flex gap-2 p-3'
style={{ style={{
paddingTop: `calc(var(--safe-area-inset-top, 0px) + 12px)`, paddingTop:
Capacitor.getPlatform() === 'android'
? `calc(var(--safe-area-inset-top, 0px))`
: '',
position: 'sticky', position: 'sticky',
zIndex: Z_INDEX.NAVBAR, zIndex: Z_INDEX.NAVBAR,
top: 0, top: 0,
minHeight: '45px', minHeight: '35px',
backgroundColor: 'var(--joy-palette-background-body)', backgroundColor: 'var(--joy-palette-background-body)',
}} }}
> >

View File

@@ -21,11 +21,12 @@ const NetworkBanner = () => {
variant='soft' variant='soft'
color='warning' color='warning'
sx={{ sx={{
padding: '4px',
position: 'fixed', position: 'fixed',
paddingTop: `calc(var(--safe-area-inset-top, 0px))`,
top: 0, top: 0,
left: 0, left: 0,
zIndex: Z_INDEX.NETWORK_BANNER, zIndex: Z_INDEX.NETWORK_BANNER,
padding: '4px',
pt: `calc( env(safe-area-inset-top, 0px))`, pt: `calc( env(safe-area-inset-top, 0px))`,
width: '100%', width: '100%',
justifyContent: 'center', justifyContent: 'center',