From 7a495f064bbe847813861a36f5e3f6e56efd4c68 Mon Sep 17 00:00:00 2001 From: MajorTanya Date: Sat, 23 Mar 2024 14:48:36 +0100 Subject: [PATCH 1/2] Fix repo name used for URL instead of baseUrl This applies to both the item being shown in the screen as well as the "copy to clipboard" button. Before, copying a repo url would return "The Repo Name/index.json.min". This PR fixes that. --- .../settings/screen/browse/components/ExtensionReposContent.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/browse/components/ExtensionReposContent.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/browse/components/ExtensionReposContent.kt index 83be8846da..8a0821dca6 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/browse/components/ExtensionReposContent.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/browse/components/ExtensionReposContent.kt @@ -47,7 +47,7 @@ fun ExtensionReposContent( item { ExtensionRepoListItem( modifier = Modifier.animateItemPlacement(), - repo = it.name, + repo = it.baseUrl, onOpenWebsite = { onOpenWebsite(it) }, onDelete = { onClickDelete(it.baseUrl) }, ) From 4e35a06d8f2afbea94ac748a80cecc463dcf0dbd Mon Sep 17 00:00:00 2001 From: MajorTanya Date: Sat, 23 Mar 2024 14:56:41 +0100 Subject: [PATCH 2/2] Correct Misunderstanding Passing the whole ExtensionRepo data class through now, using the name for display purposes and the baseUrl for copying the URL. --- .../screen/browse/components/ExtensionReposContent.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/browse/components/ExtensionReposContent.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/browse/components/ExtensionReposContent.kt index 8a0821dca6..20a924d112 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/browse/components/ExtensionReposContent.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/browse/components/ExtensionReposContent.kt @@ -47,7 +47,7 @@ fun ExtensionReposContent( item { ExtensionRepoListItem( modifier = Modifier.animateItemPlacement(), - repo = it.baseUrl, + repo = it, onOpenWebsite = { onOpenWebsite(it) }, onDelete = { onClickDelete(it.baseUrl) }, ) @@ -58,7 +58,7 @@ fun ExtensionReposContent( @Composable private fun ExtensionRepoListItem( - repo: String, + repo: ExtensionRepo, onOpenWebsite: () -> Unit, onDelete: () -> Unit, modifier: Modifier = Modifier, @@ -80,7 +80,7 @@ private fun ExtensionRepoListItem( ) { Icon(imageVector = Icons.AutoMirrored.Outlined.Label, contentDescription = null) Text( - text = repo, + text = repo.name, modifier = Modifier.padding(start = MaterialTheme.padding.medium), style = MaterialTheme.typography.titleMedium, ) @@ -99,7 +99,7 @@ private fun ExtensionRepoListItem( IconButton( onClick = { - val url = "$repo/index.min.json" + val url = "${repo.baseUrl}/index.min.json" context.copyToClipboard(url, url) }, ) {