compose: details: Remove prefix from components
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
@@ -64,17 +64,17 @@ import com.aurora.store.compose.preview.coilPreviewProvider
|
||||
import com.aurora.store.compose.menu.AppDetailsMenu
|
||||
import com.aurora.store.compose.menu.items.AppDetailsMenuItem
|
||||
import com.aurora.store.compose.navigation.Screen
|
||||
import com.aurora.store.compose.ui.details.components.AppActions
|
||||
import com.aurora.store.compose.ui.details.components.AppChangelog
|
||||
import com.aurora.store.compose.ui.details.components.AppCompatibility
|
||||
import com.aurora.store.compose.ui.details.components.AppDataSafety
|
||||
import com.aurora.store.compose.ui.details.components.AppDetails
|
||||
import com.aurora.store.compose.ui.details.components.AppDeveloperDetails
|
||||
import com.aurora.store.compose.ui.details.components.AppPrivacy
|
||||
import com.aurora.store.compose.ui.details.components.AppRatingAndReviews
|
||||
import com.aurora.store.compose.ui.details.components.AppScreenshots
|
||||
import com.aurora.store.compose.ui.details.components.AppTags
|
||||
import com.aurora.store.compose.ui.details.components.AppTesting
|
||||
import com.aurora.store.compose.ui.details.components.Actions
|
||||
import com.aurora.store.compose.ui.details.components.Changelog
|
||||
import com.aurora.store.compose.ui.details.components.Compatibility
|
||||
import com.aurora.store.compose.ui.details.components.DataSafety
|
||||
import com.aurora.store.compose.ui.details.components.Details
|
||||
import com.aurora.store.compose.ui.details.components.DeveloperDetails
|
||||
import com.aurora.store.compose.ui.details.components.Privacy
|
||||
import com.aurora.store.compose.ui.details.components.RatingAndReviews
|
||||
import com.aurora.store.compose.ui.details.components.Screenshots
|
||||
import com.aurora.store.compose.ui.details.components.Tags
|
||||
import com.aurora.store.compose.ui.details.components.Testing
|
||||
import com.aurora.store.compose.ui.details.navigation.ExtraScreen
|
||||
import com.aurora.store.compose.ui.dev.DevProfileScreen
|
||||
import com.aurora.store.data.installer.AppInstaller
|
||||
@@ -257,10 +257,10 @@ private fun ScreenContentApp(
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun SetupAppActions() {
|
||||
fun SetupActions() {
|
||||
when (state) {
|
||||
is AppState.Downloading -> {
|
||||
AppActions(
|
||||
Actions(
|
||||
primaryActionDisplayName = stringResource(R.string.action_open),
|
||||
secondaryActionDisplayName = stringResource(R.string.action_cancel),
|
||||
isPrimaryActionEnabled = false,
|
||||
@@ -269,7 +269,7 @@ private fun ScreenContentApp(
|
||||
}
|
||||
|
||||
is AppState.Updatable -> {
|
||||
AppActions(
|
||||
Actions(
|
||||
primaryActionDisplayName = stringResource(R.string.action_update),
|
||||
secondaryActionDisplayName = stringResource(R.string.action_uninstall),
|
||||
onPrimaryAction = onDownload,
|
||||
@@ -278,7 +278,7 @@ private fun ScreenContentApp(
|
||||
}
|
||||
|
||||
is AppState.Installed -> {
|
||||
AppActions(
|
||||
Actions(
|
||||
primaryActionDisplayName = stringResource(R.string.action_open),
|
||||
secondaryActionDisplayName = stringResource(R.string.action_uninstall),
|
||||
onPrimaryAction = onOpen,
|
||||
@@ -293,7 +293,7 @@ private fun ScreenContentApp(
|
||||
if (app.isFree) stringResource(R.string.action_install) else app.price
|
||||
}
|
||||
|
||||
AppActions(
|
||||
Actions(
|
||||
primaryActionDisplayName = primaryActionName,
|
||||
secondaryActionDisplayName = stringResource(R.string.title_manual_download),
|
||||
onPrimaryAction = onDownload,
|
||||
@@ -321,7 +321,7 @@ private fun ScreenContentApp(
|
||||
.padding(dimensionResource(R.dimen.padding_medium)),
|
||||
verticalArrangement = Arrangement.spacedBy(dimensionResource(R.dimen.margin_medium))
|
||||
) {
|
||||
AppDetails(
|
||||
Details(
|
||||
app = app,
|
||||
inProgress = state.inProgress(),
|
||||
progress = state.progress(),
|
||||
@@ -331,38 +331,35 @@ private fun ScreenContentApp(
|
||||
timeRemaining = if (state is AppState.Downloading) state.timeRemaining else 0
|
||||
)
|
||||
|
||||
SetupAppActions()
|
||||
SetupActions()
|
||||
|
||||
AppTags(app = app)
|
||||
AppChangelog(changelog = app.changes)
|
||||
Tags(app = app)
|
||||
Changelog(changelog = app.changes)
|
||||
HeaderComposable(
|
||||
title = stringResource(R.string.details_more_about_app),
|
||||
subtitle = app.shortDescription,
|
||||
onClick = { showExtraPane(ExtraScreen.More) }
|
||||
)
|
||||
|
||||
AppScreenshots(
|
||||
Screenshots(
|
||||
screenshots = app.screenshots,
|
||||
onNavigateToScreenshot = { showExtraPane(ExtraScreen.Screenshot(it)) }
|
||||
)
|
||||
|
||||
AppRatingAndReviews(
|
||||
RatingAndReviews(
|
||||
rating = app.rating,
|
||||
featuredReviews = featuredReviews,
|
||||
onNavigateToDetailsReview = { showExtraPane(ExtraScreen.Review) }
|
||||
)
|
||||
|
||||
if (!isAnonymous && app.testingProgram?.isAvailable == true) {
|
||||
AppTesting(
|
||||
Testing(
|
||||
isSubscribed = app.testingProgram!!.isSubscribed,
|
||||
onTestingSubscriptionChange = onTestingSubscriptionChange
|
||||
)
|
||||
}
|
||||
|
||||
AppCompatibility(
|
||||
needsGms = app.requiresGMS(),
|
||||
plexusScores = plexusScores
|
||||
)
|
||||
Compatibility(needsGms = app.requiresGMS(), plexusScores = plexusScores)
|
||||
|
||||
HeaderComposable(
|
||||
title = stringResource(R.string.details_permission),
|
||||
@@ -379,13 +376,10 @@ private fun ScreenContentApp(
|
||||
)
|
||||
|
||||
if (dataSafetyReport != null) {
|
||||
AppDataSafety(
|
||||
report = dataSafetyReport,
|
||||
privacyPolicyUrl = app.privacyPolicyUrl
|
||||
)
|
||||
DataSafety(report = dataSafetyReport, privacyPolicyUrl = app.privacyPolicyUrl)
|
||||
}
|
||||
|
||||
AppPrivacy(
|
||||
Privacy(
|
||||
report = exodusReport,
|
||||
onNavigateToDetailsExodus = if (!exodusReport?.trackers.isNullOrEmpty()) {
|
||||
{ showExtraPane(ExtraScreen.Exodus) }
|
||||
@@ -394,7 +388,7 @@ private fun ScreenContentApp(
|
||||
}
|
||||
)
|
||||
|
||||
AppDeveloperDetails(
|
||||
DeveloperDetails(
|
||||
address = app.developerAddress,
|
||||
website = app.developerWebsite,
|
||||
email = app.developerEmail
|
||||
|
||||
@@ -36,7 +36,7 @@ import com.aurora.store.R
|
||||
* @param windowAdaptiveInfo Adaptive window information
|
||||
*/
|
||||
@Composable
|
||||
fun AppActions(
|
||||
fun Actions(
|
||||
primaryActionDisplayName: String,
|
||||
secondaryActionDisplayName: String,
|
||||
isPrimaryActionEnabled: Boolean = true,
|
||||
@@ -85,9 +85,9 @@ fun AppActions(
|
||||
|
||||
@Preview(showBackground = true)
|
||||
@Composable
|
||||
private fun AppActionsPreview() {
|
||||
private fun ActionsPreview() {
|
||||
Column(verticalArrangement = Arrangement.spacedBy(dimensionResource(R.dimen.margin_medium))) {
|
||||
AppActions(
|
||||
Actions(
|
||||
primaryActionDisplayName = stringResource(R.string.action_install),
|
||||
secondaryActionDisplayName = stringResource(R.string.title_manual_download)
|
||||
)
|
||||
@@ -34,7 +34,7 @@ import com.aurora.store.compose.preview.AppPreviewProvider
|
||||
* @param changelog Changelog to show
|
||||
*/
|
||||
@Composable
|
||||
fun AppChangelog(changelog: String) {
|
||||
fun Changelog(changelog: String) {
|
||||
HeaderComposable(title = stringResource(R.string.details_changelog))
|
||||
Box(
|
||||
modifier = Modifier
|
||||
@@ -56,8 +56,8 @@ fun AppChangelog(changelog: String) {
|
||||
|
||||
@Preview(showBackground = true)
|
||||
@Composable
|
||||
private fun AppChangelogPreview(@PreviewParameter(AppPreviewProvider::class) app: App) {
|
||||
private fun ChangelogPreview(@PreviewParameter(AppPreviewProvider::class) app: App) {
|
||||
Column(verticalArrangement = Arrangement.spacedBy(dimensionResource(R.dimen.margin_medium))) {
|
||||
AppChangelog(changelog = app.changes)
|
||||
Changelog(changelog = app.changes)
|
||||
}
|
||||
}
|
||||
@@ -24,7 +24,7 @@ import com.aurora.store.data.model.Scores
|
||||
* @param plexusScores Scores from the Plexus
|
||||
*/
|
||||
@Composable
|
||||
fun AppCompatibility(needsGms: Boolean, plexusScores: Scores? = null) {
|
||||
fun Compatibility(needsGms: Boolean, plexusScores: Scores? = null) {
|
||||
HeaderComposable(
|
||||
title = stringResource(R.string.details_compatibility_title),
|
||||
subtitle = stringResource(R.string.plexus_powered),
|
||||
@@ -72,8 +72,8 @@ fun AppCompatibility(needsGms: Boolean, plexusScores: Scores? = null) {
|
||||
|
||||
@Preview(showBackground = true)
|
||||
@Composable
|
||||
private fun AppCompatibilityPreview() {
|
||||
private fun CompatibilityPreview() {
|
||||
Column(verticalArrangement = Arrangement.spacedBy(dimensionResource(R.dimen.margin_medium))) {
|
||||
AppCompatibility(needsGms = true)
|
||||
Compatibility(needsGms = true)
|
||||
}
|
||||
}
|
||||
@@ -31,7 +31,7 @@ import com.aurora.store.compose.preview.AppPreviewProvider
|
||||
* @param privacyPolicyUrl App's privacy policy URL
|
||||
*/
|
||||
@Composable
|
||||
fun AppDataSafety(report: Report, privacyPolicyUrl: String) {
|
||||
fun DataSafety(report: Report, privacyPolicyUrl: String) {
|
||||
val context = LocalContext.current
|
||||
|
||||
HeaderComposable(
|
||||
@@ -80,9 +80,9 @@ fun AppDataSafety(report: Report, privacyPolicyUrl: String) {
|
||||
|
||||
@Preview(showBackground = true)
|
||||
@Composable
|
||||
private fun AppDataSafetyPreview(@PreviewParameter(AppPreviewProvider::class) app: App) {
|
||||
private fun DataSafetyPreview(@PreviewParameter(AppPreviewProvider::class) app: App) {
|
||||
Column(verticalArrangement = Arrangement.spacedBy(dimensionResource(R.dimen.margin_medium))) {
|
||||
AppDataSafety(
|
||||
DataSafety(
|
||||
privacyPolicyUrl = app.privacyPolicyUrl,
|
||||
report = Report(
|
||||
packageName = app.packageName,
|
||||
@@ -43,7 +43,7 @@ import com.aurora.store.util.PackageUtil
|
||||
* @param isUpdatable Whether the app has a valid update available
|
||||
*/
|
||||
@Composable
|
||||
fun AppDetails(
|
||||
fun Details(
|
||||
app: App,
|
||||
progress: Float = 0F,
|
||||
inProgress: Boolean = false,
|
||||
@@ -106,10 +106,10 @@ fun AppDetails(
|
||||
|
||||
@Preview(showBackground = true)
|
||||
@Composable
|
||||
private fun AppDetailsPreview(@PreviewParameter(AppPreviewProvider::class) app: App) {
|
||||
private fun DetailsPreview(@PreviewParameter(AppPreviewProvider::class) app: App) {
|
||||
Column(verticalArrangement = Arrangement.spacedBy(dimensionResource(R.dimen.margin_medium))) {
|
||||
CompositionLocalProvider(LocalAsyncImagePreviewHandler provides coilPreviewProvider) {
|
||||
AppDetails(app = app)
|
||||
Details(app = app)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,7 +32,7 @@ import com.aurora.store.compose.preview.AppPreviewProvider
|
||||
* @param email Email address of the app developer
|
||||
*/
|
||||
@Composable
|
||||
fun AppDeveloperDetails(address: String, website: String, email: String) {
|
||||
fun DeveloperDetails(address: String, website: String, email: String) {
|
||||
val context = LocalContext.current
|
||||
|
||||
HeaderComposable(title = stringResource(R.string.details_dev_details))
|
||||
@@ -68,9 +68,9 @@ fun AppDeveloperDetails(address: String, website: String, email: String) {
|
||||
|
||||
@Preview(showBackground = true)
|
||||
@Composable
|
||||
private fun AppDeveloperDetailsPreview(@PreviewParameter(AppPreviewProvider::class) app: App) {
|
||||
private fun DeveloperDetailsPreview(@PreviewParameter(AppPreviewProvider::class) app: App) {
|
||||
Column(verticalArrangement = Arrangement.spacedBy(dimensionResource(R.dimen.margin_medium))) {
|
||||
AppDeveloperDetails(
|
||||
DeveloperDetails(
|
||||
address = app.developerAddress,
|
||||
website = app.developerWebsite,
|
||||
email = app.developerEmail
|
||||
@@ -24,7 +24,7 @@ import com.aurora.store.data.model.Report
|
||||
* @param onNavigateToDetailsExodus Callback when the user navigates
|
||||
*/
|
||||
@Composable
|
||||
fun AppPrivacy(report: Report?, onNavigateToDetailsExodus: (() -> Unit)? = null) {
|
||||
fun Privacy(report: Report?, onNavigateToDetailsExodus: (() -> Unit)? = null) {
|
||||
HeaderComposable(
|
||||
title = stringResource(R.string.details_privacy),
|
||||
subtitle = stringResource(R.string.exodus_powered),
|
||||
@@ -50,8 +50,8 @@ fun AppPrivacy(report: Report?, onNavigateToDetailsExodus: (() -> Unit)? = null)
|
||||
|
||||
@Preview(showBackground = true)
|
||||
@Composable
|
||||
private fun AppPrivacyPreview() {
|
||||
private fun PrivacyPreview() {
|
||||
Column(verticalArrangement = Arrangement.spacedBy(dimensionResource(R.dimen.margin_medium))) {
|
||||
AppPrivacy(report = Report(), onNavigateToDetailsExodus = {})
|
||||
Privacy(report = Report(), onNavigateToDetailsExodus = {})
|
||||
}
|
||||
}
|
||||
@@ -51,7 +51,7 @@ import java.util.Locale
|
||||
* @param windowAdaptiveInfo Adaptive window information
|
||||
*/
|
||||
@Composable
|
||||
fun AppRatingAndReviews(
|
||||
fun RatingAndReviews(
|
||||
rating: Rating,
|
||||
featuredReviews: List<Review> = emptyList(),
|
||||
onNavigateToDetailsReview: () -> Unit = {},
|
||||
@@ -141,8 +141,8 @@ fun AppRatingAndReviews(
|
||||
|
||||
@Preview(showBackground = true)
|
||||
@Composable
|
||||
private fun AppReviewsPreview(@PreviewParameter(AppPreviewProvider::class) app: App) {
|
||||
private fun RatingAndReviewsPreview(@PreviewParameter(AppPreviewProvider::class) app: App) {
|
||||
Column(verticalArrangement = Arrangement.spacedBy(dimensionResource(R.dimen.margin_medium))) {
|
||||
AppRatingAndReviews(rating = app.rating)
|
||||
RatingAndReviews(rating = app.rating)
|
||||
}
|
||||
}
|
||||
@@ -34,7 +34,7 @@ import com.aurora.store.compose.preview.coilPreviewProvider
|
||||
* @param onNavigateToScreenshot Callback when a screenshot is clicked
|
||||
*/
|
||||
@Composable
|
||||
fun AppScreenshots(screenshots: List<Artwork>, onNavigateToScreenshot: (index: Int) -> Unit = {}) {
|
||||
fun Screenshots(screenshots: List<Artwork>, onNavigateToScreenshot: (index: Int) -> Unit = {}) {
|
||||
LazyRow(horizontalArrangement = Arrangement.spacedBy(dimensionResource(R.dimen.margin_small))) {
|
||||
items(items = screenshots, key = { artwork -> artwork.url }) { artwork ->
|
||||
ScreenshotComposable(
|
||||
@@ -50,10 +50,10 @@ fun AppScreenshots(screenshots: List<Artwork>, onNavigateToScreenshot: (index: I
|
||||
|
||||
@Preview(showBackground = true)
|
||||
@Composable
|
||||
private fun AppScreenshotsPreview(@PreviewParameter(AppPreviewProvider::class) app: App) {
|
||||
private fun ScreenshotsPreview(@PreviewParameter(AppPreviewProvider::class) app: App) {
|
||||
Column(verticalArrangement = Arrangement.spacedBy(dimensionResource(R.dimen.margin_medium))) {
|
||||
CompositionLocalProvider(LocalAsyncImagePreviewHandler provides coilPreviewProvider) {
|
||||
AppScreenshots(screenshots = app.screenshots)
|
||||
Screenshots(screenshots = app.screenshots)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -28,7 +28,7 @@ import com.aurora.store.util.CommonUtil
|
||||
* @param app App to show tags
|
||||
*/
|
||||
@Composable
|
||||
fun AppTags(app: App) {
|
||||
fun Tags(app: App) {
|
||||
val context = LocalContext.current
|
||||
|
||||
val installsLabel = CommonUtil.addDiPrefix(app.installs)
|
||||
@@ -68,8 +68,8 @@ fun AppTags(app: App) {
|
||||
|
||||
@Preview(showBackground = true)
|
||||
@Composable
|
||||
private fun AppTagsPreview(@PreviewParameter(AppPreviewProvider::class) app: App) {
|
||||
private fun TagsPreview(@PreviewParameter(AppPreviewProvider::class) app: App) {
|
||||
Column(verticalArrangement = Arrangement.spacedBy(dimensionResource(R.dimen.margin_medium))) {
|
||||
AppTags(app = app)
|
||||
Tags(app = app)
|
||||
}
|
||||
}
|
||||
@@ -34,10 +34,7 @@ import com.aurora.store.compose.preview.AppPreviewProvider
|
||||
* @param onTestingSubscriptionChange Callback when the the subscription button is clicked
|
||||
*/
|
||||
@Composable
|
||||
fun AppTesting(
|
||||
isSubscribed: Boolean,
|
||||
onTestingSubscriptionChange: (subscribe: Boolean) -> Unit = {}
|
||||
) {
|
||||
fun Testing(isSubscribed: Boolean, onTestingSubscriptionChange: (subscribe: Boolean) -> Unit = {}) {
|
||||
HeaderComposable(title = stringResource(R.string.details_beta))
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
@@ -72,8 +69,8 @@ fun AppTesting(
|
||||
|
||||
@Preview(showBackground = true)
|
||||
@Composable
|
||||
private fun AppTestingPreview(@PreviewParameter(AppPreviewProvider::class) app: App) {
|
||||
private fun TestingPreview(@PreviewParameter(AppPreviewProvider::class) app: App) {
|
||||
Column(verticalArrangement = Arrangement.spacedBy(dimensionResource(R.dimen.margin_medium))) {
|
||||
AppTesting(isSubscribed = app.testingProgram!!.isSubscribed)
|
||||
Testing(isSubscribed = app.testingProgram!!.isSubscribed)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user