Refactor navigation paths to use '/chores' instead of '/my/chores' across multiple components for consistency
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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 }
|
||||
export { registerCapacitorListeners }
|
||||
|
||||
@@ -36,7 +36,7 @@ const AuthenticationLoading = () => {
|
||||
Cookies.remove('ca_redirect')
|
||||
Navigate(redirectUrl)
|
||||
} else {
|
||||
Navigate('/my/chores')
|
||||
Navigate('/chores')
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
@@ -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')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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')
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 = () => {
|
||||
|
||||
<Button
|
||||
component={Link}
|
||||
to='/my/chores'
|
||||
to='/chores'
|
||||
variant='outlined'
|
||||
color='primary'
|
||||
sx={{ mt: 4 }}
|
||||
|
||||
@@ -179,7 +179,7 @@ const ChoreHistory = () => {
|
||||
they'll show up here.
|
||||
</Typography>
|
||||
<Button variant='soft' sx={{ mt: 2 }}>
|
||||
<Link to='/my/chores'>Go back to chores</Link>
|
||||
<Link to='/chores'>Go back to chores</Link>
|
||||
</Button>
|
||||
</Container>
|
||||
)
|
||||
|
||||
@@ -33,7 +33,7 @@ const Home = () => {
|
||||
<Button
|
||||
sx={{ mt: 1 }}
|
||||
onClick={() => {
|
||||
Navigate('/my/chores')
|
||||
Navigate('/chores')
|
||||
}}
|
||||
>
|
||||
Get Started!
|
||||
|
||||
@@ -79,7 +79,7 @@ const GettingStarted = () => {
|
||||
fullWidth
|
||||
startDecorator={<AutoAwesome />}
|
||||
onClick={() => {
|
||||
navigate('/my/chores')
|
||||
navigate('/chores')
|
||||
}}
|
||||
>
|
||||
Start Now!
|
||||
|
||||
@@ -97,12 +97,12 @@ const HomeHero = () => {
|
||||
}}
|
||||
className='hover:scale-105'
|
||||
onClick={() => {
|
||||
// if the url is donetick.com then navigate to app.donetick.com/my/chores
|
||||
// else navigate to /my/chores
|
||||
// if the url is donetick.com then navigate to app.donetick.com/chores
|
||||
// else navigate to /chores
|
||||
if (window.location.hostname === 'donetick.com') {
|
||||
window.location.href = 'https://app.donetick.com/my/chores'
|
||||
window.location.href = 'https://app.donetick.com/chores'
|
||||
} else {
|
||||
navigate('/my/chores')
|
||||
navigate('/chores')
|
||||
}
|
||||
}}
|
||||
>
|
||||
|
||||
@@ -8,7 +8,7 @@ const PaymentCancelledView = () => {
|
||||
|
||||
useEffect(() => {
|
||||
const timer = setTimeout(() => {
|
||||
navigate('/my/chores')
|
||||
navigate('/chores')
|
||||
}, 5000)
|
||||
return () => clearTimeout(timer)
|
||||
}, [navigate])
|
||||
|
||||
@@ -811,7 +811,7 @@ const UserActivites = () => {
|
||||
You have no activities for the selected period.
|
||||
</Typography>
|
||||
<Button variant='soft' sx={{ mt: 2 }}>
|
||||
<Link to='/my/chores'>Go back to chores</Link>
|
||||
<Link to='/chores'>Go back to chores</Link>
|
||||
</Button>
|
||||
</Container>
|
||||
)
|
||||
|
||||
@@ -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,
|
||||
},
|
||||
|
||||
@@ -35,7 +35,7 @@ const NotFound = () => {
|
||||
</Typography>
|
||||
<Button
|
||||
component={Link}
|
||||
to='/my/chores'
|
||||
to='/chores'
|
||||
variant='outlined'
|
||||
color='primary'
|
||||
sx={{ mt: 4 }}
|
||||
|
||||
Reference in New Issue
Block a user