feat(notifications): remove partner avatar from notifications (privacy)
This commit is contained in:
parent
f47fa3cdbd
commit
7ff405cad6
|
|
@ -78,21 +78,10 @@ class PartnerNotificationManager @Inject constructor(
|
||||||
|
|
||||||
val route = type.routeFor(payload, coupleId)
|
val route = type.routeFor(payload, coupleId)
|
||||||
val notificationId = collapseId(type, coupleId)
|
val notificationId = collapseId(type, coupleId)
|
||||||
val avatar = payload.avatarUrl?.takeIf { it.isNotBlank() }?.let { loadAvatar(it) }
|
|
||||||
|
|
||||||
showNotification(notificationId, type, route, avatar)
|
showNotification(notificationId, type, route)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Best-effort partner-avatar load for a richer notification; null on any failure. */
|
|
||||||
private suspend fun loadAvatar(url: String): android.graphics.Bitmap? = runCatching {
|
|
||||||
val loader = coil.ImageLoader(context)
|
|
||||||
val request = coil.request.ImageRequest.Builder(context)
|
|
||||||
.data(url)
|
|
||||||
.allowHardware(false)
|
|
||||||
.build()
|
|
||||||
(loader.execute(request).drawable as? android.graphics.drawable.BitmapDrawable)?.bitmap
|
|
||||||
}.getOrNull()
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Maps a remote FCM message type to a [PartnerNotificationType] and shows it.
|
* Maps a remote FCM message type to a [PartnerNotificationType] and shows it.
|
||||||
*
|
*
|
||||||
|
|
@ -125,8 +114,7 @@ class PartnerNotificationManager @Inject constructor(
|
||||||
private fun showNotification(
|
private fun showNotification(
|
||||||
id: Int,
|
id: Int,
|
||||||
type: PartnerNotificationType,
|
type: PartnerNotificationType,
|
||||||
route: String,
|
route: String
|
||||||
largeIcon: android.graphics.Bitmap? = null
|
|
||||||
) {
|
) {
|
||||||
if (!NotificationManagerCompat.from(context).areNotificationsEnabled()) return
|
if (!NotificationManagerCompat.from(context).areNotificationsEnabled()) return
|
||||||
|
|
||||||
|
|
@ -147,6 +135,8 @@ class PartnerNotificationManager @Inject constructor(
|
||||||
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
|
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// No large icon: notifications show only the monochrome Closer mark (the small icon). We
|
||||||
|
// deliberately do NOT surface the partner's photo here.
|
||||||
val notification = NotificationCompat.Builder(context, type.channelId)
|
val notification = NotificationCompat.Builder(context, type.channelId)
|
||||||
.setSmallIcon(R.drawable.ic_notification_closer)
|
.setSmallIcon(R.drawable.ic_notification_closer)
|
||||||
.setContentTitle(type.title)
|
.setContentTitle(type.title)
|
||||||
|
|
@ -154,7 +144,6 @@ class PartnerNotificationManager @Inject constructor(
|
||||||
.setAutoCancel(true)
|
.setAutoCancel(true)
|
||||||
.setContentIntent(pendingIntent)
|
.setContentIntent(pendingIntent)
|
||||||
.setCategory(NotificationCompat.CATEGORY_SOCIAL)
|
.setCategory(NotificationCompat.CATEGORY_SOCIAL)
|
||||||
.apply { if (largeIcon != null) setLargeIcon(largeIcon) }
|
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
NotificationManagerCompat.from(context).notify(id, notification)
|
NotificationManagerCompat.from(context).notify(id, notification)
|
||||||
|
|
@ -437,7 +426,10 @@ data class PartnerNotificationPayload(
|
||||||
val challengeId: String? = null,
|
val challengeId: String? = null,
|
||||||
/** Completed-date id, used to deep link a date-reflection push into the reflection screen. */
|
/** Completed-date id, used to deep link a date-reflection push into the reflection screen. */
|
||||||
val dateId: String? = null,
|
val dateId: String? = null,
|
||||||
/** Sender's avatar URL, used as the notification large icon when present. */
|
/**
|
||||||
|
* Sender's avatar URL. Still carried by callers, but intentionally NOT rendered on notifications —
|
||||||
|
* we show only the Closer app mark, never the partner's photo. Kept for in-app surfaces / future use.
|
||||||
|
*/
|
||||||
val avatarUrl: String? = null
|
val avatarUrl: String? = null
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue