diff --git a/ios/App/Podfile.lock b/ios/App/Podfile.lock index 55ad0e8..f6b31b2 100644 --- a/ios/App/Podfile.lock +++ b/ios/App/Podfile.lock @@ -54,13 +54,13 @@ PODS: - AppCheckCore (~> 11.0) - GTMAppAuth (< 5.0, >= 4.1.1) - GTMSessionFetcher/Core (~> 3.3) - - GoogleUtilities/Environment (8.0.2): + - GoogleUtilities/Environment (8.1.0): - GoogleUtilities/Privacy - - GoogleUtilities/Logger (8.0.2): + - GoogleUtilities/Logger (8.1.0): - GoogleUtilities/Environment - GoogleUtilities/Privacy - - GoogleUtilities/Privacy (8.0.2) - - GoogleUtilities/UserDefaults (8.0.2): + - GoogleUtilities/Privacy (8.1.0) + - GoogleUtilities/UserDefaults (8.1.0): - GoogleUtilities/Logger - GoogleUtilities/Privacy - GTMAppAuth (4.1.1): @@ -181,7 +181,7 @@ SPEC CHECKSUMS: FBSDKCoreKit_Basics: 151b43db8b834d3f0e02f95d36a44ffd36265e45 FBSDKLoginKit: 5c1cd53c91a2282b3a4fe6e6d3dcf2b8b0d33d55 GoogleSignIn: ce8c89bb9b37fb624b92e7514cc67335d1e277e4 - GoogleUtilities: 26a3abef001b6533cf678d3eb38fd3f614b7872d + GoogleUtilities: 00c88b9a86066ef77f0da2fab05f65d7768ed8e1 GTMAppAuth: f69bd07d68cd3b766125f7e072c45d7340dea0de GTMSessionFetcher: 5aea5ba6bd522a239e236100971f10cb71b96ab6 PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47 diff --git a/src/CapacitorListener.js b/src/CapacitorListener.js index 3fd4961..f21ac2b 100644 --- a/src/CapacitorListener.js +++ b/src/CapacitorListener.js @@ -1,78 +1,82 @@ -import { LocalNotifications } from '@capacitor/local-notifications'; -import { App as mobileApp } from '@capacitor/app'; +import { App as mobileApp } from '@capacitor/app' +import { Capacitor } from '@capacitor/core' +import { LocalNotifications } from '@capacitor/local-notifications' import { PushNotifications } from '@capacitor/push-notifications' -import { PutNotificationTarget } from './utils/Fetcher'; -import { Capacitor } from '@capacitor/core'; +import { PutNotificationTarget } from './utils/Fetcher' const localNotificationListenerRegistration = () => { - LocalNotifications.addListener('localNotificationReceived', (notification) => { - console.log('Notification received', notification); - }); - LocalNotifications.addListener('localNotificationActionPerformed', (event) => { - - console.log('Notification action performed', event); - if (event.actionId === 'tap') { - console.log('Notification opened, navigate to chore', event.notification.extra.choreId); - window.location.href = `/chores/${event.notification.extra.choreId}` - } - }); - } - const pushNotificationListenerRegistration = () => { - PushNotifications.register(); - PushNotifications.addListener('registration', (token) => { - if (Capacitor.isNativePlatform()) { - const type = Capacitor.getPlatform() === 'android' ? 1 : 2; // 1 for android, 2 for ios - PutNotificationTarget(type, token.value).then((response) => { - console.log('Notification target updated', response); - } - ).catch((error) => { - console.error('Error updating notification target', error); - } - ); + LocalNotifications.addListener('localNotificationReceived', notification => { + console.log('Notification received', notification) + }) + LocalNotifications.addListener('localNotificationActionPerformed', event => { + console.log('Notification action performed', event) + if (event.actionId === 'tap') { + console.log( + 'Notification opened, navigate to chore', + event.notification.extra.choreId, + ) + window.location.href = `/chores/${event.notification.extra.choreId}` + } + }) +} +const pushNotificationListenerRegistration = () => { + PushNotifications.register() + PushNotifications.addListener('registration', token => { + if (Capacitor.isNativePlatform()) { + const type = Capacitor.getPlatform() === 'android' ? 1 : 2 // 1 for android, 2 for ios + PutNotificationTarget(type, token.value) + .then(response => { + console.log('Notification target updated', response) + }) + .catch(error => { + console.error('Error updating notification target', error) + }) // TODO save the token in preferences and only send it if it has changed: - console.log('Push registration success, token: ' + token.value); + console.log('Push registration success, token: ' + token.value) + } + }) + PushNotifications.addListener('registrationError', error => { + console.error('Error on registration: ' + JSON.stringify(error)) + }) + PushNotifications.addListener('pushNotificationActionPerformed', fcmEvent => { + if (fcmEvent.actionId === 'tap') { + if (fcmEvent.notification.data.type === 'chore_due') { + window.location.href = `/chores/${fcmEvent.notification.data.choreId}` + } else { + window.location.href = `/chores` } } - ); - PushNotifications.addListener('registrationError', (error) => { - console.error('Error on registration: ' + JSON.stringify(error)); + }) + PushNotifications.addListener('registrationError', error => { + console.error('Error on registration: ' + JSON.stringify(error)) + }) + PushNotifications.addListener('pushNotificationActionPerformed', fcmEvent => { + if (fcmEvent.actionId === 'tap') { + if (fcmEvent.notification.data.type === 'chore_due') { + window.location.href = `/chores/${fcmEvent.notification.data.choreId}` + } else { + window.location.href = `/chores` + } } - ); - PushNotifications.addListener('pushNotificationActionPerformed', fcmEvent => { - - if(fcmEvent.actionId === 'tap') { - if (fcmEvent.notification.data.type === 'chore_due') { - window.location.href = `/chores/${fcmEvent.notification.data.choreId}` - } - else { - window.location.href = `/my/chores` - } + }) +} + +const registerCapacitorListeners = () => { + if (!Capacitor.isNativePlatform()) { + console.log( + 'Not a native platform, skipping registration of native listeners', + ) + return + } + localNotificationListenerRegistration() + pushNotificationListenerRegistration() + mobileApp.addListener('backButton', ({ canGoBack }) => { + if (canGoBack) { + window.history.back() + } else { + mobileApp.exitApp() } - } - ); - } - - + }) +} - - - - const registerCapacitorListeners = () => { - if(!Capacitor.isNativePlatform()) { - console.log('Not a native platform, skipping registration of native listeners'); - return - } - localNotificationListenerRegistration(); - pushNotificationListenerRegistration(); - mobileApp.addListener('backButton', ({ canGoBack }) => { - if (canGoBack) { - window.history.back(); - } else { - mobileApp.exitApp(); - } - }); - - - } - - export { registerCapacitorListeners } \ No newline at end of file +export { registerCapacitorListeners } diff --git a/src/views/Authorization/Authenticating.jsx b/src/views/Authorization/Authenticating.jsx index 36ce15c..3ecf99e 100644 --- a/src/views/Authorization/Authenticating.jsx +++ b/src/views/Authorization/Authenticating.jsx @@ -36,7 +36,7 @@ const AuthenticationLoading = () => { Cookies.remove('ca_redirect') Navigate(redirectUrl) } else { - Navigate('/my/chores') + Navigate('/chores') } }) }) diff --git a/src/views/Authorization/LoginView.jsx b/src/views/Authorization/LoginView.jsx index da5f8ff..15fd8f4 100644 --- a/src/views/Authorization/LoginView.jsx +++ b/src/views/Authorization/LoginView.jsx @@ -110,7 +110,7 @@ const LoginView = () => { Navigate(redirectUrl) } else { Cookies.remove('ca_redirect') - Navigate('/my/chores') + Navigate('/chores') } }) } else if (response.status === 401) { @@ -206,7 +206,7 @@ const LoginView = () => { Cookies.remove('ca_redirect') Navigate(redirectUrl) } else { - Navigate('/my/chores') + Navigate('/chores') } }) } @@ -225,7 +225,7 @@ const LoginView = () => { Cookies.remove('ca_redirect') Navigate(redirectUrl) } else { - Navigate('/my/chores') + Navigate('/chores') } } diff --git a/src/views/Authorization/Signup.jsx b/src/views/Authorization/Signup.jsx index a1222aa..58ba90d 100644 --- a/src/views/Authorization/Signup.jsx +++ b/src/views/Authorization/Signup.jsx @@ -35,7 +35,7 @@ const SignupView = () => { setTimeout(() => { // TODO: not sure if there is a race condition here // but on first sign up it renavigates to login. - Navigate('/my/chores') + Navigate('/chores') }, 500) }) } else { diff --git a/src/views/ChoreEdit/ChoreEdit.jsx b/src/views/ChoreEdit/ChoreEdit.jsx index c9900aa..afb28bf 100644 --- a/src/views/ChoreEdit/ChoreEdit.jsx +++ b/src/views/ChoreEdit/ChoreEdit.jsx @@ -252,7 +252,7 @@ const ChoreEdit = () => { title: 'Chore Saved', message: 'Your task has been saved successfully!', }) - Navigate('/my/chores/') + Navigate('/chores/') }) .catch(error => { console.error('Failed to save chore:', error) @@ -390,7 +390,7 @@ const ChoreEdit = () => { if (isConfirmed === true) { DeleteChore(choreId).then(response => { if (response.status === 200) { - Navigate('/my/chores') + Navigate('/chores') } else { alert('Failed to delete chore') } diff --git a/src/views/Circles/JoinCircle.jsx b/src/views/Circles/JoinCircle.jsx index c967d67..76f5101 100644 --- a/src/views/Circles/JoinCircle.jsx +++ b/src/views/Circles/JoinCircle.jsx @@ -85,14 +85,14 @@ const JoinCircleView = () => { alert( 'Joined circle successfully, wait for the circle owner to accept your request.', ) - navigate('/my/chores') + navigate('/chores') } else { if (resp.status === 409) { alert('You are already a member of this circle') } else { alert('Failed to join circle') } - navigate('/my/chores') + navigate('/chores') } }) }} @@ -111,7 +111,7 @@ const JoinCircleView = () => { borderRadius: '8px', }} onClick={() => { - navigate('/my/chores') + navigate('/chores') }} > Cancel diff --git a/src/views/Error.jsx b/src/views/Error.jsx index 12f5d24..b140ed2 100644 --- a/src/views/Error.jsx +++ b/src/views/Error.jsx @@ -1,12 +1,5 @@ import { HomeRounded, Login } from '@mui/icons-material' -import { - Box, - Button, - CircularProgress, - Container, - Textarea, - Typography, -} from '@mui/joy' +import { Box, Button, CircularProgress, Container, Typography } from '@mui/joy' import { Link } from 'react-router-dom' import Logo from '../Logo' // Adjust the import path as necessary @@ -50,7 +43,7 @@ const Error = () => { ) diff --git a/src/views/Home.jsx b/src/views/Home.jsx index 4b16a1e..894e7a7 100644 --- a/src/views/Home.jsx +++ b/src/views/Home.jsx @@ -33,7 +33,7 @@ const Home = () => { ) diff --git a/src/views/components/NavBar.jsx b/src/views/components/NavBar.jsx index 3db76c7..fbd86bc 100644 --- a/src/views/components/NavBar.jsx +++ b/src/views/components/NavBar.jsx @@ -179,8 +179,9 @@ const NavBar = () => { position: 'fixed', pt: 'calc(env(safe-area-inset-top, 0px))', left: 0, - height: - 'calc(100vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px))', + pb: 'calc(env(safe-area-inset-bottom, 0px))', + // height: + // 'calc(100vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px))', overflow: 'auto', zIndex: Z_INDEX.DRAWER, }, diff --git a/src/views/components/NotFound.jsx b/src/views/components/NotFound.jsx index 8da2ea5..8bc1a2e 100644 --- a/src/views/components/NotFound.jsx +++ b/src/views/components/NotFound.jsx @@ -35,7 +35,7 @@ const NotFound = () => {