Closed DrobyshevAlex closed 6 years ago
Ok, the Problem was introduced with the lifecycle change of #257 to onStop() (was onDestroyView() before). I have to rethink the solution of #257 or maybe introduce breaking API changes (see #262)
Why not just call in MviBaseFragment detachView(false) in Fragment.onDestroy()?
because attachView() is called possible more often (since invoked in onStart()) then detachView() (called in onDestroy() )
count of onStart == count of onStop?
if take version 3.0.4 and make like
public abstract class BaseFragment<V extends MvpView, P extends MviPresenter> extends MviFragment {
protected P presenter;
private boolean isAttached = true;
@Override
public void onStart() {
super.onStart();
if (presenter != null && !isAttached) {
presenter.attachView(this);
}
}
@Override
public void onStop() {
super.onStop();
if (presenter != null && isAttached) {
presenter.detachView(true);
}
}
@Override
public void onDestroy() {
super.onDestroy();
presenter.detachView(false);
}
}
since 3.0.5 i make simple
public abstract class BaseFragment<V extends MvpView, P extends MviPresenter> extends MviFragment {
protected P presenter;
@Override
public void onDestroy() {
super.onDestroy();
presenter.detachView(false);
}
My app work is right. unsubscribe work
See #274. Feel free to reopen this issue if 3.1.0 (snapshot) doesn't solve this porblem.
In continuation to #257