in my Application when logging out, I remove all Credentials and call
Application.Current.MainPage = new AppShell();
and I'm wondering if this is causing memory leaks or if I'm meant to do that.
From my understanding that is the way to go when I don't want the user to be able to navigate back.
EDIT:
In my application the user should only see all pages when he is logged. All pages (except login page) use following class:
public class LoggedContentPage : ContentPage
{
private readonly WebService _webService = new WebService();
protected override async void OnAppearing()
{
if (! await _webService.IsAuthenticated())
{
Application.Current.MainPage = new LoginPage();
}
}
}
In turn my Login page uses:
bool success = await _webService.Authenticate(userCred);
if (success)
{
Application.Current.MainPage = new AppShell();
}
Pressing the "back" button should not take the user back to the previous page in this case. What is the recommended way of navigating like this?