Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

color profile circle "orange" if that friend has a push url #191

Merged
merged 1 commit into from
Mar 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ import java.io.ByteArrayInputStream
*/
@Composable
fun ProfileCircle(size: Dp, contactItem: ContactItem) {
// ProfileCircle(size)
ProfileCircle(size, contactItem.pubkey)
ProfileCircle2(size, contactItem)
}

/**
Expand All @@ -61,27 +60,35 @@ fun ProfileCircle(size: Dp, contactItem: ContactItem) {
* @param size the size of the circle.
*/
@Composable
fun ProfileCircle(size: Dp, pubkey: String) {
if (friend_has_avatar(pubkey))
fun ProfileCircle2(size: Dp, contactItem: ContactItem) {
var circle_border_width = 1.dp
var circle_border_color = Color.Black

if (!contactItem.push_url.isNullOrEmpty()) {
circle_border_width = 4.dp
circle_border_color = Color(0xFFFFC300)
}

if (friend_has_avatar(contactItem.pubkey))
{
val avatar_bytes = friend_get_avatar(pubkey)
val avatar_bytes = friend_get_avatar(contactItem.pubkey)
if (avatar_bytes != null)
{
HelperGeneric.AsyncImage(load = {
loadImageBitmap(ByteArrayInputStream(avatar_bytes))
}, painterFor = { remember { BitmapPainter(it) } },
contentDescription = "Image",
modifier = Modifier.size(size).clip(CircleShape)
.border(1.dp, Color.Black, CircleShape))
.border(circle_border_width, circle_border_color, CircleShape))
}
}
else
{
Canvas(
Modifier.size(size).clip(CircleShape)
.border(1.dp, Color.Black, CircleShape)
.border(circle_border_width, circle_border_color, CircleShape)
) {
IdenticonKt(pubkey, this.size.width, this.size.height).draw(this)
IdenticonKt(contactItem.pubkey, this.size.width, this.size.height).draw(this)
}
}
}
Expand All @@ -91,6 +98,7 @@ fun ProfileCircle(size: Dp, pubkey: String) {
*
* @param size the size of the circle.
*/
/*
@OptIn(ExperimentalResourceApi::class)
@Composable
fun ProfileCircle(size: Dp) {
Expand All @@ -102,3 +110,4 @@ fun ProfileCircle(size: Dp) {
contentDescription = "User picture"
)
}
*/
Loading