Back button always firing "modal dismiss" instead of "sidemenu close" or "return to previous view"?

I have been following the docs here:$ionicPlatform/

I have overridden the “Return to previous view = 100” with a function like so

var deregisterBackButtonOverride = $ionicPlatform.registerBackButtonAction(function(){
    /* do stuff */

If I then override the “Dismiss modal = 200” with a function:

var deregisterBackButtonModalOverride = $ionicPlatform.registerBackButtonAction(function(){
    /* do stuff */

The closure of the sidemenu and returning to a previous view using the back button stops functioning entirely (???), i.e. trying to dismiss a modal “or” trying to close the sidemenu, or trying to go back a view results in the priority 201 function being called.

In the docs it says

Only one action will execute when the back button is clicked, so this method decides which of the registered back button actions has the highest priority

So my presumption is if you override dismiss modal, then that function should NOT be being called when no modal is open as ionic should decide that the highest priority should be either closing a sidemenu or going back (depending on the situation), I don’t understand why (given no modal being open) that ionic is firing a priority 201?

EDIT: I’ve also tried overriding the existing priorities (100, 200 instead of 101, 201)

This is on android (cordova 5.4.1, ionic 1.2.4)

FURTHER EDIT: The way this actually seems to work, is not what I expect, basically whatever priority number you assign you basically override all functions up to that priority.

So if you assign 200 you need to write your own handlers for all functions up to that priority (WTF?)

This CAN’T be what was intended?!!?!?!?

Put another way, if you override at priority 200, in the handler you override with you have to deal with returning to a previous view AND closing a side menu AND dismissing modals. Surely, an override at 200 should ONLY override the modal dismiss code and code at 100 and 150 should remain default unless overridden???

Nevermind, I fixed my problem another way…

I was trying to run specific code for “going back to a previous view” as well as “do something when a modal closes”, the solution is to override the back button for priority 100 ONLY and override:

$scope.$on("modal.hidden",function(){ /* do stuff */ })

for the respective view’s controller that the modal belongs to.