I am trying to find a way to remove an activity from the stack- We have a flow in our app: activity/viewmodel a -> activity/viewmodel b ->activity/viewmodel c. In c the user have the posibility of choosing a date or go back. If he goes back he should be returned to b. However if he chooses a date he is fowarded to a new instance of activity/viewmodel b and the "old" instance of activity/viewmodel b is obsolete and should be removed.
A suggestion from Stuart Lodge (on a similar thread, just for mono touch) was to use RequestRemoveBackStep() but I am not sure how to use it and I cant find an example.
Can anyone point me in the right direction?
Regards
The
RequestRemoveBackStep()
method is a member of theIMvxViewDispatcher
interface and is implemented on some platforms:from https://github.com/slodge/MvvmCross/blob/vnext/Cirrious/Cirrious.MvvmCross/Interfaces/Views/IMvxViewDispatcher.cs
However, its not entirely simple to always do this... so on Droid, for example, it is currently implemented as:
from https://github.com/slodge/MvvmCross/blob/vnext/Cirrious/Cirrious.MvvmCross.Droid/Views/MvxAndroidViewDispatcher.cs
There are issues logged about this functionality - e.g. https://github.com/slodge/MvvmCross/issues/80 - but it seems likely that this functionality might simply be dropped from future Mvx implementations - especially as it's not very easy to do for every view on every platform.
If you need this type of functionality now, then you'll need to find your own way of implementing this functionality... depending on what your specific use case is (sorry - the details of your current use case aren't clear to me from the question).
There are several technical routes available including:
NoHistory
flagsRequestClose(oldviewModel)
callsPresenter
Messenger
to request views close themselves.