In my app, users have to login the first time, but a token is generated to allow them to skip the login process on subsequent logins. The login page checks that the token is correct in its viewmodel constructor, calling Shell.Current.GoToAsync() if it is. This does not work as it should, as the login page was not completely loaded when the new page was pushed, and will load on top of the new page. I have tried the workaround in this question, but that does not work either. Here's a part of the code:
public LoginPageViewModel()
{
userData = (Application.Current as App).userData;
SendLogin = new Command(Login);
TokenLogin();
}
//Attempts to login via token
private async void TokenLogin()
{
string user = Tokenizer.GetTokenUser();
string token = Tokenizer.GetToken();
if(userData.TokenLogin(user, token))
{
await Shell.Current.GoToAsync(nameof(CategoryPage));//Login successful
}
}