Skip to content

Commit 72641f2

Browse files
committed
chore(flipcash): update copy around pools
Signed-off-by: Brandon McAnsh <[email protected]>
1 parent 37da2a1 commit 72641f2

File tree

6 files changed

+45
-63
lines changed

6 files changed

+45
-63
lines changed

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@
173173
<string name="title_pools">Pools</string>
174174
<string name="action_createNewPool">Create a New Pool</string>
175175
<string name="title_poseQuestion">Pose a Question</string>
176-
<string name="title_setAmount">Set an Amount</string>
176+
<string name="title_costToJoin">Cost to Join</string>
177177
<string name="title_createPool">Create Pool</string>
178178
<string name="subtitle_createPoolDisclaimer">As the pool host, you will decide the outcome of the pool in your sole discretion</string>
179179
<string name="subtitle_createPools">Create a pool, collect money from your friends, and then decide who was right!</string>
@@ -241,10 +241,18 @@
241241

242242
<string name="prompt_title_poolResolution">What was the winning outcome?</string>
243243

244-
<string name="action_swipeToSendPayouts">Swipe to Send Payouts</string>
244+
<string name="action_swipeToConfirm">Swipe to Confirm</string>
245+
<string name="subtitle_wasInPool">was in pool</string>
245246
<string name="subtitle_winnerReceives">Winner receives %1$s</string>
246247
<string name="subtitle_winnersReceive">Winners receive %1$s</string>
247248
<string name="subtitle_everyoneReceives">Everyone receives %1$s</string>
249+
<string name="subtitle_everyoneGotMoneyBack">Everyone got their money back</string>
250+
251+
<plurals name="subtitle_personCount">
252+
<item quantity="zero">0 people</item>
253+
<item quantity="one">1 person</item>
254+
<item quantity="other">%1$s people</item>
255+
</plurals>
248256

249257
<string-array name="pool_preview_titles">
250258
<item>Will Joe and Sally have a baby girl?</item>

