Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BugFix - Unify Drawer Menu Item Handling #13513

Merged
merged 14 commits into from
Sep 12, 2024

Conversation

alperozturk96
Copy link
Collaborator

@alperozturk96 alperozturk96 commented Sep 4, 2024

  • Tests written, or not not needed

  • Stores the menu item value in memory, eliminating the need for argument passing and state management when restoring the menu item.

  • Calls setDrawerMenuItemChecked() only when necessary, ensuring a single source of truth for the menu item state.

  • Utilizes DrawerActivity to manage the menu item, with sub-activities modifying the item as needed.

  • Removes redundant logic related to menu item handling.

How to Test?

  1. Navigate through multiple tabs, put the app in the background, then bring it back to the foreground and check the highlighted drawer menu.
  2. Navigate to All Files → Favorites → Uploads → Press Back, and verify the highlighted drawer menu.
  3. Navigate to All Files → Uploads and check the highlighted drawer menu.
  4. Navigate to All Files → Community and check the highlighted drawer menu.
  5. Navigate through multiple tabs, then rotate the device and check the highlighted drawer menu.
  6. Navigate through multiple tabs, lock the screen, then unlock it and check the highlighted drawer menu.
  7. Try previous scenarios with passcode.

Copy link
Collaborator

@ZetaTom ZetaTom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When selecting Personal Files from the Activities tab, All files will be selected instead.

On a side note, I don't think we should be using string matching to determine which tab is currently open.

@alperozturk96
Copy link
Collaborator Author

When selecting Personal Files from the Activities tab, All files will be selected instead.

On a side note, I don't think we should be using string matching to determine which tab is currently open.

This is a workaround solution and @tobiasKaminsky we decided to fix it this way until we have better codebase and structure.

Obviously the whole structure, navigation flow is wrong and broken. That's not the case in here. Proper fix will be fixing navigation flow and have single source of truth for simple tasks like highlighting drawer menu item. That fix will consume much more time, and I can't decide to implement that fix by myself. Because of the priorities, time etc.

If you have the proper fix with much less code change, please open PR.

Current codebase behaviors:

Currently, some menu items, such as “Settings,” in the drawer menu don’t extend from DrawerActivity, which is causing navigation issues (different action bar, different back button behavior when it compared to other activities).

There are multiple methods being used to highlight the drawer menu, leading to some inconsistencies.

Two menu item variable was responsible for holding menu item value.

setDrawerMenuItemChecked() gets called multiple times from different files and some value of it overriding correct value and applying wrong one.

Signed-off-by: alperozturk <[email protected]>
Signed-off-by: alperozturk <[email protected]>
Signed-off-by: alperozturk <[email protected]>
Signed-off-by: alperozturk <[email protected]>
Signed-off-by: alperozturk <[email protected]>
Signed-off-by: alperozturk <[email protected]>
Signed-off-by: alperozturk <[email protected]>
Signed-off-by: alperozturk <[email protected]>
Signed-off-by: alperozturk <[email protected]>
Signed-off-by: alperozturk <[email protected]>
Signed-off-by: alperozturk <[email protected]>
@alperozturk96 alperozturk96 force-pushed the bugfix/unify-drawer-menu-item-handling branch from bc5cc29 to 5f03cae Compare September 11, 2024 10:38
Copy link

Codacy

Lint

TypemasterPR
Warnings5959
Errors33

SpotBugs

CategoryBaseNew
Bad practice6364
Correctness6463
Dodgy code299297
Experimental11
Internationalization77
Malicious code vulnerability01
Multithreaded correctness66
Performance5353
Security1818
Total511510

Copy link

APK file: https://www.kaminsky.me/nc-dev/android-artifacts/13513.apk

qrcode

To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud app.

Copy link
Collaborator

@ZetaTom ZetaTom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change fixes the issue and works fine on my end.

But we should keep in mind that this is just a workaround. We will need to implement a proper at some point in the future, as @alperozturk96 mentioned.

@alperozturk96 alperozturk96 merged commit af3b19d into master Sep 12, 2024
21 checks passed
@alperozturk96 alperozturk96 deleted the bugfix/unify-drawer-menu-item-handling branch September 12, 2024 07:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants