diff --git a/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt b/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt index db664620..aa71e511 100644 --- a/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt +++ b/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt @@ -1806,7 +1806,6 @@ class BaresipService: Service() { val nb = NotificationCompat.Builder(this, channelId) val caller = Utils.friendlyUri(this, peerUri, ua.account) val callerContact = Contact.findContact(peerUri) - val personBuilder = Person.Builder().setName(caller) val contactColor = callerContact?.color() ?: "#B0B0B0" val initial = if (caller.isNotEmpty()) caller.take(1) else "?" val textAvatarBitmap = Utils.createTextAvatar(initial, contactColor) @@ -1815,8 +1814,9 @@ class BaresipService: Service() { if (callerContact is Contact.BaresipContact) { if (callerContact.avatarImage != null) icon = IconCompat.createWithBitmap(callerContact.avatarImage!!.toCircle()) - } else if (callerContact is Contact.AndroidContact) { - if (callerContact.thumbnailUri != null) { + } + else if (callerContact is Contact.AndroidContact) + if (callerContact.thumbnailUri != null) try { val source = ImageDecoder.createSource(contentResolver, callerContact.thumbnailUri!!) val bitmap = ImageDecoder.decodeBitmap(source) { decoder, _, _ -> @@ -1826,21 +1826,28 @@ class BaresipService: Service() { } catch (e: Exception) { Log.e(TAG, "Failed to load Android contact avatar: $e") } - } - } - val person = personBuilder.setIcon(icon).build() + val person = Person.Builder().setName(caller).setIcon(icon).build() + val diverterUri = call.diverterUri() + val contentText = if (diverterUri != "") + "${getString(R.string.is_calling)} " + + "(${getString(R.string.diverted_by)} " + + "${Utils.friendlyUri(this, diverterUri, ua.account)})" + else + getString(R.string.is_calling) + nb.setSmallIcon(R.drawable.ic_notification_call) .setColor(ContextCompat.getColor(this, R.color.colorPrimary)) .setContentIntent(pi) .setCategory(Notification.CATEGORY_CALL) .setAutoCancel(false) .setOngoing(true) - .setContentText(getString(R.string.is_calling)) + .setContentText(contentText) .setWhen(System.currentTimeMillis()) .setShowWhen(true) .setVisibility(NotificationCompat.VISIBILITY_PUBLIC) .setPriority(NotificationCompat.PRIORITY_MAX) + .addPerson(person) nb.setFullScreenIntent(pi, true) diff --git a/app/src/main/res/values-fi/strings.xml b/app/src/main/res/values-fi/strings.xml index 0fb455b2..a641d289 100644 --- a/app/src/main/res/values-fi/strings.xml +++ b/app/src/main/res/values-fi/strings.xml @@ -519,6 +519,7 @@ Puhelu ulos … Puhelu sisään … Siirtäjä … + siirtäjä Tilille \'%1$s\' ei ole konfiguroitu puhelinpalvelun tarjoajaa Videopuhelu diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 25d24f71..27a63295 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -503,6 +503,7 @@ Call to … Call from … Diverted by … + diverted by Account \'%1$s\' has no Telephony Provider Video call Video Request