apps/flipcash/features/payments/src/main/kotlin/com/flipcash/app/payments/internal/PoolResolutionConfirmation.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ internal fun PoolResolutionConfirmationModal(
6868
winners = metadata.pool.winnerCount,
6969
buyIn = metadata.pool.buyIn,
7070
winningAmount = metadata.pool.winningAmountForResolution(metadata.resolution),
71-
label = stringResource(R.string.action_swipeToSendPayouts),
71+
label = stringResource(R.string.action_swipeToConfirm),
7272
)
7373
val enabled = state !is ConfirmationState.Sending && state !is ConfirmationState.Sent
7474
val alpha by animateFloatAsState(targetValue = if (enabled) 1f else 0f, label = "alpha")
@@ -178,7 +178,7 @@ private fun PreviewResolutionModalWithSingleYesWin() {
178178
winners = 1,
179179
winningAmount = 10.00.toFiat(),
180180
buyIn = 10.00.toFiat(),
181-
label = stringResource(R.string.action_swipeToSendPayouts),
181+
label = stringResource(R.string.action_swipeToConfirm),
182182
)
183183
CodeButton(
184184
modifier = Modifier
@@ -208,7 +208,7 @@ private fun PreviewResolutionModalWithMultipleWin() {
208208
winners = 2,
209209
winningAmount = 10.00.toFiat(),
210210
buyIn = 10.00.toFiat(),
211-
label = stringResource(R.string.action_swipeToSendPayouts),
211+
label = stringResource(R.string.action_swipeToConfirm),
212212
)
213213
CodeButton(
214214
modifier = Modifier
@@ -238,7 +238,7 @@ private fun PreviewResolutionModalWithTie() {
238238
winners = 1,
239239
winningAmount = 10.00.toFiat(),
240240
buyIn = 10.00.toFiat(),
241-
label = stringResource(R.string.action_swipeToSendPayouts),
241+
label = stringResource(R.string.action_swipeToConfirm),
242242
)
243243
CodeButton(
244244
modifier = Modifier

apps/flipcash/features/payments/src/main/kotlin/com/flipcash/app/payments/internal/PublicPaymentConfirmation.kt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,7 @@ internal fun PublicPaymentConfirmationModal(
5252
isSending = isSending,
5353
state = state,
5454
onApproved = onSend,
55-
label = when (confirmation.metadata) {
56-
is PoolBidPaymentMetadata -> stringResource(R.string.action_swipeToBuyIn)
57-
else -> stringResource(id = R.string.action_swipeToPay)
58-
}
55+
label = stringResource(id = R.string.action_swipeToPay),
5956
)
6057
val enabled = state !is ConfirmationState.Sending && state !is ConfirmationState.Sent
6158
val alpha by animateFloatAsState(targetValue = if (enabled) 1f else 0f, label = "alpha")

apps/flipcash/features/pools/src/main/kotlin/com/flipcash/app/pools/create/PoolCustomBidEntryScreen.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class PoolCustomBidEntryScreen : ModalScreen, NamedScreen, Parcelable {
2828
override val key: ScreenKey = uniqueScreenKey
2929

3030
override val name: String
31-
@Composable get() = stringResource(R.string.title_setAmount)
31+
@Composable get() = stringResource(R.string.title_costToJoin)
3232

3333
@Composable
3434
override fun ModalContent() {

apps/flipcash/features/pools/src/main/kotlin/com/flipcash/app/pools/internal/betting/PoolBettingScreenContent.kt

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import androidx.compose.ui.Modifier
3838
import androidx.compose.ui.graphics.Color
3939
import androidx.compose.ui.graphics.CompositingStrategy
4040
import androidx.compose.ui.graphics.graphicsLayer
41+
import androidx.compose.ui.res.pluralStringResource
4142
import androidx.compose.ui.res.stringResource
4243
import androidx.compose.ui.text.rememberTextMeasurer
4344
import androidx.compose.ui.text.style.TextAlign
@@ -101,7 +102,7 @@ private fun PoolBettingScreenContent(
101102
horizontalAlignment = Alignment.CenterHorizontally
102103
) {
103104
Spacer(modifier = Modifier.height(CodeTheme.dimens.grid.x12))
104-
PoolTotal(state.poolTotal)
105+
PoolTotal(state.poolTotal, state.isResolved)
105106
Spacer(modifier = Modifier.height(CodeTheme.dimens.grid.x12))
106107
BidOptions(
107108
canBid = state.canSelectOutcome,
@@ -119,6 +120,7 @@ private fun PoolBettingScreenContent(
119120
@Composable
120121
private fun PoolTotal(
121122
poolTotal: Fiat,
123+
isResolved: Boolean = false,
122124
) {
123125
Column(
124126
horizontalAlignment = Alignment.CenterHorizontally,
@@ -130,7 +132,11 @@ private fun PoolTotal(
130132
iconSize = CodeTheme.dimens.staticGrid.x5,
131133
)
132134
Text(
133-
text = stringResource(R.string.subtitle_inPoolSoFar),
135+
text = if (isResolved) {
136+
stringResource(R.string.subtitle_wasInPool)
137+
} else {
138+
stringResource(R.string.subtitle_inPoolSoFar)
139+
},
134140
style = CodeTheme.typography.textLarge,
135141
color = CodeTheme.colors.textSecondary,
136142
)
@@ -141,7 +147,7 @@ private fun PoolTotal(
141147
private fun BidOptions(
142148
canBid: Boolean,
143149
outcomes: List<PoolBetOutcome>,
144-
totals: Map<PoolBetOutcome, Fiat>,
150+
totals: Map<PoolBetOutcome, Int>,
145151
selectedOutcome: PoolBetOutcome?,
146152
resolution: PoolResolution,
147153
modifier: Modifier = Modifier,
@@ -274,7 +280,7 @@ private fun ClickableCell(
274280
isSelected: Boolean,
275281
resolution: PoolResolution,
276282
item: PoolBetOutcome,
277-
totals: Map<PoolBetOutcome, Fiat>,
283+
totals: Map<PoolBetOutcome, Int>,
278284
modifier: Modifier = Modifier,
279285
onClick: () -> Unit,
280286
) {
@@ -344,7 +350,11 @@ private fun ClickableCell(
344350
)
345351

346352
Text(
347-
text = (totals[item] ?: Fiat.Zero).formatted(),
353+
text = pluralStringResource(
354+
R.plurals.subtitle_personCount,
355+
totals[item] ?: 0,
356+
totals[item] ?: 0
357+
),
348358
style = CodeTheme.typography.textSmall,
349359
color = choiceBetTotalColor,
350360
)
@@ -365,15 +375,6 @@ private fun ResolutionInfo(state: PoolBettingViewModel.State, modifier: Modifier
365375
verticalArrangement = Arrangement.spacedBy(CodeTheme.dimens.grid.x2, Alignment.CenterVertically),
366376
horizontalAlignment = Alignment.CenterHorizontally
367377
) {
368-
Text(
369-
text = when (val resolution = state.metadata.resolution) {
370-
PoolResolution.Refund -> stringResource(string.label_tie)
371-
is PoolResolution.BooleanResolution -> resolution.value.toYesOrNo()
372-
PoolResolution.NotSet -> ""
373-
},
374-
style = CodeTheme.typography.displaySmall,
375-
color = CodeTheme.colors.textMain,
376-
)
377378
Text(
378379
text = when (state.metadata.resolution) {
379380
is PoolResolution.BooleanResolution -> {
@@ -389,10 +390,7 @@ private fun ResolutionInfo(state: PoolBettingViewModel.State, modifier: Modifier
389390
}
390391
}
391392
PoolResolution.Refund -> {
392-
stringResource(
393-
string.subtitle_everyoneReceives,
394-
state.metadata.buyIn.formatted()
395-
)
393+
stringResource(string.subtitle_everyoneGotMoneyBack,)
396394
}
397395

398396
PoolResolution.NotSet -> ""

apps/flipcash/features/pools/src/main/kotlin/com/flipcash/app/pools/internal/betting/PoolBettingViewModel.kt

Lines changed: 13 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,9 @@ internal class PoolBettingViewModel @Inject constructor(
9292
val isResolved: Boolean
9393
get() = metadata.resolution is PoolResolution.DecisionMade
9494

95-
val totalPerOutcome: Map<PoolBetOutcome, Fiat>
95+
val totalPerOutcome: Map<PoolBetOutcome, Int>
9696
get() {
97-
val betsPerOutcome = mutableMapOf<PoolBetOutcome, Fiat>()
97+
val betsPerOutcome = mutableMapOf<PoolBetOutcome, Int>()
9898

9999
outcomes.forEach { outcome ->
100100
val countForOutcome = when (val summary = poolWithBets.pool.betSummary) {
@@ -109,7 +109,7 @@ internal class PoolBettingViewModel @Inject constructor(
109109
}
110110
PoolBetSummary.NotSet -> 0
111111
}
112-
betsPerOutcome[outcome] = metadata.buyIn.times(countForOutcome)
112+
betsPerOutcome[outcome] = countForOutcome
113113
}
114114

115115
return betsPerOutcome
@@ -243,42 +243,21 @@ internal class PoolBettingViewModel @Inject constructor(
243243
.onEach { data ->
244244
val actions = buildList {
245245
if (data.isHost) {
246-
if (data.bets.count() >= 2) {
246+
if (stateFlow.value.rendezvous != null) {
247247
add(
248248
BottomBarAction(
249-
text = resources.getString(R.string.action_declareOutcome),
250-
style = BottomBarManager.BottomBarButtonStyle.Filled,
251-
onClick = { dispatchEvent(Event.OnDeclareOutcome) }
249+
text = resources.getString(R.string.action_sharePoolWithFriends),
250+
onClick = { dispatchEvent(Event.OnSharePool) }
252251
)
253252
)
254-
if (stateFlow.value.rendezvous != null) {
255-
add(
256-
BottomBarAction(
257-
text = resources.getString(R.string.action_sharePoolWithFriends),
258-
style = BottomBarManager.BottomBarButtonStyle.Text,
259-
onClick = { dispatchEvent(Event.OnSharePool) }
260-
)
261-
)
262-
}
263-
} else {
264-
if (stateFlow.value.rendezvous != null) {
265-
add(
266-
BottomBarAction(
267-
text = resources.getString(R.string.action_sharePoolWithFriends),
268-
onClick = { dispatchEvent(Event.OnSharePool) }
269-
)
270-
)
271-
}
272-
if (data.bets.isNotEmpty()) {
273-
add(
274-
BottomBarAction(
275-
text = resources.getString(R.string.action_declareOutcome),
276-
style = BottomBarManager.BottomBarButtonStyle.Text,
277-
onClick = { dispatchEvent(Event.OnDeclareOutcome) }
278-
)
279-
)
280-
}
281253
}
254+
add(
255+
BottomBarAction(
256+
text = resources.getString(R.string.action_declareOutcome),
257+
style = BottomBarManager.BottomBarButtonStyle.Text,
258+
onClick = { dispatchEvent(Event.OnDeclareOutcome) }
259+
)
260+
)
282261
} else {
283262
if (stateFlow.value.rendezvous != null) {
284263
add(

0 commit comments

Comments
 (0)