I am controlling my backstack at the view model layer, as navigation structure of my app is the same in iOS and Android.
I have a concept of "topmost view model", for which no backstack should exist. Therefore, when displaying such a view model, I would like to close the existing ones.
IMvxNavigationService navigationService = GetFromSomewhere();
var existingViewModels = GetViewModelBackStack();
await navigationService.Navigate(newTopmostViewModel);
foreach (var viewModel in existingViewModels)
await navigationService.Close(viewModel);
However, in Android, the above code leads to my application being closed.
Whether I place Close
before or after the Navigate
call doesn't matter, the result is the same.
MvvmCross 5.7.0, single activity, all navigation is fragment-based. Page view models correspond to full screen fragments.
I know this can be done at the view presenter layer using various fragment manager hacks, but I don't want to resort to those and keep as much logic at the cross-platform layer as possible.
Any suggestions or ideas?