tinymachine icon indicating copy to clipboard operation
tinymachine copied to clipboard

StateHandler not invoked

Open vishalg0wda opened this issue 7 years ago • 1 comments

StateHandler does not get invoked if defined with primitive datatypes:

@StateHandler(state = STATE_LOCATION_RESOLUTION_REQUIRED)
public void onEventStateLocationResolutionRequired(boolean success, TinyMachine tm) {
    // Code does not flow here.
    if (success) tm.transitionTo(STATE_BINDING_SERVICE);
    else tm.transitionTo(STATE_FAILED_LOCATION_RESOLUTION);
}

...

mTinyMachine.transitionTo(STATE_LOCATION_RESOLUTION_REQUIRED);
mTinyMachine.fireEvent(true);

This is probably not a bug, but I believe it should be mentioned in the docs. Would definitely save someone else the time.

Aside: thank you for this wonderful library! We're using it extensively in our app. :)

vishalg0wda avatar Jan 31 '18 22:01 vishalg0wda

Few more features would be great to have:

  • Allowed transitions support, meaning to block transitions to new state which are not allowed
  • Undo: support undoing last tranisitions

igala avatar Feb 26 '18 12:02 igala