-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: onboarding mechanics and navigation #1464
base: main
Are you sure you want to change the base?
refactor: onboarding mechanics and navigation #1464
Conversation
9d17b8b
to
db9bc97
Compare
@@ -15,36 +15,37 @@ import { createCarouselStyle } from '../screens/OnboardingPages' | |||
import PINCreate from '../screens/PINCreate' | |||
import PINEnter from '../screens/PINEnter' | |||
import PushNotification from '../screens/PushNotification' | |||
// import UpdateAvailable from '../screens/UpdateAvailable' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason to keep this comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
@@ -105,6 +105,6 @@ describe('Splash Screen', () => { | |||
jest.runAllTimers() | |||
}) | |||
|
|||
expect(navigation.dispatch).toHaveBeenCalledTimes(1) | |||
expect(navigation.dispatch).toHaveBeenCalledTimes(0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: what are we testing for if we don't expect this to be called?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few small non-blocking suggestions and some questions
PushNotification: React.FC<StackScreenProps<ParamListBase, Screens.UsePushNotifications>> | ||
Developer: React.FC<StackScreenProps<ParamListBase>> | ||
AttemptLockout: React.FC<StackScreenProps<ParamListBase>> | ||
OnBoardingScreen: React.FC |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we take the opportunity to change this while we're touching this code, so it's the same casing as it is everywhere else?
OnBoardingScreen: React.FC | |
OnboardingScreen: React.FC |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
@@ -73,7 +81,7 @@ const OnboardingStack: React.FC = () => { | |||
[dispatch] | |||
) | |||
|
|||
const OnBoardingScreen = () => { | |||
const OnBoardingScreen = useCallback(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const OnBoardingScreen = useCallback(() => { | |
const OnboardingScreen = useCallback(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
() => store.authentication.didAuthenticate && store.onboarding.postAuthScreens.length === 0, | ||
[store.authentication.didAuthenticate, store.onboarding.postAuthScreens] | ||
) | ||
const isOnboardingComplete = useMemo(() => onboardingComplete, [onboardingComplete]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this useMemo
will have any effect. I think primitive values already only cause re-renders when they change. If they are reassigned to the same value they don't cause re-renders (afaik)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
const { t } = useTranslation() | ||
const Stack = createStackNavigator() | ||
const theme = useTheme() | ||
const OnboardingTheme = theme.OnboardingTheme | ||
const carousel = createCarouselStyle(OnboardingTheme) | ||
const [ | ||
splash, | ||
config, | ||
Splash, | ||
pages, | ||
useBiometry, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is a screen (JSX) and not a hook it should probably be capitalized. Not something we have to do in this PR, just at some point
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean "useBiometry" if so I created a ticket with some issues I noticed along the way and this was one. I think it should be renamed to not use use
in the name for clarity.
if (store.onboarding.didCompleteOnboarding) { | ||
navigation.goBack() | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this screen can be accessed from the settings menu, not just onboarding. So that call to navigation.goBack()
might still be needed in that case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
setMounted(true) | ||
}, []) | ||
|
||
useEffect(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this change, what does the user see while state is being loaded for the first time on a cold start?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I may need to add this back then. It's a bit confusing but we have a splash screen imported from a NPM package and our Splash screen. I assumed there was a bug in the NPM version that is meant to show the app logo screen until the "state" is loaded at which point the app can then continue. Maybe I need to update Splash to show in two different ways, or fix the npm package to work.
Signed-off-by: Jason C. Leach <[email protected]>
Signed-off-by: Jason C. Leach <[email protected]>
Signed-off-by: Jason C. Leach <[email protected]>
Signed-off-by: Jason C. Leach <[email protected]>
Signed-off-by: Jason C. Leach <[email protected]>
Signed-off-by: Jason C. Leach <[email protected]>
Signed-off-by: Jason C. Leach <[email protected]>
Signed-off-by: Jason C. Leach <[email protected]>
Signed-off-by: Jason C. Leach <[email protected]>
Signed-off-by: Jason C. Leach <[email protected]>
Signed-off-by: Jason C. Leach <[email protected]>
Signed-off-by: Jason C. Leach <[email protected]>
Signed-off-by: Jason C. Leach <[email protected]>
Signed-off-by: Jason C. Leach <[email protected]>
Signed-off-by: Jason C. Leach <[email protected]>
Signed-off-by: Jason C. Leach <[email protected]>
Signed-off-by: Jason C. Leach <[email protected]>
Signed-off-by: Jason C. Leach <[email protected]>
Signed-off-by: Jason C. Leach <[email protected]>
Signed-off-by: Jason C. Leach <[email protected]>
Signed-off-by: Jason C. Leach <[email protected]>
992421f
to
ad95120
Compare
Signed-off-by: Jason C. Leach <[email protected]>
Signed-off-by: Jason C. Leach <[email protected]>
Signed-off-by: Jason C. Leach <[email protected]>
|
Summary of Changes
Improving Onboarding Flexibility
Currently, adding or reorganizing onboarding screens is cumbersome due to hardcoded navigation logic. This PR simplifies the process by relying more on application state and less on manual navigation rules.
Key Changes:
OnboardingStack
automatically displays the first incomplete screen.MainStack
.CreatePIN
and/orEnterPIN
.Screenshots, videos, or gifs
Replace this text with embedded media for UI changes if they are included in this PR. If there are none, simply enter N/A
Breaking change guide
Replace this text with any breaking changes included in this PR along with how to address them in downstream projects. If there are none, simply enter N/A
Related Issues
Replace this text with issue #'s that are relevant to this PR. If there are none, simply enter N/A
Pull Request Checklist
Tick all boxes below to demonstrate that you have completed the respective task. If the item does not apply to your this PR check it anyway to make it apparent that there's nothing to do.
Signed-off-by
line (we use the DCO GitHub app to enforce this)If you have any questions to any of the points above, just submit and ask! This checklist is here to help you, not to deter you from contributing!
Pro Tip 🤓