analytics event added
This commit is contained in:
parent
c0bd08cc88
commit
4a96bc0d36
|
|
@ -149,6 +149,10 @@ public class ViewController<TActivity extends ViewControllerActivity<?>,
|
|||
isStartedSubject.onNext(true);
|
||||
}
|
||||
|
||||
public void onAppear(@NonNull final ViewControllerFragment.AppearType appearType) {
|
||||
//do nothing
|
||||
}
|
||||
|
||||
public void onSaveInstanceState(@NonNull final Bundle savedInstanceState) {
|
||||
// do nothing
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,6 +73,7 @@ public abstract class ViewControllerFragment<TState extends AbstractState, TActi
|
|||
private Subscription viewControllerSubscription;
|
||||
private TState state;
|
||||
private boolean isStarted;
|
||||
private boolean startedAtLeastOnce;
|
||||
|
||||
/**
|
||||
* Returns specific object which contains state of ViewController.
|
||||
|
|
@ -170,7 +171,19 @@ public abstract class ViewControllerFragment<TState extends AbstractState, TActi
|
|||
isStarted = true;
|
||||
if (viewController != null) {
|
||||
viewController.onStart();
|
||||
if (isMenuVisible()) {
|
||||
viewController.onAppear(!startedAtLeastOnce ? AppearType.STARTED : AppearType.STARTED_AGAIN);
|
||||
}
|
||||
}
|
||||
startedAtLeastOnce = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMenuVisibility(final boolean menuVisible) {
|
||||
if (menuVisible && !isMenuVisible() && viewController != null) {
|
||||
viewController.onAppear(AppearType.ACTIVATED);
|
||||
}
|
||||
super.setMenuVisibility(menuVisible);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -249,4 +262,13 @@ public abstract class ViewControllerFragment<TState extends AbstractState, TActi
|
|||
|
||||
}
|
||||
|
||||
public enum AppearType {
|
||||
// fragment just started first time
|
||||
STARTED,
|
||||
// fragment started after stop
|
||||
STARTED_AGAIN,
|
||||
// fragment activated (started and menu visibility is true)
|
||||
ACTIVATED
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue