Skip to content

Commit

Permalink
Fix "Join Telegram" card CTA and add "Donate" prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
ILIYANGERMANOV committed Jun 11, 2022
1 parent 5a9187d commit c01c63c
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.ivy.wallet.domain.deprecated.logic

import androidx.compose.runtime.Composable
import androidx.compose.ui.tooling.preview.Preview
import com.ivy.design.l0_system.SunsetNight
import com.ivy.wallet.Constants
import com.ivy.wallet.R
import com.ivy.wallet.domain.data.TransactionType
Expand All @@ -11,6 +12,7 @@ import com.ivy.wallet.io.persistence.dao.PlannedPaymentRuleDao
import com.ivy.wallet.io.persistence.dao.TransactionDao
import com.ivy.wallet.stringRes
import com.ivy.wallet.ui.*
import com.ivy.wallet.ui.donate.DonateScreen
import com.ivy.wallet.ui.home.CustomerJourneyCard
import com.ivy.wallet.ui.main.MainTab
import com.ivy.wallet.ui.theme.*
Expand Down Expand Up @@ -56,11 +58,11 @@ class CustomerJourneyLogic(
rateUsCard(),
shareIvyWalletCard(),
joinIvyTelegramCard(),
// buyLifetimeOfferCard(),
makeReportCard(),
rateUsCard_2(),
shareIvyWalletCard_2(),
ivyWalletIsOpenSource()
ivyWalletIsOpenSource(),
donateIvyWallet()
)

