-
Notifications
You must be signed in to change notification settings - Fork 164
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
Add special notifications for mentions #1846
Merged
jmartinesp
merged 5 commits into
develop
from
feature/jme/special-notifications-for-mentions
Nov 28, 2023
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
eae77f9
Add special notifications for mentions
jmartinesp 788080c
Update screenshots
36ca1b7
Add extra tests
jmartinesp bc47cb6
Merge remote-tracking branch 'origin/develop' into feature/jme/specia…
jmartinesp 849ea05
Add test
jmartinesp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Display different notifications for mentions. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -82,6 +82,11 @@ class NotifiableEventResolver @Inject constructor( | |
return when (val content = this.content) { | ||
is NotificationContent.MessageLike.RoomMessage -> { | ||
val messageBody = descriptionFromMessageContent(content, senderDisplayName ?: content.senderId.value) | ||
val notificationBody = if (hasMention) { | ||
stringProvider.getString(R.string.notification_mentioned_you_body, messageBody) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe add a test in |
||
} else { | ||
messageBody | ||
} | ||
buildNotifiableMessageEvent( | ||
sessionId = userId, | ||
senderId = content.senderId, | ||
|
@@ -90,7 +95,7 @@ class NotifiableEventResolver @Inject constructor( | |
noisy = isNoisy, | ||
timestamp = this.timestamp, | ||
senderName = senderDisplayName, | ||
body = messageBody, | ||
body = notificationBody, | ||
imageUriString = this.contentUrl, | ||
roomName = roomDisplayName, | ||
roomIsDirect = isDirect, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The value of the string is:
so it seems like a parameter is missing here? The
messageBody
will be used for%1$s
and it should be the sender. Can you double check please?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you want to use
notification_mentioned_you_fallback_body
instead?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not anymore: https://github.com/vector-im/element-x-android/pull/1846/files#diff-ceb20f078550a897a919802d4b7635a8299f6ac1ef679aefba72e4c294954f2dR11.
notification_mentioned_you_fallback_body
was removed for this same reason. We decided to change what the message looked like since it was too verbose.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, it's fine now. I do not know what happened with all those string values, and it does not worth investigate more about it. Thanks!