Closed vtjiles closed 3 years ago
What seems to work for me is to move the await _dynamicLinkService.handleDynamicLinks();
and await _pushNotificationService.initialise();
after the handleStartUpLogic()
- so the initial navigation (HomeViewRoute
/ LoginViewRoute
) will be called first, then the app will navigate to the dynamic link / push notification view
Future handleStartUpLogic() async {
var hasLoggedInUser = await _authenticationService.isUserLoggedIn();
if (hasLoggedInUser) {
_navigationService.navigateTo(HomeViewRoute);
} else {
_navigationService.navigateTo(LoginViewRoute);
}
await _dynamicLinkService.handleDynamicLinks();
// Register for push notifications
await _pushNotificationService.initialise();
}
I ended up doing the same and moving the initial dynamic link check into the startup navigation logic so that it could fire instead of, or after, the main screen depending on the link destination instead of when the service was initialized. Thanks for the suggestion. Had forgotten to close this.
When launching the app with a handled dynamic link or notification, the code will navigate to a post and then navigate either to the login or home route which would cover up the post.
Am I missing something and this is not an issue? How have others dealt with initial navigation when using dynamic links and notifications?