Skip to content

Commit 1610104

Browse files
committed
fix: Support GitLab avatar in deep link confirmation dialog
1 parent c9ee3ea commit 1610104

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

app/src/main/java/app/morphe/manager/ui/screen/home/HomeDialogs.kt

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1785,17 +1785,25 @@ fun DeepLinkAddSourceDialog(
17851785
horizontalAlignment = Alignment.CenterHorizontally,
17861786
modifier = Modifier.fillMaxWidth()
17871787
) {
1788-
val owner = remember(url) {
1789-
runCatching { URI(url).path.trim('/').split('/').firstOrNull() }.getOrNull()
1788+
val avatarUrl = remember(url) {
1789+
runCatching {
1790+
val uri = URI(url)
1791+
val owner = uri.path.trim('/').split('/').firstOrNull()
1792+
val isGitLab = uri.host?.contains("gitlab.com", ignoreCase = true) == true
1793+
if (owner != null) {
1794+
if (isGitLab) "https://unavatar.io/gitlab/$owner"
1795+
else "https://github.com/$owner.png"
1796+
} else null
1797+
}.getOrNull()
17901798
}
17911799
Surface(
17921800
shape = CircleShape,
17931801
color = MaterialTheme.colorScheme.primaryContainer,
17941802
modifier = Modifier.size(56.dp)
17951803
) {
1796-
if (owner != null) {
1804+
if (avatarUrl != null) {
17971805
RemoteAvatar(
1798-
url = "https://github.com/$owner.png",
1806+
url = avatarUrl,
17991807
modifier = Modifier.fillMaxSize()
18001808
)
18011809
} else {

0 commit comments

Comments
 (0)