fun adjustBalanceCard() = CustomerJourneyCardData(
Expand All @@ -72,7 +74,7 @@ class CustomerJourneyLogic(
description = stringRes(R.string.adjust_initial_balance_description),
cta = stringRes(R.string.to_accounts),
ctaIcon = R.drawable.ic_custom_account_s,
backgroundColor = Ivy,
background = Gradient.solid(Ivy),
hasDismiss = false,
onAction = { _, ivyContext, _ ->
ivyContext.selectMainTab(MainTab.ACCOUNTS)
Expand All @@ -88,7 +90,7 @@ class CustomerJourneyLogic(
description = stringRes(R.string.create_first_planned_payment_description),
cta = stringRes(R.string.add_planned_payment),
ctaIcon = R.drawable.ic_planned_payments,
backgroundColor = Orange,
background = Gradient.solid(Orange),
hasDismiss = true,
onAction = { navigation, _, _ ->
navigation.navigateTo(
Expand All @@ -109,7 +111,7 @@ class CustomerJourneyLogic(
description = stringRes(R.string.widget_description),
cta = stringRes(R.string.add_widget),
ctaIcon = R.drawable.ic_custom_atom_s,
backgroundColor = GreenLight,
background = Gradient.solid(GreenLight),
hasDismiss = true,
onAction = { _, _, ivyActivity ->
ivyActivity.pinWidget(AddTransactionWidgetCompact::class.java)
Expand All @@ -122,10 +124,10 @@ class CustomerJourneyLogic(
trnCount >= 5
},
title = stringRes(R.string.set_a_budget),
description = stringRes(R.string.set_a_budget_description),
description = stringRes(R.string.set_a_budget_description),
cta = stringRes(R.string.add_budget),
ctaIcon = R.drawable.ic_budget_xs,
backgroundColor = Green2,
background = Gradient.solid(Green2),
hasDismiss = true,
onAction = { navigation, _, _ ->
navigation.navigateTo(BudgetScreen)
Expand All @@ -141,7 +143,7 @@ class CustomerJourneyLogic(
description = stringRes(R.string.expenses_piechart_description),
cta = stringRes(R.string.expenses_piechart),
ctaIcon = R.drawable.ic_custom_bills_s,
backgroundColor = Red,
background = Gradient.solid(Red),
hasDismiss = true,
onAction = { navigation, _, _ ->
navigation.navigateTo(PieChartStatistic(type = TransactionType.EXPENSE))
Expand All @@ -157,7 +159,7 @@ class CustomerJourneyLogic(
description = stringRes(R.string.review_ivy_wallet_description),
cta = stringRes(R.string.rate_us_on_google_play),
ctaIcon = R.drawable.ic_custom_star_s,
backgroundColor = Green,
background = Gradient.solid(Green),
hasDismiss = true,
onAction = { _, _, ivyActivity ->
ivyActivity.reviewIvyWallet(dismissReviewCard = true)
Expand All @@ -173,7 +175,7 @@ class CustomerJourneyLogic(
description = stringRes(R.string.help_us_grow),
cta = stringRes(R.string.share_with_friends),
ctaIcon = R.drawable.ic_custom_family_s,
backgroundColor = Red3,
background = Gradient.solid(Red3),
hasDismiss = true,
onAction = { _, _, ivyActivity ->
ivyActivity.shareIvyWallet()
Expand All @@ -185,31 +187,14 @@ class CustomerJourneyLogic(
condition = { trnCount, _, _ ->
trnCount >= 16
},
description = "It seems like that you're enjoying Ivy Wallet! Feel free join our invite-only Ivy Telegram Community and make our app better :)",
description = "It looks like that you're enjoying Ivy Wallet! Feel free join our invite-only Ivy Telegram Community and make our app better :)",
title = "Ivy Community",
cta = "Join now",
ctaIcon = R.drawable.ic_telegram_24dp,
backgroundColor = Blue,
background = Gradient.solid(Blue),
hasDismiss = true,
onAction = { navigation, _, _ ->
navigation.navigateTo(Paywall(paywallReason = null))
}
)

fun buyLifetimeOfferCard() = CustomerJourneyCardData(
id = "buy_lifetime_offer",
condition = { trnCount, _, ivyContext ->
trnCount >= 16 && !ivyContext.isPremium
},
title = "Lifetime Premium",
description = "We understand that owning something is better than just paying a subscription for it." +
" That's why we've included this special limited lifetime offer only for our best users like you.",
cta = "Get Lifetime Premium",
ctaIcon = R.drawable.ic_custom_crown_s,
backgroundColor = Ivy,
hasDismiss = true,
onAction = { navigation, _, _ ->
navigation.navigateTo(Paywall(paywallReason = null))
onAction = { _, _, rootActivity ->
rootActivity.openUrlInBrowser(Constants.URL_IVY_TELEGRAM_INVITE)
}
)

Expand All @@ -222,7 +207,7 @@ class CustomerJourneyLogic(
description = stringRes(R.string.make_a_report_description),
cta = stringRes(R.string.make_a_report),
ctaIcon = R.drawable.ic_statistics_xs,
backgroundColor = Green2,
background = Gradient.solid(Green2),
hasDismiss = true,
onAction = { navigation, _, _ ->
navigation.navigateTo(Report)
Expand All @@ -238,7 +223,7 @@ class CustomerJourneyLogic(
description = stringRes(R.string.make_ivy_wallet_better_description),
cta = stringRes(R.string.rate_us_on_google_play),
ctaIcon = R.drawable.ic_custom_star_s,
backgroundColor = GreenLight,
background = Gradient.solid(GreenLight),
hasDismiss = true,
onAction = { _, _, ivyActivity ->
ivyActivity.reviewIvyWallet(dismissReviewCard = true)
Expand All @@ -254,7 +239,7 @@ class CustomerJourneyLogic(
description = stringRes(R.string.we_need_your_help_description),
cta = stringRes(R.string.share_ivy_wallet),
ctaIcon = R.drawable.ic_custom_family_s,
backgroundColor = Purple2,
background = Gradient.solid(Purple2),
hasDismiss = true,
onAction = { _, _, ivyActivity ->
ivyActivity.shareIvyWallet()
Expand All @@ -270,12 +255,29 @@ class CustomerJourneyLogic(
description = stringRes(R.string.ivy_wallet_is_opensource_description),
cta = stringRes(R.string.contribute),
ctaIcon = R.drawable.github_logo,
backgroundColor = Blue3,
background = Gradient.solid(Blue3),
hasDismiss = true,
onAction = { _, _, ivyActivity ->
ivyActivity.openUrlInBrowser(Constants.URL_IVY_WALLET_REPO)
}
)

fun donateIvyWallet() = CustomerJourneyCardData(
id = "donate_ivy_wallet",
condition = { trnCount, _, _ ->
trnCount >= 30
},
title = "Support Ivy Wallet",
description = "It seems like you enjoy free and open-source software. We too! " +
"That's why we opened a donations channel to sustain and improve our small project.",
cta = "Donate",
ctaIcon = R.drawable.ic_donate_crown,
background = Gradient.from(SunsetNight),
hasDismiss = true,
onAction = { nav, _, _ ->
nav.navigateTo(DonateScreen)
}
)
}
}

Expand Down Expand Up @@ -377,10 +379,10 @@ private fun PreviewJoinTelegram() {

@Preview
@Composable
private fun PreviewBuyLifetimeOffer() {
private fun PreviewMakeReport() {
IvyWalletComponentPreview {
CustomerJourneyCard(
cardData = CustomerJourneyLogic.buyLifetimeOfferCard(),
cardData = CustomerJourneyLogic.makeReportCard(),
onCTA = { },
onDismiss = {}
)
Expand All @@ -389,10 +391,10 @@ private fun PreviewBuyLifetimeOffer() {

@Preview
@Composable
private fun PreviewMakeReport() {
private fun PreviewRateUs_2() {
IvyWalletComponentPreview {
CustomerJourneyCard(
cardData = CustomerJourneyLogic.makeReportCard(),
cardData = CustomerJourneyLogic.rateUsCard_2(),
onCTA = { },
onDismiss = {}
)
Expand All @@ -401,10 +403,10 @@ private fun PreviewMakeReport() {

@Preview
@Composable
private fun PreviewRateUs_2() {
private fun PreviewShaveIvyWallet_2() {
IvyWalletComponentPreview {
CustomerJourneyCard(
cardData = CustomerJourneyLogic.rateUsCard_2(),
cardData = CustomerJourneyLogic.shareIvyWalletCard_2(),
onCTA = { },
onDismiss = {}
)
Expand All @@ -413,10 +415,10 @@ private fun PreviewRateUs_2() {

@Preview
@Composable
private fun PreviewShaveIvyWallet_2() {
private fun PreviewIvyWallet_isOpenSource() {
IvyWalletComponentPreview {
CustomerJourneyCard(
cardData = CustomerJourneyLogic.shareIvyWalletCard_2(),
cardData = CustomerJourneyLogic.ivyWalletIsOpenSource(),
onCTA = { },
onDismiss = {}
)
Expand All @@ -425,10 +427,10 @@ private fun PreviewShaveIvyWallet_2() {

@Preview
@Composable
private fun PreviewIvyWallet_isOpenSource() {
private fun PreviewDonateCard() {
IvyWalletComponentPreview {
CustomerJourneyCard(
cardData = CustomerJourneyLogic.ivyWalletIsOpenSource(),
cardData = CustomerJourneyLogic.donateIvyWallet(),
onCTA = { },
onDismiss = {}
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.ivy.wallet.domain.deprecated.logic.model

import androidx.annotation.DrawableRes
import androidx.compose.ui.graphics.Color
import com.ivy.frp.view.navigation.Navigation
import com.ivy.wallet.ui.IvyWalletCtx
import com.ivy.wallet.ui.RootActivity
import com.ivy.wallet.ui.theme.Gradient

data class CustomerJourneyCardData(
val id: String,
Expand All @@ -17,6 +17,6 @@ data class CustomerJourneyCardData(

val hasDismiss: Boolean = true,

val backgroundColor: Color,
val background: Gradient,
val onAction: (Navigation, IvyWalletCtx, RootActivity) -> Unit
)
16 changes: 8 additions & 8 deletions app/src/main/java/com/ivy/wallet/ui/home/CustomerJourney.kt
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ fun CustomerJourneyCard(
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 16.dp)
.drawColoredShadow(cardData.backgroundColor)
.background(cardData.backgroundColor, UI.shapes.r3)
.drawColoredShadow(cardData.background.startColor)
.background(cardData.background.asHorizontalBrush(), UI.shapes.r3)
.clip(UI.shapes.r3)
.clickable {
onCTA()
Expand All @@ -86,7 +86,7 @@ fun CustomerJourneyCard(
text = cardData.title,
style = UI.typo.b1.style(
fontWeight = FontWeight.ExtraBold,
color = findContrastTextColor(cardData.backgroundColor)
color = findContrastTextColor(cardData.background.startColor)
)
)

Expand All @@ -98,7 +98,7 @@ fun CustomerJourneyCard(
}
.padding(8.dp), //enlarge click area
icon = R.drawable.ic_dismiss,
tint = cardData.backgroundColor.dynamicContrast(),
tint = cardData.background.startColor.dynamicContrast(),
contentDescription = "prompt_dismiss",
)

Expand All @@ -115,7 +115,7 @@ fun CustomerJourneyCard(
text = cardData.description,
style = UI.typo.b2.style(
fontWeight = FontWeight.Medium,
color = findContrastTextColor(cardData.backgroundColor)
color = findContrastTextColor(cardData.background.startColor)
)
)

Expand All @@ -129,13 +129,13 @@ fun CustomerJourneyCard(
text = cardData.cta,
shadowAlpha = 0f,
iconStart = cardData.ctaIcon,
iconTint = cardData.backgroundColor,
iconTint = cardData.background.startColor,
textStyle = UI.typo.b2.style(
color = cardData.backgroundColor,
color = cardData.background.startColor,
fontWeight = FontWeight.Bold
),
padding = 8.dp,
backgroundGradient = Gradient.solid(findContrastTextColor(cardData.backgroundColor))
backgroundGradient = Gradient.solid(findContrastTextColor(cardData.background.startColor))
) {
onCTA()
}
Expand Down

0 comments on commit c01c63c

Please sign in to comment.