Show name your price screen first

pull/3090/head
Alex Baker 1 year ago
parent 22f001c7ee
commit 71ccad0559

@ -75,8 +75,8 @@ class Firebase @Inject constructor(
get() = installCooldown get() = installCooldown
|| preferences.lastSubscribeRequest + days("subscribe_cooldown", 30L) > currentTimeMillis() || preferences.lastSubscribeRequest + days("subscribe_cooldown", 30L) > currentTimeMillis()
val subGroupA: Boolean val nameYourPrice: Boolean
get() = remoteConfig?.getBoolean("sub_group_a") ?: false get() = remoteConfig?.getBoolean("name_your_price") ?: false
private fun days(key: String, default: Long): Long = private fun days(key: String, default: Long): Long =
TimeUnit.DAYS.toMillis(remoteConfig?.getLong(key) ?: default) TimeUnit.DAYS.toMillis(remoteConfig?.getLong(key) ?: default)

@ -49,7 +49,7 @@ class PurchaseActivity : AppCompatActivity(), OnPurchasesUpdated {
theme.applyToContext(this) theme.applyToContext(this)
if (savedInstanceState == null) { if (savedInstanceState == null) {
nameYourPrice.value = intent?.extras?.getBoolean(EXTRA_NAME_YOUR_PRICE) ?: false nameYourPrice.value = intent?.extras?.getBoolean(EXTRA_NAME_YOUR_PRICE) ?: firebase.nameYourPrice
} else { } else {
nameYourPrice.value = savedInstanceState.getBoolean(EXTRA_NAME_YOUR_PRICE) nameYourPrice.value = savedInstanceState.getBoolean(EXTRA_NAME_YOUR_PRICE)
sliderPosition.value = savedInstanceState.getFloat(EXTRA_PRICE) sliderPosition.value = savedInstanceState.getFloat(EXTRA_PRICE)
@ -64,7 +64,6 @@ class PurchaseActivity : AppCompatActivity(), OnPurchasesUpdated {
nameYourPrice = nameYourPrice, nameYourPrice = nameYourPrice,
sliderPosition = sliderPosition, sliderPosition = sliderPosition,
github = github, github = github,
hideText = firebase.subGroupA,
subscribe = this::purchase, subscribe = this::purchase,
onBack = { finish() }, onBack = { finish() },
) )

@ -41,6 +41,7 @@ import androidx.compose.material3.TopAppBarDefaults
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.MutableState import androidx.compose.runtime.MutableState
import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
@ -140,7 +141,6 @@ object PurchaseText {
nameYourPrice: MutableState<Boolean> = mutableStateOf(false), nameYourPrice: MutableState<Boolean> = mutableStateOf(false),
sliderPosition: MutableState<Float> = mutableStateOf(0f), sliderPosition: MutableState<Float> = mutableStateOf(0f),
github: Boolean = false, github: Boolean = false,
hideText: Boolean,
subscribe: (Int, Boolean) -> Unit, subscribe: (Int, Boolean) -> Unit,
onBack: () -> Unit, onBack: () -> Unit,
) { ) {
@ -176,10 +176,8 @@ object PurchaseText {
.background(color = colorResource(R.color.content_background)), .background(color = colorResource(R.color.content_background)),
horizontalAlignment = Alignment.CenterHorizontally, horizontalAlignment = Alignment.CenterHorizontally,
) { ) {
if (!hideText) {
GreetingText(R.string.upgrade_blurb_1) GreetingText(R.string.upgrade_blurb_1)
GreetingText(R.string.upgrade_blurb_2) GreetingText(R.string.upgrade_blurb_2)
}
Spacer(Modifier.height(KEYLINE_FIRST)) Spacer(Modifier.height(KEYLINE_FIRST))
val pagerState = rememberPagerState { val pagerState = rememberPagerState {
featureList.size featureList.size
@ -474,7 +472,6 @@ object PurchaseText {
private fun PurchaseDialogPreview() { private fun PurchaseDialogPreview() {
TasksTheme { TasksTheme {
SubscriptionScreen( SubscriptionScreen(
hideText = false,
subscribe = { _, _ -> }, subscribe = { _, _ -> },
onBack = {}, onBack = {},
) )
@ -484,10 +481,10 @@ private fun PurchaseDialogPreview() {
@Preview(showBackground = true) @Preview(showBackground = true)
@Preview(showBackground = true, uiMode = UI_MODE_NIGHT_YES) @Preview(showBackground = true, uiMode = UI_MODE_NIGHT_YES)
@Composable @Composable
private fun PurchaseDialogPreviewNoText() { private fun NameYourPricePreview() {
TasksTheme { TasksTheme {
SubscriptionScreen( SubscriptionScreen(
hideText = true, nameYourPrice = remember { mutableStateOf(true) },
subscribe = { _, _ -> }, subscribe = { _, _ -> },
onBack = {}, onBack = {},
) )

Loading…
Cancel
Save