forked from GitHub-Mirror/riotX-android
Fix crash (from Steve's rageshake)
This commit is contained in:
parent
42584fc55a
commit
6bbc784c29
@ -182,7 +182,8 @@ class NotificationDrawerManager @Inject constructor(private val context: Context
|
|||||||
val session = activeSessionHolder.getSafeActiveSession() ?: return
|
val session = activeSessionHolder.getSafeActiveSession() ?: return
|
||||||
|
|
||||||
val user = session.getUser(session.sessionParams.credentials.userId)
|
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)
|
val myUserAvatarUrl = session.contentUrlResolver().resolveThumbnail(user?.avatarUrl, avatarSize, avatarSize, ContentUrlResolver.ThumbnailMethod.SCALE)
|
||||||
synchronized(eventList) {
|
synchronized(eventList) {
|
||||||
|
|
||||||
@ -343,7 +344,7 @@ class NotificationDrawerManager @Inject constructor(private val context: Context
|
|||||||
for (event in simpleEvents) {
|
for (event in simpleEvents) {
|
||||||
//We build a simple event
|
//We build a simple event
|
||||||
if (firstTime || !event.hasBeenDisplayed) {
|
if (firstTime || !event.hasBeenDisplayed) {
|
||||||
NotificationUtils.buildSimpleEventNotification(context, event, null, myUserDisplayName)?.let {
|
NotificationUtils.buildSimpleEventNotification(context, event, null, session.myUserId)?.let {
|
||||||
notifications.add(it)
|
notifications.add(it)
|
||||||
NotificationUtils.showNotificationMessage(context, event.eventId, ROOM_EVENT_NOTIFICATION_ID, it)
|
NotificationUtils.showNotificationMessage(context, event.eventId, ROOM_EVENT_NOTIFICATION_ID, it)
|
||||||
event.hasBeenDisplayed = true //we can consider it as displayed
|
event.hasBeenDisplayed = true //we can consider it as displayed
|
||||||
|
Loading…
Reference in New Issue
Block a user