Skip to content

Commit

Permalink
Fix repo name used for URL instead of baseUrl (#572)
Browse files Browse the repository at this point in the history
* 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.

* Correct Misunderstanding

Passing the whole ExtensionRepo data class through now, using the name
for display purposes and the baseUrl for copying the URL.
  • Loading branch information
MajorTanya authored Mar 23, 2024
1 parent 8c437ce commit da20d00
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ fun ExtensionReposContent(
item {
ExtensionRepoListItem(
modifier = Modifier.animateItemPlacement(),
repo = it.name,
repo = it,
onOpenWebsite = { onOpenWebsite(it) },
onDelete = { onClickDelete(it.baseUrl) },
)
Expand All @@ -58,7 +58,7 @@ fun ExtensionReposContent(

@Composable
private fun ExtensionRepoListItem(
repo: String,
repo: ExtensionRepo,
onOpenWebsite: () -> Unit,
onDelete: () -> Unit,
modifier: Modifier = Modifier,
Expand All @@ -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,
)
Expand All @@ -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)
},
) {
Expand Down

0 comments on commit da20d00

Please sign in to comment.