Skip to content

Commit 7b5702f

Browse files
committed
chore(flipcash): deprecate welcome bonus IAP for now; tweak copy
Signed-off-by: Brandon McAnsh <[email protected]>
1 parent 01a0d5d commit 7b5702f

File tree

5 files changed

+15
-18
lines changed

5 files changed

+15
-18
lines changed

apps/flipcash/core/src/main/res/values/strings.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@
1414

1515
<string name="title_finalizeAccountCreationWithWelcomeBonus">Pay %1$s, Get %2$s</string>
1616
<string name="subtitle_finalizeAccountCreationWithWelcomeBonus">For a limited time new accounts will receive a free welcome bonus of %1s of stablecoins</string>
17-
<string name="title_finalizeAccountCreationWithoutBonus">Pay %1$s</string>
18-
<string name="subtitle_finalizeAccountCreationWithoutBonus">Pay %1$s to create your Flipcash account</string>
17+
<string name="title_finalizeAccountCreationWithoutBonus">Purchase an Account for %1$s</string>
18+
<string name="subtitle_finalizeAccountCreationWithoutBonus">This fee is used to cover our operational costs</string>
1919

2020
<string name="action_logOutAndLogin">Log Out &amp; Log In</string>
2121

2222

2323
<string name="title_logoutAndLoginConfirmation">You\'re currently logged into an account</string>
2424
<string name="subtitle_logoutAndLoginConfirmation">Please ensure you have saved your Access Key before proceeding. Would you like to logout and login with a new account?</string>
2525

26-
<string name="action_purchaseAccount">Buy Your Account</string>
26+
<string name="action_purchaseAccount">Purchase Your Account</string>
2727
<string name="title_purchaseAccountPending">Purchase Pending</string>
2828

2929
<string name="error_title_failedToPurchaseItem">Purchase Failed</string>

apps/flipcash/features/purchase/src/main/kotlin/com/flipcash/app/purchase/internal/PurchaseAccountViewModel.kt

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -113,18 +113,10 @@ internal class PurchaseAccountViewModel @Inject constructor(
113113
billingClient.state
114114
.filter { it.connectionState == BillingClientConnection.Connected }
115115
.onEach {
116-
val receivedWelcomeBonus =
117-
billingClient.hasPaidFor(IapProduct.CreateAccountWithWelcomeBonus)
118-
val (product, cost) = if (!receivedWelcomeBonus) {
119-
IapProduct.CreateAccountWithWelcomeBonus to billingClient.costOf(IapProduct.CreateAccountWithWelcomeBonus)
120-
} else {
121-
IapProduct.CreateAccount to billingClient.costOf(IapProduct.CreateAccount)
122-
}
123-
124116
dispatchEvent(
125117
Event.OnProductChanged(
126-
product = product,
127-
cost = cost
118+
product = IapProduct.CreateAccount,
119+
cost = billingClient.costOf(IapProduct.CreateAccount)
128120
)
129121
)
130122
}.launchIn(viewModelScope)

apps/flipcash/shared/billing/src/main/kotlin/com/flipcash/app/billing/BillingClient.kt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ interface BillingClient {
3333

3434
fun connect()
3535
fun disconnect()
36+
suspend fun isAvailable(product: IapProduct): Boolean
3637
fun hasPaidFor(product: IapProduct): Boolean
3738
suspend fun costOf(product: IapProduct): ProductPrice?
3839
suspend fun purchase(activity: Activity, product: IapProduct)
@@ -50,13 +51,9 @@ object StubBillingClient: BillingClient {
5051
)
5152
override val state: StateFlow<BillingClientState> = _stateFlow.asStateFlow()
5253

53-
data class State(
54-
val connected: Boolean = false,
55-
val failedToConnect: Boolean = false,
56-
)
57-
5854
override fun connect() = Unit
5955
override fun disconnect() = Unit
56+
override suspend fun isAvailable(product: IapProduct): Boolean = false
6057
override fun hasPaidFor(product: IapProduct): Boolean = false
6158
override suspend fun costOf(product: IapProduct): ProductPrice? = null
6259
override suspend fun purchase(activity: Activity, product: IapProduct) {

apps/flipcash/shared/billing/src/main/kotlin/com/flipcash/app/billing/Products.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ package com.flipcash.app.billing
22

33
enum class IapProduct(internal val productId: String, internal val isConsumable: Boolean) {
44
CreateAccount("com.flipcash.iap.createaccount", true),
5+
@Deprecated("Welcome bonus has been phased out for now")
56
CreateAccountWithWelcomeBonus("com.flipcash.iap.createaccountwithwelcomebonus", false)
67
}

apps/flipcash/shared/billing/src/main/kotlin/com/flipcash/app/billing/internal/GooglePlayBillingClient.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,13 @@ internal class GooglePlayBillingClient(
144144
}
145145
}
146146

147+
override suspend fun isAvailable(product: IapProduct): Boolean {
148+
val hasDetails = productDetails.containsKey(product.productId)
149+
if (hasDetails) return true
150+
queryProduct(product.productId)
151+
return productDetails.containsKey(product.productId)
152+
}
153+
147154
override fun hasPaidFor(product: IapProduct) =
148155
_purchases[product.productId] == Purchase.PurchaseState.PURCHASED
149156

0 commit comments

Comments
 (0)