Skip to content

Commit 040fd34

Browse files
committed
don't set large icon for notification
Signed-off-by: sowjanyakch <[email protected]>
1 parent 03757d5 commit 040fd34

File tree

1 file changed

+1
-38
lines changed

1 file changed

+1
-38
lines changed

app/src/main/java/com/nextcloud/talk/jobs/NotificationWorker.kt

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import android.app.PendingIntent
1414
import android.content.Context
1515
import android.content.Intent
1616
import android.content.pm.PackageManager
17-
import android.graphics.Bitmap
1817
import android.os.Build
1918
import android.os.Bundle
2019
import android.os.Handler
@@ -30,8 +29,6 @@ import androidx.core.app.NotificationCompat
3029
import androidx.core.app.NotificationManagerCompat
3130
import androidx.core.app.Person
3231
import androidx.core.app.RemoteInput
33-
import androidx.core.content.ContextCompat
34-
import androidx.core.graphics.drawable.toBitmap
3532
import androidx.core.net.toUri
3633
import androidx.emoji2.text.EmojiCompat
3734
import androidx.work.Data
@@ -80,13 +77,13 @@ import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_MESSAGE_ID
8077
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_NOTIFICATION_ID
8178
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_NOTIFICATION_RESTRICT_DELETION
8279
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_NOTIFICATION_TIMESTAMP
80+
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_OPENED_VIA_NOTIFICATION
8381
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_REMOTE_TALK_SHARE
8482
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_ROOM_ONE_TO_ONE
8583
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_ROOM_TOKEN
8684
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_SHARE_RECORDING_TO_CHAT_URL
8785
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_SYSTEM_NOTIFICATION_ID
8886
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_THREAD_ID
89-
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_OPENED_VIA_NOTIFICATION
9087
import com.nextcloud.talk.utils.preferences.AppPreferences
9188
import io.reactivex.Observable
9289
import io.reactivex.Observer
@@ -549,7 +546,6 @@ class NotificationWorker(context: Context, workerParams: WorkerParameters) : Wor
549546
val notificationBuilder = NotificationCompat.Builder(context!!, "1")
550547
.setPriority(NotificationCompat.PRIORITY_HIGH)
551548
.setCategory(category)
552-
.setLargeIcon(getLargeIcon())
553549
.setSmallIcon(R.drawable.ic_notification)
554550
.setContentTitle(contentTitle)
555551
.setContentText(contentText)
@@ -591,39 +587,6 @@ class NotificationWorker(context: Context, workerParams: WorkerParameters) : Wor
591587
return notificationBuilder
592588
}
593589

594-
private fun getLargeIcon(): Bitmap {
595-
val largeIcon: Bitmap
596-
if (pushMessage.type == TYPE_RECORDING) {
597-
largeIcon = ContextCompat.getDrawable(context!!, R.drawable.ic_baseline_videocam_24)?.toBitmap()!!
598-
} else {
599-
when (conversationType) {
600-
"one2one" -> {
601-
pushMessage.subject = ""
602-
largeIcon =
603-
ContextCompat.getDrawable(context!!, R.drawable.ic_people_group_black_24px)?.toBitmap()!!
604-
}
605-
606-
"group" ->
607-
largeIcon =
608-
ContextCompat.getDrawable(context!!, R.drawable.ic_people_group_black_24px)?.toBitmap()!!
609-
610-
"public" ->
611-
largeIcon =
612-
ContextCompat.getDrawable(context!!, R.drawable.ic_link_black_24px)?.toBitmap()!!
613-
614-
else -> // assuming one2one
615-
largeIcon = if (TYPE_CHAT == pushMessage.type || TYPE_ROOM == pushMessage.type) {
616-
ContextCompat.getDrawable(context!!, R.drawable.ic_comment)?.toBitmap()!!
617-
} else if (TYPE_REMINDER == pushMessage.type) {
618-
ContextCompat.getDrawable(context!!, R.drawable.ic_timer_black_24dp)?.toBitmap()!!
619-
} else {
620-
ContextCompat.getDrawable(context!!, R.drawable.ic_call_black_24dp)?.toBitmap()!!
621-
}
622-
}
623-
}
624-
return largeIcon
625-
}
626-
627590
private fun calculateCRC32(s: String): Long {
628591
val crc32 = CRC32()
629592
crc32.update(s.toByteArray())

0 commit comments

Comments
 (0)