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

Skip some more notification data items if they are blank #5041

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1215,8 +1215,9 @@ class MessagingManager @Inject constructor(
builder: NotificationCompat.Builder,
data: Map<String, String>
) {
data[SUBJECT]?.let {
builder.setContentText(prepareText(it))
val subject = data[SUBJECT]
if (!subject.isNullOrBlank()) {
builder.setContentText(prepareText(subject))
}
}

Expand All @@ -1237,8 +1238,9 @@ class MessagingManager @Inject constructor(
builder: NotificationCompat.Builder,
data: Map<String, String>
) {
data[ICON_URL]?.let {
val dataIcon = it.trim().replace(" ", "%20")
val iconUrl = data[ICON_URL]
if (!iconUrl.isNullOrBlank()) {
val dataIcon = iconUrl.trim().replace(" ", "%20")
val serverId = data[THIS_SERVER_ID]!!.toInt()
val url = UrlUtil.handle(serverManager.getServer(serverId)?.connection?.getUrl(), dataIcon)
val bitmap = getImageBitmap(serverId, url, !UrlUtil.isAbsoluteUrl(dataIcon))
Expand All @@ -1252,8 +1254,9 @@ class MessagingManager @Inject constructor(
builder: NotificationCompat.Builder,
data: Map<String, String>
) {
data[IMAGE_URL]?.let {
val dataImage = it.trim().replace(" ", "%20")
val imageUrl = data[IMAGE_URL]
if (!imageUrl.isNullOrBlank()) {
val dataImage = imageUrl.trim().replace(" ", "%20")
val serverId = data[THIS_SERVER_ID]!!.toInt()
val url = UrlUtil.handle(serverManager.getServer(serverId)?.connection?.getUrl(), dataImage)
val bitmap = getImageBitmap(serverId, url, !UrlUtil.isAbsoluteUrl(dataImage))
Expand Down Expand Up @@ -1342,8 +1345,9 @@ class MessagingManager @Inject constructor(
builder: NotificationCompat.Builder,
data: Map<String, String>
) {
data[VIDEO_URL]?.let {
val dataVideo = it.trim().replace(" ", "%20")
val videoUrl = data[VIDEO_URL]
if (!videoUrl.isNullOrBlank()) {
val dataVideo = videoUrl.trim().replace(" ", "%20")
val serverId = data[THIS_SERVER_ID]!!.toInt()
val url = UrlUtil.handle(serverManager.getServer(serverId)?.connection?.getUrl(), dataVideo)
getVideoFrames(serverId, url, !UrlUtil.isAbsoluteUrl(dataVideo))?.let { frames ->
Expand Down Expand Up @@ -1459,9 +1463,10 @@ class MessagingManager @Inject constructor(
builder: NotificationCompat.Builder,
data: Map<String, String>
) {
data[VISIBILITY]?.let {
val visibility = data[VISIBILITY]
if (!visibility.isNullOrBlank()) {
builder.setVisibility(
when (it) {
when (visibility) {
"public" -> NotificationCompat.VISIBILITY_PUBLIC
"secret" -> NotificationCompat.VISIBILITY_SECRET
else -> NotificationCompat.VISIBILITY_PRIVATE
Expand Down