Update: Show repository host instead of developer name on repository card

This commit is contained in:
machiav3lli 2022-07-06 02:21:29 +02:00
parent 6f7195047d
commit ce1cfeb79a
2 changed files with 10 additions and 5 deletions

View File

@ -42,7 +42,7 @@ fun AppInfoHeader(
modifier: Modifier = Modifier,
versionCode: String,
appSize: String,
appDev: String,
repoHost: String,
mainAction: ActionState?,
possibleActions: Set<ActionState>,
onSource: () -> Unit = { },
@ -64,7 +64,7 @@ fun AppInfoHeader(
HeaderExtra(
versionCode = versionCode,
appSize = appSize,
appDev = appDev,
repoHost = repoHost,
onSource = onSource,
onSourceLong = onSourceLong
)
@ -158,7 +158,7 @@ fun HeaderExtra(
modifier: Modifier = Modifier,
versionCode: String,
appSize: String,
appDev: String,
repoHost: String,
onSource: () -> Unit,
onSourceLong: () -> Unit
) {
@ -181,7 +181,7 @@ fun HeaderExtra(
HeaderExtrasCard(
modifier = Modifier.weight(1f),
title = stringResource(id = R.string.source_code),
text = appDev,
text = repoHost,
onClick = onSource,
onLongClick = onSourceLong
)

View File

@ -88,6 +88,8 @@ import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import java.net.URI
import java.util.*
// TODO clean up and replace dropped functions from AppDetailFragment
class AppSheetX() : FullscreenBottomSheetDialogFragment(), Callbacks {
@ -422,7 +424,10 @@ class AppSheetX() : FullscreenBottomSheetDialogFragment(), Callbacks {
AppInfoHeader(
versionCode = product.versionCode.toString(),
appSize = product.displayRelease?.size?.formatSize().orEmpty(),
appDev = product.author.name.replaceFirstChar { it.titlecase() },
repoHost = "@${
URI(product.source).host.removePrefix("www.")
.replaceFirstChar { if (it.isLowerCase()) it.titlecase(Locale.getDefault()) else it.toString() }
}",
mainAction = mainAction,
possibleActions = actions?.filter { it != mainAction }?.toSet()
?: emptySet(),