Disable back icon in menu after pressing Link Widget in mobile app

Disable back icon in menu after pressing Link Widget in mobile app

  

Hi everyone,

After I click/press a link in my mobile app that send me to an other screen I always get the back icon in the upper left corner of my menu. There are some situations that i don't want to have the back icon displayed after i clicked a link. I figured out that if I connect a On click event of a link with a client action, and in that action i use a destination as end node, the back icon won't be displayed in the new screen. 

But I'm not sure if this is the right way to do it, because now i have to create a client action everytime i want to use a link and don't have the back icon displayed. Anyone has an other option on how to get this done?

Hi Jordi,

The Menu pattern has an input parameter called MenuAction that allows you to control that behavior.

The parameter is taken from the MenuAction static entity:



On the screens where you don't want the default behavior (Auto) you can pass a different parameter to the Menu block. From reading your use case it sounds like you'd pass in Menu or Hidden in those screens.

Hope this helps. Let me know if it doesn't.

Cheers

Daniel Luz wrote:

Hi Jordi,

The Menu pattern has an input parameter called MenuAction that allows you to control that behavior.

The parameter is taken from the MenuAction static entity:



On the screens where you don't want the default behavior (Auto) you can pass a different parameter to the Menu block. From reading your use case it sounds like you'd pass in Menu or Hidden in those screens.

Hope this helps. Let me know if it doesn't.

Cheers


Hi Daniel,

Thank you for your reply. Your solution solves a part of the problem. But i am still stuck at the destination of the back button in the menu block. For example:

  1. I start in the HomeScreen
  2. In the HomeScreen there is a link that links me to a personal information screen. In this screen a back button in the menu is available to send me back to the HomeScreen. I press the link that send me to the personal information screen.
  3. When i'm in the personal information screen i click the link that send me to a change password screen.
  4. In this screen i type my password to check if i know my current password. After that i'm send to a new screen where i can insert my new password 2 times.
  5. If the 2 passwords are correct i will be send to a new screen where a succes message and icon is displayed
  6. From that screen i can choose between two links, one that send me to the HomeScreen and one that send me to the personal information screen(the one in step 2).
  7. I click the link that send me to the personal information screen because maybe i want to do more stuff in this screen.
  8. After i'm back in the personal information screen i figured out i don't want to use the personal information screen and i want to go back to the HomeScreen, so i click the back button.
  9. But the back button send me back to the successfully password change screen, since this is the last screen i visited before i went to the personal information screen. 
  10.  The problem is I cannot set the back destination screen dynamic in a easy way.


For now i altered the MenuIcon block.

I added a input text parameter called Screen and a client logic called BackOnClick

When the back button in the menu is clicked the logic above is triggerd.

For all the screens that need this kind of dynamic behaviour in the back button have a input parameter that can be used to determine if the back button have to do the default behaviour or the dynamic behaviour. The switch can be expanded if there are more screen who have to handle this behaviour in the back button.

It works but i think is this could be done easier.


Solution

Hi Jordi,

The destination of the back navigation is something that needs some thought in mobile apps. In our apps we've had to go through the same thought process you're going through now.

As you pointed out, the default back navigation is the same as a browser, which makes sense as the native app is essentially a browser. When we want the back navigation to behave differently we need to build that logic ourselves, which also makes sense because it's really business logic, which can't be implemented without knowledge of the particular use case.

To me your approach makes sense. I could suggest that you pass the screen URL directly as an input parameter and just navigate to it. This way you don't need the switch statement.

You could also use the Platform's public JS API to control the back navigation without having to change the MenuIcon block. You can register your own handler for each screen and have it redirect to the page of your choice.

Here's a quick example:

OnInitialize, a JS node similar to this would register your handler and output the ID:


OnDestroy, a JS node similar to this would unregister your handler:


The ControlBackNavigation action would contain your redirection code (pretty much what you have already).

So this is just an alternative tool to achieve what you were doing already.

Hope it helps. Let me know if you have any questions.

Cheers

Solution

Thank you Daniel for helping me out.


Best regards.


Do you have an example eSpace on how to use this the Platform's public JS API to control the back navigation ?

Hi Mathias,

Unfortunately I don't have a sample module ready to share with you. I could make one but I'm not able to commit to a timeframe to deliver it.

In the meantime, I hope the pointers I provided in the post above can help you. It's not the same as an example module, but it should hopefully be enough to get you started.

Cheers,

Daniel

Daniel,

I tried to implement it with the post above, but it didn't work; So a example module would help me a lot.

Hope you can share a simple eSpace with me...

Kind regards,

Matthias

Hi Matthias,

I have attached a simple example with this functionality working.

Sorry I know it's been a while, but it's the best I could do.

Cheers,

Daniel