[FIX] Check if avatar exists before create Icon (#1927)
Co-authored-by: Diego Mello <diegolmello@gmail.com>
This commit is contained in:
parent
80c3c8ee4f
commit
77256eb3c0
|
@ -237,12 +237,19 @@ public class CustomPushNotification extends PushNotification {
|
||||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P) {
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P) {
|
||||||
messageStyle.addMessage(m, timestamp, username);
|
messageStyle.addMessage(m, timestamp, username);
|
||||||
} else {
|
} else {
|
||||||
Person sender = new Person.Builder()
|
Bitmap avatar = getAvatar(avatarUri);
|
||||||
|
|
||||||
|
Person.Builder sender = new Person.Builder()
|
||||||
.setKey(senderId)
|
.setKey(senderId)
|
||||||
.setName(username)
|
.setName(username);
|
||||||
.setIcon(Icon.createWithBitmap(getAvatar(avatarUri)))
|
|
||||||
.build();
|
if (avatar != null) {
|
||||||
messageStyle.addMessage(m, timestamp, sender);
|
sender.setIcon(Icon.createWithBitmap(avatar));
|
||||||
|
}
|
||||||
|
|
||||||
|
Person person = sender.build();
|
||||||
|
|
||||||
|
messageStyle.addMessage(m, timestamp, person);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue