ktlint: Format all compose code
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
@@ -7,4 +7,5 @@ root = true
|
||||
|
||||
[*.{kt,kts}]
|
||||
ktlint_code_style = android_studio
|
||||
ktlint_function_naming_ignore_when_annotated_with=Composable
|
||||
ktlint_function_naming_ignore_when_annotated_with = Composable
|
||||
ktlint_standard_class-signature = disabled
|
||||
|
||||
@@ -75,7 +75,7 @@ fun BlackListItem(
|
||||
modifier = Modifier.requiredSize(dimensionResource(R.dimen.icon_size_medium))
|
||||
)
|
||||
Column(
|
||||
modifier = Modifier.padding(horizontal = dimensionResource(R.dimen.margin_small)),
|
||||
modifier = Modifier.padding(horizontal = dimensionResource(R.dimen.margin_small))
|
||||
) {
|
||||
Text(
|
||||
text = displayName,
|
||||
|
||||
@@ -68,9 +68,9 @@ fun DispenserListItem(
|
||||
overflow = TextOverflow.Ellipsis
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(showBackground = true)
|
||||
@Composable
|
||||
private fun DispenserListItemPreview() {
|
||||
|
||||
@@ -138,7 +138,7 @@ fun DownloadListItem(
|
||||
)
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.padding(horizontal = dimensionResource(R.dimen.margin_small)),
|
||||
.padding(horizontal = dimensionResource(R.dimen.margin_small))
|
||||
) {
|
||||
Text(
|
||||
text = download.displayName,
|
||||
|
||||
@@ -102,7 +102,9 @@ fun FavouriteListItem(
|
||||
.clip(RoundedCornerShape(dimensionResource(R.dimen.radius_medium)))
|
||||
)
|
||||
Column(
|
||||
modifier = Modifier.padding(horizontal = dimensionResource(R.dimen.margin_small))
|
||||
modifier = Modifier.padding(
|
||||
horizontal = dimensionResource(R.dimen.margin_small)
|
||||
)
|
||||
) {
|
||||
Text(
|
||||
text = favourite.displayName,
|
||||
|
||||
@@ -62,7 +62,7 @@ fun Header(
|
||||
text = title,
|
||||
style = MaterialTheme.typography.titleMedium,
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
overflow = TextOverflow.Ellipsis
|
||||
)
|
||||
if (!subtitle.isNullOrBlank()) {
|
||||
Text(
|
||||
@@ -74,7 +74,7 @@ fun Header(
|
||||
if (onClick != null) {
|
||||
Icon(
|
||||
painter = painterResource(R.drawable.ic_arrow_right),
|
||||
contentDescription = null,
|
||||
contentDescription = null
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,6 @@ fun Logo(modifier: Modifier = Modifier) {
|
||||
overflow = TextOverflow.Ellipsis
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Preview(showBackground = true)
|
||||
|
||||
@@ -87,7 +87,7 @@ fun MicroG(
|
||||
) {
|
||||
Text(
|
||||
text = stringResource(R.string.onboarding_gms_microg),
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
style = MaterialTheme.typography.bodyMedium
|
||||
)
|
||||
|
||||
links.fastForEach { link ->
|
||||
@@ -132,10 +132,11 @@ fun MicroG(
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
) {
|
||||
Text(
|
||||
text = if (uiState.isDownloading)
|
||||
text = if (uiState.isDownloading) {
|
||||
stringResource(R.string.action_installing)
|
||||
else
|
||||
} else {
|
||||
stringResource(R.string.action_install_microG)
|
||||
}
|
||||
)
|
||||
}
|
||||
if (uiState.isDownloading) {
|
||||
|
||||
@@ -92,7 +92,7 @@ fun AnimatedAppIcon(
|
||||
}
|
||||
}
|
||||
|
||||
private class ProgressProvider: PreviewParameterProvider<Float> {
|
||||
private class ProgressProvider : PreviewParameterProvider<Float> {
|
||||
override val values: Sequence<Float>
|
||||
get() = sequenceOf(0F, 50F)
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ fun LargeAppListItem(modifier: Modifier = Modifier, app: App, onClick: () -> Uni
|
||||
.clip(RoundedCornerShape(dimensionResource(R.dimen.radius_medium)))
|
||||
)
|
||||
Column(
|
||||
modifier = Modifier.padding(horizontal = dimensionResource(R.dimen.margin_small)),
|
||||
modifier = Modifier.padding(horizontal = dimensionResource(R.dimen.margin_small))
|
||||
) {
|
||||
Text(
|
||||
text = app.displayName,
|
||||
@@ -90,8 +90,7 @@ fun LargeAppListItemPreview(@PreviewParameter(AppPreviewProvider::class) app: Ap
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun buildExtras(app: App): List<String> {
|
||||
return mutableListOf<String>().apply {
|
||||
private fun buildExtras(app: App): List<String> = mutableListOf<String>().apply {
|
||||
add(if (app.size > 0) CommonUtil.addSiPrefix(app.size) else app.downloadString)
|
||||
add("${app.labeledRating}★")
|
||||
|
||||
@@ -110,5 +109,4 @@ private fun buildExtras(app: App): List<String> {
|
||||
if (app.requiresGMS()) {
|
||||
add(stringResource(R.string.details_gsf_dependent))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ private fun ExodusListItemPreview() {
|
||||
ExodusListItem(
|
||||
tracker = ExodusTracker(
|
||||
name = "Google Analytics",
|
||||
signature = "com.google.android.apps.analytics.|com.google.android.gms.analytics.|com.google.analytics.",
|
||||
signature = "com.google.android.apps.analytics.|com.google.analytics.",
|
||||
date = "2017-09-24"
|
||||
)
|
||||
)
|
||||
|
||||
@@ -60,7 +60,7 @@ fun ReviewListItem(modifier: Modifier = Modifier, review: Review) {
|
||||
.clip(RoundedCornerShape(dimensionResource(R.dimen.radius_medium)))
|
||||
)
|
||||
Column(
|
||||
modifier = Modifier.padding(horizontal = dimensionResource(R.dimen.margin_small)),
|
||||
modifier = Modifier.padding(horizontal = dimensionResource(R.dimen.margin_small))
|
||||
) {
|
||||
Text(
|
||||
text = review.userName,
|
||||
|
||||
@@ -26,7 +26,7 @@ sealed class Screen : NavKey, Parcelable {
|
||||
data object Blacklist : Screen()
|
||||
|
||||
@Serializable
|
||||
data class DevProfile(val developerId: String): Screen()
|
||||
data class DevProfile(val developerId: String) : Screen()
|
||||
|
||||
@Serializable
|
||||
data class AppDetails(val packageName: String) : Screen()
|
||||
|
||||
@@ -49,7 +49,7 @@ class AppPreviewProvider : PreviewParameterProvider<App> {
|
||||
developerName = "Rahul Kumar Patel",
|
||||
versionCode = BuildConfig.VERSION_CODE.toLong(),
|
||||
versionName = BuildConfig.VERSION_NAME,
|
||||
shortDescription = "An unofficial FOSS client to Google Play with an elegant design and privacy",
|
||||
shortDescription = "An unofficial FOSS client to Google Play",
|
||||
changes = CHANGELOG,
|
||||
description = DESCRIPTION,
|
||||
isFree = true,
|
||||
@@ -82,7 +82,7 @@ class AppPreviewProvider : PreviewParameterProvider<App> {
|
||||
Manifest.permission.READ_EXTERNAL_STORAGE,
|
||||
Manifest.permission.WRITE_EXTERNAL_STORAGE
|
||||
),
|
||||
privacyPolicyUrl = "https://gitlab.com/AuroraOSS/AuroraStore/-/blob/master/POLICY.md",
|
||||
privacyPolicyUrl = "https://gitlab.com/AuroraOSS/AuroraStore/"
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ import com.aurora.store.compose.theme.AuroraTheme
|
||||
* Template for previewing composable with default theme and remote image handling
|
||||
*/
|
||||
@Composable
|
||||
fun PreviewTemplate(content : @Composable () -> Unit) {
|
||||
fun PreviewTemplate(content: @Composable () -> Unit) {
|
||||
AuroraTheme {
|
||||
CompositionLocalProvider(
|
||||
value = LocalAsyncImagePreviewHandler provides coilPreviewProvider,
|
||||
|
||||
@@ -77,7 +77,7 @@ private fun ScreenContent(onNavigateUp: () -> Unit = {}, onAboutAurora: () -> Un
|
||||
R.drawable.ic_ethereum_eth,
|
||||
R.drawable.ic_bhim,
|
||||
R.drawable.ic_paypal,
|
||||
R.drawable.ic_libera_pay,
|
||||
R.drawable.ic_libera_pay
|
||||
)
|
||||
|
||||
val links = linkURLS.mapIndexed { index, url ->
|
||||
|
||||
@@ -51,9 +51,9 @@ import com.aurora.store.compose.ui.blacklist.menu.BlacklistMenu
|
||||
import com.aurora.store.compose.ui.blacklist.menu.MenuItem
|
||||
import com.aurora.store.util.PackageUtil
|
||||
import com.aurora.store.viewmodel.blacklist.BlacklistViewModel
|
||||
import java.util.Calendar
|
||||
import kotlinx.coroutines.flow.collectLatest
|
||||
import kotlinx.coroutines.launch
|
||||
import java.util.Calendar
|
||||
|
||||
@Composable
|
||||
fun BlacklistScreen(onNavigateUp: () -> Unit, viewModel: BlacklistViewModel = hiltViewModel()) {
|
||||
@@ -132,7 +132,9 @@ private fun ScreenContent(
|
||||
BlacklistMenu { menuItem ->
|
||||
when (menuItem) {
|
||||
MenuItem.SELECT_ALL -> onBlacklistAll()
|
||||
|
||||
MenuItem.REMOVE_ALL -> onWhitelistAll()
|
||||
|
||||
MenuItem.IMPORT -> {
|
||||
docImportLauncher.launch(arrayOf(Constants.JSON_MIME_TYPE))
|
||||
}
|
||||
@@ -218,7 +220,9 @@ private fun ScreenContent(
|
||||
val isFiltered = isPackageFiltered(pkg)
|
||||
BlackListItem(
|
||||
icon = PackageUtil.getIconForPackage(context, pkg.packageName)!!,
|
||||
displayName = pkg.applicationInfo!!.loadLabel(context.packageManager).toString(),
|
||||
displayName = pkg.applicationInfo!!.loadLabel(
|
||||
context.packageManager
|
||||
).toString(),
|
||||
packageName = pkg.packageName,
|
||||
versionName = pkg.versionName!!,
|
||||
versionCode = PackageInfoCompat.getLongVersionCode(pkg),
|
||||
|
||||
@@ -50,6 +50,7 @@ import com.aurora.extensions.share
|
||||
import com.aurora.extensions.toast
|
||||
import com.aurora.gplayapi.data.models.App
|
||||
import com.aurora.gplayapi.data.models.Review
|
||||
import com.aurora.gplayapi.data.models.datasafety.Report as DataSafetyReport
|
||||
import com.aurora.store.R
|
||||
import com.aurora.store.compose.composable.ContainedLoadingIndicator
|
||||
import com.aurora.store.compose.composable.Error
|
||||
@@ -85,9 +86,8 @@ import com.aurora.store.util.FlavouredUtil
|
||||
import com.aurora.store.util.PackageUtil
|
||||
import com.aurora.store.util.ShortcutManagerUtil
|
||||
import com.aurora.store.viewmodel.details.AppDetailsViewModel
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlin.random.Random
|
||||
import com.aurora.gplayapi.data.models.datasafety.Report as DataSafetyReport
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
@Composable
|
||||
fun AppDetailsScreen(
|
||||
@@ -112,6 +112,7 @@ fun AppDetailsScreen(
|
||||
|
||||
when (state) {
|
||||
is AppState.Loading -> ScreenContentLoading(onNavigateUp = onNavigateUp)
|
||||
|
||||
is AppState.Error -> {
|
||||
ScreenContentError(
|
||||
onNavigateUp = onNavigateUp,
|
||||
@@ -238,8 +239,8 @@ private fun ScreenContentApp(
|
||||
|
||||
fun onInstall(requestedApp: App = app, ignoreMicroG: Boolean = false) {
|
||||
if (isPermittedToInstall(context, app)) {
|
||||
val shouldPromptMicroGInstall = app.requiresGMS()
|
||||
&& FlavouredUtil.promptMicroGInstall(context)
|
||||
val shouldPromptMicroGInstall = app.requiresGMS() &&
|
||||
FlavouredUtil.promptMicroGInstall(context)
|
||||
|
||||
if (shouldPromptMicroGInstall && !ignoreMicroG) {
|
||||
showExtraPane(ExtraScreen.MicroG)
|
||||
@@ -262,11 +263,15 @@ private fun ScreenContentApp(
|
||||
AppDetailsMenu(isFavorite = isFavorite, state = state) { menuItem ->
|
||||
when (menuItem) {
|
||||
MenuItem.FAVORITE -> onFavorite()
|
||||
|
||||
MenuItem.MANUAL_DOWNLOAD -> {
|
||||
showExtraPane(ExtraScreen.ManualDownload)
|
||||
}
|
||||
|
||||
MenuItem.SHARE -> context.share(app.displayName, app.packageName)
|
||||
|
||||
MenuItem.APP_INFO -> context.appInfo(app.packageName)
|
||||
|
||||
MenuItem.ADD_TO_HOME -> {
|
||||
ShortcutManagerUtil.requestPinShortcut(context, app.packageName)
|
||||
}
|
||||
@@ -454,8 +459,7 @@ private fun ScreenContentApp(
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun ExtraPane(screen: NavKey) {
|
||||
return when (screen) {
|
||||
fun ExtraPane(screen: NavKey) = when (screen) {
|
||||
is ExtraScreen.Review -> ReviewScreen(
|
||||
packageName = app.packageName,
|
||||
onNavigateUp = ::onNavigateBack
|
||||
@@ -509,7 +513,6 @@ private fun ScreenContentApp(
|
||||
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
|
||||
NavigableSupportingPaneScaffold(
|
||||
navigator = scaffoldNavigator,
|
||||
|
||||
@@ -162,7 +162,7 @@ private fun ScreenContentError(
|
||||
navigationIcon = windowAdaptiveInfo.adaptiveNavigationIcon,
|
||||
onNavigateUp = onNavigateUp
|
||||
)
|
||||
},
|
||||
}
|
||||
) { paddingValues ->
|
||||
Error(
|
||||
modifier = Modifier.padding(paddingValues),
|
||||
|
||||
@@ -107,7 +107,6 @@ private fun ScreenContent(
|
||||
onRequestInstall: (versionCode: Long) -> Unit = {},
|
||||
windowAdaptiveInfo: WindowAdaptiveInfo = currentWindowAdaptiveInfo()
|
||||
) {
|
||||
|
||||
val coroutineScope = rememberCoroutineScope()
|
||||
val snackBarHostState = remember { SnackbarHostState() }
|
||||
val errorMessage = stringResource(R.string.manual_download_version_error)
|
||||
@@ -180,7 +179,9 @@ private fun ScreenContent(
|
||||
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
horizontalArrangement = Arrangement.spacedBy(dimensionResource(R.dimen.padding_medium))
|
||||
horizontalArrangement = Arrangement.spacedBy(
|
||||
dimensionResource(R.dimen.padding_medium)
|
||||
)
|
||||
) {
|
||||
FilledTonalButton(
|
||||
modifier = Modifier.weight(1F),
|
||||
|
||||
@@ -116,7 +116,9 @@ private fun ScreenContent(
|
||||
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
horizontalArrangement = Arrangement.spacedBy(dimensionResource(R.dimen.padding_medium))
|
||||
horizontalArrangement = Arrangement.spacedBy(
|
||||
dimensionResource(R.dimen.padding_medium)
|
||||
)
|
||||
) {
|
||||
FilledTonalButton(
|
||||
modifier = Modifier.weight(1F),
|
||||
@@ -135,10 +137,11 @@ private fun ScreenContent(
|
||||
enabled = !uiState.isDownloading
|
||||
) {
|
||||
Text(
|
||||
text = if (uiState.isInstalled)
|
||||
text = if (uiState.isInstalled) {
|
||||
stringResource(R.string.action_install)
|
||||
else
|
||||
stringResource(R.string.action_ignore),
|
||||
} else {
|
||||
stringResource(R.string.action_ignore)
|
||||
},
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis
|
||||
)
|
||||
|
||||
@@ -50,8 +50,8 @@ import com.aurora.store.compose.preview.PreviewTemplate
|
||||
import com.aurora.store.compose.preview.ReviewPreviewProvider
|
||||
import com.aurora.store.viewmodel.details.AppDetailsViewModel
|
||||
import com.aurora.store.viewmodel.details.ReviewViewModel
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlin.random.Random
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
|
||||
@Composable
|
||||
fun ReviewScreen(
|
||||
@@ -90,7 +90,6 @@ private fun ScreenContent(
|
||||
onFilter: (filter: Review.Filter) -> Unit = {},
|
||||
windowAdaptiveInfo: WindowAdaptiveInfo = currentWindowAdaptiveInfo()
|
||||
) {
|
||||
|
||||
Scaffold(
|
||||
topBar = {
|
||||
TopAppBar(
|
||||
@@ -131,8 +130,6 @@ private fun ScreenContent(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,7 +172,7 @@ private fun FilterHeader(onClick: (filter: Review.Filter) -> Unit) {
|
||||
contentDescription = stringResource(filters.getValue(filter))
|
||||
)
|
||||
}
|
||||
},
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,7 +85,9 @@ fun Actions(
|
||||
@Composable
|
||||
private fun ActionsPreview() {
|
||||
PreviewTemplate {
|
||||
Column(verticalArrangement = Arrangement.spacedBy(dimensionResource(R.dimen.margin_medium))) {
|
||||
Column(
|
||||
verticalArrangement = Arrangement.spacedBy(dimensionResource(R.dimen.margin_medium))
|
||||
) {
|
||||
Actions(
|
||||
primaryActionDisplayName = stringResource(R.string.action_install),
|
||||
secondaryActionDisplayName = stringResource(R.string.title_manual_download)
|
||||
|
||||
@@ -59,7 +59,9 @@ fun Changelog(changelog: String) {
|
||||
@Composable
|
||||
private fun ChangelogPreview(@PreviewParameter(AppPreviewProvider::class) app: App) {
|
||||
PreviewTemplate {
|
||||
Column(verticalArrangement = Arrangement.spacedBy(dimensionResource(R.dimen.margin_medium))) {
|
||||
Column(
|
||||
verticalArrangement = Arrangement.spacedBy(dimensionResource(R.dimen.margin_medium))
|
||||
) {
|
||||
Changelog(changelog = app.changes)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ import com.aurora.store.data.model.Scores
|
||||
fun Compatibility(needsGms: Boolean, plexusScores: Scores? = null) {
|
||||
Header(
|
||||
title = stringResource(R.string.details_compatibility_title),
|
||||
subtitle = stringResource(R.string.plexus_powered),
|
||||
subtitle = stringResource(R.string.plexus_powered)
|
||||
)
|
||||
|
||||
if (!needsGms) {
|
||||
@@ -63,7 +63,7 @@ fun Compatibility(needsGms: Boolean, plexusScores: Scores? = null) {
|
||||
|
||||
val scoresStatus = mapOf(
|
||||
R.string.details_compatibility_no_gms to plexusScores?.aosp?.status,
|
||||
R.string.details_compatibility_microg to plexusScores?.microG?.status,
|
||||
R.string.details_compatibility_microg to plexusScores?.microG?.status
|
||||
)
|
||||
scoresStatus.forEach { (title, description) ->
|
||||
Info(
|
||||
@@ -80,7 +80,9 @@ fun Compatibility(needsGms: Boolean, plexusScores: Scores? = null) {
|
||||
@Composable
|
||||
private fun CompatibilityPreview() {
|
||||
PreviewTemplate {
|
||||
Column(verticalArrangement = Arrangement.spacedBy(dimensionResource(R.dimen.margin_medium))) {
|
||||
Column(
|
||||
verticalArrangement = Arrangement.spacedBy(dimensionResource(R.dimen.margin_medium))
|
||||
) {
|
||||
Compatibility(needsGms = true)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ fun DataSafety(report: Report, privacyPolicyUrl: String) {
|
||||
.ifBlank {
|
||||
stringResource(R.string.details_data_safety_share_none)
|
||||
}
|
||||
),
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -84,7 +84,9 @@ fun DataSafety(report: Report, privacyPolicyUrl: String) {
|
||||
@Composable
|
||||
private fun DataSafetyPreview(@PreviewParameter(AppPreviewProvider::class) app: App) {
|
||||
PreviewTemplate {
|
||||
Column(verticalArrangement = Arrangement.spacedBy(dimensionResource(R.dimen.margin_medium))) {
|
||||
Column(
|
||||
verticalArrangement = Arrangement.spacedBy(dimensionResource(R.dimen.margin_medium))
|
||||
) {
|
||||
DataSafety(
|
||||
privacyPolicyUrl = app.privacyPolicyUrl,
|
||||
report = Report(
|
||||
|
||||
@@ -44,7 +44,7 @@ import com.aurora.store.util.PackageUtil
|
||||
fun Details(
|
||||
app: App,
|
||||
state: AppState = AppState.Unavailable,
|
||||
onNavigateToDetailsDevProfile: (developerName: String) -> Unit = {},
|
||||
onNavigateToDetailsDevProfile: (developerName: String) -> Unit = {}
|
||||
) {
|
||||
val context = LocalContext.current
|
||||
val versionName = if (state is AppState.Installed) state.versionName else app.versionName
|
||||
@@ -96,6 +96,7 @@ fun Details(
|
||||
}
|
||||
|
||||
AppState.Queued::class -> stringResource(R.string.status_queued)
|
||||
|
||||
AppState.Purchasing::class -> stringResource(R.string.preparing_to_install)
|
||||
|
||||
else -> {
|
||||
@@ -112,7 +113,9 @@ fun Details(
|
||||
@Composable
|
||||
private fun DetailsPreview(@PreviewParameter(AppPreviewProvider::class) app: App) {
|
||||
PreviewTemplate {
|
||||
Column(verticalArrangement = Arrangement.spacedBy(dimensionResource(R.dimen.margin_medium))) {
|
||||
Column(
|
||||
verticalArrangement = Arrangement.spacedBy(dimensionResource(R.dimen.margin_medium))
|
||||
) {
|
||||
Details(app = app)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,7 +72,9 @@ fun DeveloperDetails(address: String, website: String, email: String) {
|
||||
@Composable
|
||||
private fun DeveloperDetailsPreview(@PreviewParameter(AppPreviewProvider::class) app: App) {
|
||||
PreviewTemplate {
|
||||
Column(verticalArrangement = Arrangement.spacedBy(dimensionResource(R.dimen.margin_medium))) {
|
||||
Column(
|
||||
verticalArrangement = Arrangement.spacedBy(dimensionResource(R.dimen.margin_medium))
|
||||
) {
|
||||
DeveloperDetails(
|
||||
address = app.developerAddress,
|
||||
website = app.developerWebsite,
|
||||
|
||||
@@ -37,7 +37,9 @@ fun Privacy(report: Report?, onNavigateToDetailsExodus: (() -> Unit)? = null) {
|
||||
|
||||
val reportStatus = when {
|
||||
report == null -> stringResource(R.string.failed_to_fetch_report)
|
||||
|
||||
report.id == -1 -> stringResource(R.string.exodus_progress)
|
||||
|
||||
else -> if (report.trackers.isEmpty()) {
|
||||
stringResource(R.string.exodus_no_tracker)
|
||||
} else {
|
||||
@@ -60,7 +62,9 @@ fun Privacy(report: Report?, onNavigateToDetailsExodus: (() -> Unit)? = null) {
|
||||
@Composable
|
||||
private fun PrivacyPreview() {
|
||||
PreviewTemplate {
|
||||
Column(verticalArrangement = Arrangement.spacedBy(dimensionResource(R.dimen.margin_medium))) {
|
||||
Column(
|
||||
verticalArrangement = Arrangement.spacedBy(dimensionResource(R.dimen.margin_medium))
|
||||
) {
|
||||
Privacy(report = Report(), onNavigateToDetailsExodus = {})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,7 +60,11 @@ fun RatingAndReviews(
|
||||
windowAdaptiveInfo: WindowAdaptiveInfo = currentWindowAdaptiveInfo()
|
||||
) {
|
||||
val stars = listOf(
|
||||
rating.oneStar, rating.twoStar, rating.threeStar, rating.fourStar, rating.fiveStar
|
||||
rating.oneStar,
|
||||
rating.twoStar,
|
||||
rating.threeStar,
|
||||
rating.fourStar,
|
||||
rating.fiveStar
|
||||
).map { it.toFloat() }.also {
|
||||
// No ratings available, nothing to show
|
||||
if (it.sum() == 0F) return
|
||||
@@ -150,7 +154,9 @@ private fun RatingAndReviewsPreview(@PreviewParameter(AppPreviewProvider::class)
|
||||
)
|
||||
}
|
||||
PreviewTemplate {
|
||||
Column(verticalArrangement = Arrangement.spacedBy(dimensionResource(R.dimen.margin_medium))) {
|
||||
Column(
|
||||
verticalArrangement = Arrangement.spacedBy(dimensionResource(R.dimen.margin_medium))
|
||||
) {
|
||||
RatingAndReviews(rating = app.rating, featuredReviews = reviews)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,9 @@ fun Screenshots(screenshots: List<Artwork>, onNavigateToScreenshot: (index: Int)
|
||||
@Composable
|
||||
private fun ScreenshotsPreview(@PreviewParameter(AppPreviewProvider::class) app: App) {
|
||||
PreviewTemplate {
|
||||
Column(verticalArrangement = Arrangement.spacedBy(dimensionResource(R.dimen.margin_medium))) {
|
||||
Column(
|
||||
verticalArrangement = Arrangement.spacedBy(dimensionResource(R.dimen.margin_medium))
|
||||
) {
|
||||
Screenshots(screenshots = app.screenshots)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ fun Tags(app: App) {
|
||||
Formatter.formatShortFileSize(context, app.size) to R.drawable.ic_apk_install,
|
||||
app.updatedOn to R.drawable.ic_updates,
|
||||
paidLabel to R.drawable.ic_paid,
|
||||
adsLabel to R.drawable.ic_campaign,
|
||||
adsLabel to R.drawable.ic_campaign
|
||||
).filterKeys { it != null }
|
||||
|
||||
LazyRow(
|
||||
@@ -72,7 +72,9 @@ fun Tags(app: App) {
|
||||
@Composable
|
||||
private fun TagsPreview(@PreviewParameter(AppPreviewProvider::class) app: App) {
|
||||
PreviewTemplate {
|
||||
Column(verticalArrangement = Arrangement.spacedBy(dimensionResource(R.dimen.margin_medium))) {
|
||||
Column(
|
||||
verticalArrangement = Arrangement.spacedBy(dimensionResource(R.dimen.margin_medium))
|
||||
) {
|
||||
Tags(app = app)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,7 +73,9 @@ fun Testing(isSubscribed: Boolean, onTestingSubscriptionChange: (subscribe: Bool
|
||||
@Composable
|
||||
private fun TestingPreview(@PreviewParameter(AppPreviewProvider::class) app: App) {
|
||||
PreviewTemplate {
|
||||
Column(verticalArrangement = Arrangement.spacedBy(dimensionResource(R.dimen.margin_medium))) {
|
||||
Column(
|
||||
verticalArrangement = Arrangement.spacedBy(dimensionResource(R.dimen.margin_medium))
|
||||
) {
|
||||
Testing(isSubscribed = app.testingProgram!!.isSubscribed)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,8 +36,8 @@ import com.aurora.store.compose.preview.AppPreviewProvider
|
||||
import com.aurora.store.compose.preview.PreviewTemplate
|
||||
import com.aurora.store.viewmodel.details.DevProfileViewModel
|
||||
import com.aurora.store.viewmodel.search.SearchViewModel
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlin.random.Random
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
|
||||
/**
|
||||
* Screen to display apps from a developer using the developerId
|
||||
|
||||
@@ -48,7 +48,7 @@ fun DispenserScreen(onNavigateUp: () -> Unit, viewModel: DispenserViewModel = hi
|
||||
)
|
||||
}
|
||||
|
||||
var shouldRemoveDispenser : String? by rememberSaveable { mutableStateOf(null) }
|
||||
var shouldRemoveDispenser: String? by rememberSaveable { mutableStateOf(null) }
|
||||
shouldRemoveDispenser?.let { url ->
|
||||
RemoveDispenserDialog(
|
||||
url = url,
|
||||
|
||||
@@ -65,7 +65,7 @@ fun InputDispenserDialog(onAdd: (url: String) -> Unit = {}, onDismiss: () -> Uni
|
||||
onValueChange = { url = it },
|
||||
shape = RoundedCornerShape(10.dp),
|
||||
singleLine = true,
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
|
||||
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() })
|
||||
)
|
||||
}
|
||||
},
|
||||
|
||||
@@ -45,8 +45,8 @@ import com.aurora.store.compose.ui.downloads.menu.MenuItem
|
||||
import com.aurora.store.data.model.DownloadStatus
|
||||
import com.aurora.store.data.room.download.Download
|
||||
import com.aurora.store.viewmodel.downloads.DownloadsViewModel
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlin.random.Random
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
|
||||
@Composable
|
||||
fun DownloadsScreen(
|
||||
|
||||
@@ -44,9 +44,9 @@ import com.aurora.store.compose.ui.favourite.menu.FavouriteMenu
|
||||
import com.aurora.store.compose.ui.favourite.menu.MenuItem
|
||||
import com.aurora.store.data.room.favourite.Favourite
|
||||
import com.aurora.store.viewmodel.all.FavouriteViewModel
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import java.util.Calendar
|
||||
import kotlin.random.Random
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
|
||||
@Composable
|
||||
fun FavouriteScreen(
|
||||
@@ -179,7 +179,7 @@ private fun ScreenContent(
|
||||
@Preview
|
||||
@Composable
|
||||
private fun FavouriteScreenPreview(
|
||||
@PreviewParameter(FavouritePreviewProvider ::class) favourite: Favourite
|
||||
@PreviewParameter(FavouritePreviewProvider::class) favourite: Favourite
|
||||
) {
|
||||
PreviewTemplate {
|
||||
val favourites = List(10) {
|
||||
|
||||
@@ -36,8 +36,8 @@ import com.aurora.store.compose.composable.app.LargeAppListItem
|
||||
import com.aurora.store.compose.preview.AppPreviewProvider
|
||||
import com.aurora.store.compose.preview.PreviewTemplate
|
||||
import com.aurora.store.viewmodel.all.InstalledViewModel
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlin.random.Random
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
|
||||
@Composable
|
||||
fun InstalledScreen(
|
||||
|
||||
@@ -33,12 +33,12 @@ import com.aurora.store.viewmodel.onboarding.MicroGViewModel
|
||||
@Composable
|
||||
fun MicroGPage(
|
||||
onMicrogTOSChecked: (Boolean) -> Unit = {},
|
||||
viewModel: MicroGViewModel = hiltViewModel(),
|
||||
viewModel: MicroGViewModel = hiltViewModel()
|
||||
) {
|
||||
ScreenContent(
|
||||
uiState = viewModel.uiState,
|
||||
onInstall = { viewModel.downloadMicroG() },
|
||||
onMicrogTOSChecked = onMicrogTOSChecked,
|
||||
onMicrogTOSChecked = onMicrogTOSChecked
|
||||
)
|
||||
}
|
||||
|
||||
@@ -88,7 +88,6 @@ private fun ScreenContent(
|
||||
onTOSChecked = onMicrogTOSChecked
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Preview(showBackground = true)
|
||||
@@ -96,7 +95,7 @@ private fun ScreenContent(
|
||||
private fun MicroGPagePreview() {
|
||||
PreviewTemplate {
|
||||
ScreenContent(
|
||||
uiState = MicroGUIState(),
|
||||
uiState = MicroGUIState()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,9 +71,7 @@ private fun ScreenContent(
|
||||
val pagerState = rememberPagerState { pages.size }
|
||||
val coroutineScope = rememberCoroutineScope()
|
||||
|
||||
fun isFinalPage(): Boolean {
|
||||
return pagerState.currentPage == (pagerState.pageCount - 1)
|
||||
}
|
||||
fun isFinalPage(): Boolean = pagerState.currentPage == (pagerState.pageCount - 1)
|
||||
|
||||
@Composable
|
||||
fun SetupActions(uiState: OnboardingUiState) {
|
||||
@@ -105,6 +103,7 @@ private fun ScreenContent(
|
||||
onClick = {
|
||||
when (pagerState.currentPage) {
|
||||
0 -> onFinishOnboarding()
|
||||
|
||||
else -> {
|
||||
coroutineScope.launch {
|
||||
pagerState.animateScrollToPage(pagerState.currentPage - 1)
|
||||
@@ -125,10 +124,13 @@ private fun ScreenContent(
|
||||
|
||||
Button(
|
||||
modifier = buttonWidthModifier,
|
||||
enabled = !isFinalPage() || (!uiState.isMicroBundleChecked || uiState.isMicroGBundleInstalled),
|
||||
enabled =
|
||||
!isFinalPage() ||
|
||||
(!uiState.isMicroBundleChecked || uiState.isMicroGBundleInstalled),
|
||||
onClick = {
|
||||
when {
|
||||
isFinalPage() -> onFinishOnboarding()
|
||||
|
||||
else -> {
|
||||
coroutineScope.launch {
|
||||
pagerState.animateScrollToPage(pagerState.currentPage + 1)
|
||||
@@ -182,8 +184,12 @@ private fun ScreenContent(
|
||||
) { page ->
|
||||
when (pages[page]) {
|
||||
OnboardingPage.WELCOME -> WelcomePage()
|
||||
|
||||
OnboardingPage.PERMISSIONS -> PermissionsPage()
|
||||
OnboardingPage.MICRO_G -> MicroGPage(onMicrogTOSChecked = onMicrogTOSChecked)
|
||||
|
||||
OnboardingPage.MICRO_G -> MicroGPage(
|
||||
onMicrogTOSChecked = onMicrogTOSChecked
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,11 +73,11 @@ import com.aurora.store.compose.preview.PreviewTemplate
|
||||
import com.aurora.store.compose.ui.details.AppDetailsScreen
|
||||
import com.aurora.store.data.model.SearchFilter
|
||||
import com.aurora.store.viewmodel.search.SearchViewModel
|
||||
import kotlin.random.Random
|
||||
import kotlinx.coroutines.android.awaitFrame
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.collectLatest
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlin.random.Random
|
||||
|
||||
@Composable
|
||||
fun SearchScreen(onNavigateUp: () -> Unit, viewModel: SearchViewModel = hiltViewModel()) {
|
||||
@@ -103,7 +103,7 @@ private fun ScreenContent(
|
||||
onFetchSuggestions: (String) -> Unit = {},
|
||||
onSearch: (String) -> Unit = {},
|
||||
onFilter: (filter: SearchFilter) -> Unit = {},
|
||||
isAnonymous: Boolean = true,
|
||||
isAnonymous: Boolean = true
|
||||
) {
|
||||
val textFieldState = rememberTextFieldState()
|
||||
val searchBarState = rememberSearchBarState()
|
||||
@@ -191,8 +191,9 @@ private fun ScreenContent(
|
||||
|
||||
@Composable
|
||||
fun ListPane() {
|
||||
// TODO: https://issuetracker.google.com/issues/445720462
|
||||
Scaffold(
|
||||
modifier = Modifier.focusable(), //TODO: https://issuetracker.google.com/issues/445720462
|
||||
modifier = Modifier.focusable(),
|
||||
topBar = { SearchBar() }
|
||||
) { paddingValues ->
|
||||
Column(
|
||||
@@ -317,7 +318,7 @@ private fun FilterHeader(
|
||||
contentDescription = stringResource(filter)
|
||||
)
|
||||
}
|
||||
},
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
@@ -344,7 +345,7 @@ private fun FilterHeader(
|
||||
painter = painterResource(R.drawable.ic_arrow_drop_down),
|
||||
contentDescription = stringResource(filter)
|
||||
)
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
DropdownMenu(expanded = isExpanded, onDismissRequest = { isExpanded = false }) {
|
||||
|
||||
@@ -28,10 +28,7 @@ import java.util.Properties
|
||||
import kotlin.random.Random
|
||||
|
||||
@Composable
|
||||
fun DevicePage(
|
||||
onRequestNavigateToSplash: () -> Unit,
|
||||
viewModel: SpoofViewModel = hiltViewModel(),
|
||||
) {
|
||||
fun DevicePage(onRequestNavigateToSplash: () -> Unit, viewModel: SpoofViewModel = hiltViewModel()) {
|
||||
val availableDevices by viewModel.availableDevices.collectAsStateWithLifecycle()
|
||||
val currentDevice by viewModel.currentDevice.collectAsStateWithLifecycle()
|
||||
|
||||
@@ -100,15 +97,13 @@ private fun PageContent(
|
||||
@Preview(showBackground = true)
|
||||
@Composable
|
||||
private fun DevicePagePreview() {
|
||||
fun getDevice(): Properties {
|
||||
return Properties().apply {
|
||||
fun getDevice(): Properties = Properties().apply {
|
||||
setProperty("UserReadableName", "Google Pixel 9a")
|
||||
setProperty("Build.VERSION.SDK_INT", "35")
|
||||
setProperty("Build.MANUFACTURER", "Google")
|
||||
setProperty("Platforms", "arm64-v8a")
|
||||
setProperty("Build.PRODUCT", Random.nextInt().toString())
|
||||
}
|
||||
}
|
||||
|
||||
PreviewTemplate {
|
||||
val defaultDevice = getDevice()
|
||||
|
||||
@@ -27,10 +27,7 @@ import com.aurora.store.viewmodel.spoof.SpoofViewModel
|
||||
import java.util.Locale
|
||||
|
||||
@Composable
|
||||
fun LocalePage(
|
||||
onRequestNavigateToSplash: () -> Unit,
|
||||
viewModel: SpoofViewModel = hiltViewModel()
|
||||
) {
|
||||
fun LocalePage(onRequestNavigateToSplash: () -> Unit, viewModel: SpoofViewModel = hiltViewModel()) {
|
||||
val availableLocales by viewModel.availableLocales.collectAsStateWithLifecycle()
|
||||
val currentLocale by viewModel.currentLocale.collectAsStateWithLifecycle()
|
||||
|
||||
@@ -50,7 +47,7 @@ private fun PageContent(
|
||||
defaultLocale: Locale = Locale.getDefault(),
|
||||
locales: List<Locale> = emptyList(),
|
||||
isLocaleSelected: (locale: Locale) -> Boolean = { false },
|
||||
onLocaleSelected: (locale: Locale) -> Unit = {},
|
||||
onLocaleSelected: (locale: Locale) -> Unit = {}
|
||||
) {
|
||||
LazyColumn(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
|
||||
@@ -47,7 +47,7 @@ import kotlinx.coroutines.launch
|
||||
fun SpoofScreen(
|
||||
onNavigateUp: () -> Unit,
|
||||
onNavigateToSplash: () -> Unit,
|
||||
viewModel: SpoofViewModel = hiltViewModel(),
|
||||
viewModel: SpoofViewModel = hiltViewModel()
|
||||
) {
|
||||
ScreenContent(
|
||||
onNavigateUp = onNavigateUp,
|
||||
|
||||
Reference in New Issue
Block a user