mirror of
https://github.com/element-hq/element-android
synced 2024-11-28 13:38:49 +03:00
Fix crash (from Steve's rageshake)
This commit is contained in:
parent
42584fc55a
commit
6bbc784c29
1 changed files with 3 additions and 2 deletions
|
@ -182,7 +182,8 @@ class NotificationDrawerManager @Inject constructor(private val context: Context
|
|||
val session = activeSessionHolder.getSafeActiveSession() ?: return
|
||||
|
||||
val user = session.getUser(session.sessionParams.credentials.userId)
|
||||
val myUserDisplayName = user?.displayName ?: session.sessionParams.credentials.userId
|
||||
// myUserDisplayName cannot be empty else NotificationCompat.MessagingStyle() will crash
|
||||
val myUserDisplayName = user?.displayName?.takeIf { it.isNotBlank() } ?: session.sessionParams.credentials.userId
|
||||
val myUserAvatarUrl = session.contentUrlResolver().resolveThumbnail(user?.avatarUrl, avatarSize, avatarSize, ContentUrlResolver.ThumbnailMethod.SCALE)
|
||||
synchronized(eventList) {
|
||||
|
||||
|
@ -343,7 +344,7 @@ class NotificationDrawerManager @Inject constructor(private val context: Context
|
|||
for (event in simpleEvents) {
|
||||
//We build a simple event
|
||||
if (firstTime || !event.hasBeenDisplayed) {
|
||||
NotificationUtils.buildSimpleEventNotification(context, event, null, myUserDisplayName)?.let {
|
||||
NotificationUtils.buildSimpleEventNotification(context, event, null, session.myUserId)?.let {
|
||||
notifications.add(it)
|
||||
NotificationUtils.showNotificationMessage(context, event.eventId, ROOM_EVENT_NOTIFICATION_ID, it)
|
||||
event.hasBeenDisplayed = true //we can consider it as displayed
|
||||
|
|
Loading…
Reference in a new issue