New message is marked as read by a conversation screen left in the background
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 84/100
Research direction
Read app/src/main/kotlin/org/fossify/messages/activities/ThreadActivity.kt, especially setupThreadItems() at the linked lines and the existing onResume() call to markThreadMessagesRead(threadId). Reproduce by leaving a conversation on the Home screen and receiving a message from that contact. Done when the message stays unread while the conversation screen is in the background and is marked read when the user returns.
Written by the indexing model from the issue text.
Description
Checklist
- I can reproduce the bug with the latest version given here.
- I made sure that there are no existing issues - open or closed - to which I could contribute my information.
- I made sure that there are no existing discussions - open or closed - to which I could contribute my information.
- I have read the FAQs inside the app (Menu -> About -> FAQs) and my problem isn't listed.
- I have taken the time to fill in all the required details. I understand that the bug report will be dismissed otherwise.
- This issue contains only one bug.
- I have read and understood the contribution guidelines.
Affected app version
1.10.1
Affected Android/Custom ROM version
Android 16 (One UI 8.5)
Affected device model
Samsung Galaxy A54 (SM-A546E), also reproduced on the Android Studio emulator (API 36)
How did you install the app?
No response
Steps to reproduce the bug
- Open a conversation with contact X.
- Press Home (do not press Back, so the conversation screen stays in memory).
- Receive an SMS from X.
- Open the app.
Expected behavior
The new message is unread: the conversation is shown as unread in the list until I open it.
Actual behavior
A notification is shown (and the launcher badge says 1), but the message is already marked as read in the SMS database (read=1). The conversation list shows nothing unread.
Screenshots/Screen recordings
No response
Additional information
Cause: SmsReceiver posts RefreshMessages. The ThreadActivity in the background receives it (ThreadMode.ASYNC), rebuilds its list in setupThreadItems() and marks every unread message as read, even though the screen is not visible:
https://github.com/FossifyOrg/Messages/blob/cf045ab5bdd36814be2b3d287cc294ce3f2b3fc7/app/src/main/kotlin/org/fossify/messages/activities/ThreadActivity.kt#L1371-L1375
Suggested fix: mark messages as read there only while the screen is visible. onResume() already calls markThreadMessagesRead(threadId), so nothing is lost when the user comes back.
@Volatile // read on background threads too
private var isActivityVisible = false
...
if (!message.read && isActivityVisible) {
hadUnreadItems = true
markMessageRead(message.id, message.isMMS)
conversationsDB.markRead(threadId)
}
Found and tested in a personal fork built from 1.10.1 (only unrelated features added). The code involved is unchanged on main (cf045ab). Fix in the fork, for reference: https://github.com/fatehiman/peppa-ai-messages/commit/44d2d3876
- Dominant language
- Kotlin
- Stars
- 1.6k
- Forks
- 187
- Avg merge
- 4d 5h
- Merged PRs (30d)
- 3
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from FossifyOrg/Messages
-
bug needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
FossifyOrg/Messages#929 · 1 comment ·
Maintainers usually reply within 1 day
-
The navigation bar is transparent and overlaps the message text.May be free again A pull request for this issue was closed without being merged. Openbug needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 63/100
FossifyOrg/Messages#919 · 2 comments ·
Maintainers usually reply within 1 day
-
bug needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
FossifyOrg/Messages#897 · 1 comment ·
Maintainers usually reply within 1 day
-
bug needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
FossifyOrg/Messages#761 ·
Maintainers usually reply within 1 day
-
[Export] mms "No entries for export have been found"May be free again A pull request for this issue was closed without being merged. Openbug help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 60/100
FossifyOrg/Messages#493 · 24 comments · 3 reactions ·
Maintainers usually reply within 1 day
All issues in FossifyOrg/Messages
Similar issues
-
bug 🐞
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
grote/Transportr#1029 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
TeamAmaze/AmazeFileManager#4800 ·
Maintainers usually reply within 1 day
-
bug needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
FossifyOrg/Gallery#1235 ·
Maintainers usually reply within 1 day
-
bug good first issue help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
getsotto/sotto-authenticator#139 ·
Maintainers usually reply within 1 day
-
enhancement module:webview p3
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
NucleusFramework/Nucleus#1004 ·
Maintainers usually reply within 1 day