Skip to content

Commit

Permalink
Support nullable avatars in DriveUser
Browse files Browse the repository at this point in the history
  • Loading branch information
LunarX committed Feb 28, 2024
1 parent 6360ec2 commit 2a84287
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ open class DriveUser(
var avatarUrl: String? = "",
@SerializedName("display_name")
var displayName: String = "",
var avatar: String = "",
private var avatar: String? = "",
var email: String = "",
@SerializedName("role")
private var _role: String = "",
Expand All @@ -50,7 +50,7 @@ open class DriveUser(
displayName = user.displayName ?: ""
}

fun getUserAvatar() = avatar.ifBlank { avatarUrl.toString() }
fun getUserAvatar() = avatar?.ifBlank { avatarUrl.toString() } ?: avatarUrl.toString()

fun getInitials(): String {
displayName.split(" ").let { initials ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ class FileShareAddUserDialog : FullScreenBottomSheetDialog() {
background = getBackgroundColorBasedOnId(item.id)
)
val request = ImageRequest.Builder(this)
.data(item.avatar)
.data(item.getUserAvatar())
.transformations(CircleCropTransformation())
.fallback(fallback)
.error(fallback)
Expand Down

0 comments on commit 2a84287

Please sign in to comment.