nextcloud / nextcloud/notes-android

Adding a note to the favorite list does not work in grid view

Open
#2,529 5 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

0. Needs triage bug
Dominant language
Java
Stars
1.1k
Forks
168
Avg merge
1d 17h
Merged PRs (30d)
31

Description

This issue respects the following points:
Describe the bug

Clicking on the favorite icon of a note in grid mode neither adds nor removes a note from the favorite list. I checked this via the file view on the Nextcloud server / app.

I debugged the issue in the code and nailed it down to the following line:
https://github.com/nextcloud/notes-android/blob/8e225c79ff0f586260b62aa07dff1d2865d95b96/app/src/main/java/it/niedermann/owncloud/notes/main/MainActivity.java#L782

If this line is called, the method toggleFavoriteAndSync in class NotesRepository is called again which leads at the end to a neutral operation.
https://github.com/nextcloud/notes-android/blob/8e225c79ff0f586260b62aa07dff1d2865d95b96/app/src/main/java/it/niedermann/owncloud/notes/persistence/NotesRepository.java#L524

I tried to understand the reason why adding an observer leads to such a behavior but I did not succeed. Maybe there is somebody who can explain it to me. However, I also do not understand why this line is necessary at all because there is no place in the code where an observer is added to the live data. Hence, it is not necessary to remove one. If I remove the line, the app behaves as expected.

Expected behavior

No response

Notes Android version

4.3.1

Notes server version

4.11.0

Nextcloud Android version

3.30.6

Nextcloud version

30.0.4

Device

Google Pixel 4a

Android Version

13

App Store
  • Google Play Store
  • F-Droid
  • Huawei App Gallery
Stacktrace

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in app/src/main/java/it/niedermann/owncloud/notes/main/MainActivity.java at line 782 and trace the call into NotesRepository.java around line 524. Check how the observer and toggleFavoriteAndSync interact in grid view, then verify that tapping the favorite icon changes the server-side favorite state instead of performing a neutral operation.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
mobile
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.