zulip-desktop icon indicating copy to clipboard operation
zulip-desktop copied to clipboard

[WIP] Fix #650 Broken back button

Open adityamudgil2505 opened this issue 4 years ago • 7 comments

What's this PR do? Solve the issue of the broken back button #650 . When someone goes to a setting option, then want to return back to the previous tab of the organization, then the user can do using the back button.

Any background context you want to provide? This is being solved by adding a new variable that will keep track of the last tab(organization window) before going to the setting and when the user click on the back button then he will move to tab whose value is being stored in the variable.

GIF

Working

You have tested this PR on:

  • [ ] Windows
  • [ ] Linux/Ubuntu
  • [x] macOS

adityamudgil2505 avatar Mar 11 '20 19:03 adityamudgil2505

@adityamudgil2505 Does this add working for back cases with in the settings tab?

abhigyank avatar Mar 13 '20 05:03 abhigyank

@abhigyank No, it will get back to organisation.

adityamudgil2505 avatar Mar 13 '20 05:03 adityamudgil2505

I am not sure switching back to the organization after navigating a bit in the settings is a behavior that the user would expected. If the back is enabled in settings I suppose the user would then expect it to work with the settings window? I am not sure how the UX would be based on this change. Maybe someone else suggest if this'd be a good behavior. cc @rishig

abhigyank avatar Mar 18 '20 12:03 abhigyank

@abhigyank As both the ways have their own advantage and the way to solve this issue using both methods is similar.

adityamudgil2505 avatar Mar 18 '20 13:03 adityamudgil2505

@andersk @abhigyank I updated the code. Now when the user opens the application after installing, then the back button will be disabled. After adding one or more organizations, it will work as what back button has to do. We can also use the back button in settings. The code is very messy, as there are many corner cases. Back Idea: I created new data member in webview which will keep track of previous webview's index because we can move back inside webview without any problem but we can't move to different webview. Now we have two types of movement

  1. When going in the forward direction, when we just update the previous index of the new webview with the previous one.
  2. When going in a backward direction, first we need to update the previous webview index of the current webview tab to -1 to avoid infinite loop and then move.

To handle this, I modify activateTab to add one more parameter which will tell whether we are going in forward direction or backward direction. This will handle almost every case but it doesn't handle when we install the application for the first time, so I disable the back button there. We can enable the functionality of the back button in this case also but it requires some hard code.

adityamudgil2505 avatar Mar 23 '20 20:03 adityamudgil2505

@abhigyank Is this g2g or some work is left? cc @adityamudgil2505

manavmehta avatar Jul 01 '20 15:07 manavmehta

Heads up @adityamudgil2505, we just merged some commits that conflict with the changes your made in this pull request! You can review this repository's recent commits to see where the conflicts occur. Please rebase your feature branch against the upstream/master branch and resolve your pull request's merge conflicts accordingly.

zulipbot avatar Jul 14 '20 10:07 zulipbot