Merge pull request #1180 from luqmanfadlli/fix-ios-animated-avatar

feat: Support animated GIF avatars on iOS
This commit is contained in:
Nayif 2026-06-01 21:35:10 +05:30 committed by GitHub
commit 61ab0e7e3d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 21 additions and 12 deletions

View file

@ -54,6 +54,7 @@ import com.nuvio.app.core.ui.NuvioScreen
import com.nuvio.app.core.ui.NuvioScreenHeader
import com.nuvio.app.core.ui.NuvioStatusModal
import com.nuvio.app.core.ui.NuvioSurfaceCard
import com.nuvio.app.features.home.components.CollectionCardRemoteImage
import kotlinx.coroutines.launch
import nuvio.composeapp.generated.resources.*
import org.jetbrains.compose.resources.stringResource
@ -408,11 +409,12 @@ private fun ProfileIdentityCard(
contentAlignment = Alignment.Center,
) {
if (customAvatarUrl != null) {
AsyncImage(
model = customAvatarUrl,
CollectionCardRemoteImage(
imageUrl = customAvatarUrl,
contentDescription = name,
modifier = Modifier.size(88.dp).clip(CircleShape),
modifier = Modifier.fillMaxSize(),
contentScale = ContentScale.Crop,
animateIfPossible = true,
)
} else if (selectedAvatar != null) {
AsyncImage(

View file

@ -59,6 +59,7 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle
import coil3.compose.AsyncImage
import com.nuvio.app.core.auth.AuthRepository
import com.nuvio.app.core.auth.AuthState
import com.nuvio.app.features.home.components.CollectionCardRemoteImage
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import nuvio.composeapp.generated.resources.*
@ -373,11 +374,12 @@ private fun ProfileAvatarCard(
contentAlignment = Alignment.Center,
) {
if (avatarImageUrl != null) {
AsyncImage(
model = avatarImageUrl,
CollectionCardRemoteImage(
imageUrl = avatarImageUrl,
contentDescription = avatarItem?.displayName ?: profile.name,
modifier = Modifier.size(100.dp).clip(CircleShape),
modifier = Modifier.fillMaxSize(),
contentScale = ContentScale.Crop,
animateIfPossible = true,
)
} else if (profile.name.isNotBlank()) {
Text(

View file

@ -21,6 +21,7 @@ import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.imePadding
@ -69,6 +70,7 @@ import androidx.compose.ui.window.Popup
import androidx.compose.ui.window.PopupProperties
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import coil3.compose.AsyncImage
import com.nuvio.app.features.home.components.CollectionCardRemoteImage
import com.nuvio.app.isIos
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
@ -504,11 +506,12 @@ private fun PopupProfileBubble(
contentAlignment = Alignment.Center,
) {
if (avatarImageUrl != null) {
AsyncImage(
model = avatarImageUrl,
CollectionCardRemoteImage(
imageUrl = avatarImageUrl,
contentDescription = profile.name,
modifier = Modifier.size(48.dp).clip(CircleShape),
modifier = Modifier.fillMaxSize(),
contentScale = ContentScale.Crop,
animateIfPossible = true,
)
} else if (profile.name.isNotBlank()) {
Text(
@ -818,11 +821,12 @@ fun ActiveProfileMiniAvatar(
contentAlignment = Alignment.Center,
) {
if (avatarImageUrl != null) {
AsyncImage(
model = avatarImageUrl,
CollectionCardRemoteImage(
imageUrl = avatarImageUrl,
contentDescription = profile.name,
modifier = Modifier.size(size.dp).clip(CircleShape),
modifier = Modifier.fillMaxSize(),
contentScale = ContentScale.Crop,
animateIfPossible = true,
)
} else if (profile.name.isNotBlank()) {
Text(

View file

@ -96,6 +96,7 @@ internal actual fun CollectionCardRemoteImage(
UIKitView(
modifier = modifier,
interactive = false,
factory = {
UIImageView().apply {
contentMode = UIViewContentMode.UIViewContentModeScaleAspectFill