Android : with command --prod : statement not working


We are working on an app project with ionic3 for android. in the code we have :

 if(this.nav.getActive().name != "LicenceFiniPage" && this.nav.getActive().name != "DetailsPage" && this.nav.getActive().name != "DetailsAnalysePage" && this.nav.getActive().name != "LoginPage" && this.licence == "OK"){

When we try to test with the command ionic cordova run android it works fine but when we export the apk to the store with the command: ionic cordova build --release --prod android the statement if above is not working any more

Thank you for your precious help

–prod minifies string from this.nav.getActive().name, so you can not compare it.
Here is anywhere a longer thread to this behaviour.
Put for example a string interpolation of getActive.Name wherever to see what happens.

If it is really necessary that you compare pages, then use a property containing need information.

btw. Many things must checked, that your user can navigate. Have you thought to inform the user, why he can not navigate?

Best regards, anna-liebt

This is a larger issue than minification. One of the most fundamental concepts in programming is compartmentalization or separation of concerns, and code like this utterly stomps all over it.

Objects need to be self-contained entities, interacting with one another only through clearly-defined interfaces. You should never be poking around the internals of the navigation stack like this, anywhere. If behavior has to change based on whether a certain page is active, use the lifecycle events to register and unregister things.

Hello thank you for all of you
We will change code and let you know