Skip to content
This repository has been archived by the owner on Nov 5, 2024. It is now read-only.

GitHub backups #2510

Merged
merged 5 commits into from
Aug 28, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add "GitHub backups" customer journey card
ILIYANGERMANOV committed Aug 28, 2023
commit 980c8aa1f3e7f580b962222cae7809a38479ed5b
Original file line number Diff line number Diff line change
@@ -144,7 +144,18 @@ private fun Content(
InfoButton(infoUrl = GITHUB_PAT_INFO_URL)
}

Spacer(modifier = Modifier.height(24.dp))
Spacer(modifier = Modifier.height(8.dp))
val uriHandler = LocalUriHandler.current
TextButton(
modifier = Modifier.align(Alignment.CenterHorizontally),
onClick = {
uriHandler.openUri(VIDEO_TUTORIAL_URL)
}
) {
Text(text = "Need help? Watch our video tutorial")
}

Spacer(modifier = Modifier.height(12.dp))
val enabled by viewModel.enabled.collectAsState(initial = false)
ElevatedButton(
modifier = Modifier.fillMaxWidth(),
@@ -153,7 +164,7 @@ private fun Content(
},
enabled = repoUrl.isNotBlank() && gitHubPAT.isNotBlank()
) {
Text(text = if (!enabled) "Connect" else "Update connection")
Text(text = if (!enabled) "Enable backups" else "Update connection")
}
if (enabled) {
Spacer(modifier = Modifier.height(12.dp))
@@ -214,14 +225,4 @@ private fun ColumnScope.HeaderInfo() {
style = MaterialTheme.typography.bodyMedium,
textAlign = TextAlign.Start,
)
Spacer(modifier = Modifier.height(8.dp))
val uriHandler = LocalUriHandler.current
TextButton(
modifier = Modifier.align(Alignment.CenterHorizontally),
onClick = {
uriHandler.openUri(VIDEO_TUTORIAL_URL)
}
) {
Text(text = "Need help? Watch our video tutorial")
}
}
Original file line number Diff line number Diff line change
@@ -4,16 +4,28 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.tooling.preview.Preview
import com.ivy.wallet.Constants
import com.ivy.wallet.R
import com.ivy.wallet.backup.github.ui.GitHubBackupScreen
import com.ivy.wallet.domain.data.TransactionType
import com.ivy.wallet.domain.deprecated.logic.model.CustomerJourneyCardData
import com.ivy.wallet.io.persistence.SharedPrefs
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.EditPlanned
import com.ivy.wallet.ui.IvyWalletComponentPreview
import com.ivy.wallet.ui.IvyWalletCtx
import com.ivy.wallet.ui.PieChartStatistic
import com.ivy.wallet.ui.home.CustomerJourneyCard
import com.ivy.wallet.ui.main.MainTab
import com.ivy.wallet.ui.theme.*
import com.ivy.wallet.ui.theme.Blue
import com.ivy.wallet.ui.theme.Blue3
import com.ivy.wallet.ui.theme.Gradient
import com.ivy.wallet.ui.theme.Green
import com.ivy.wallet.ui.theme.GreenLight
import com.ivy.wallet.ui.theme.Ivy
import com.ivy.wallet.ui.theme.Orange
import com.ivy.wallet.ui.theme.Red
import com.ivy.wallet.ui.theme.Red3
import com.ivy.wallet.ui.widget.AddTransactionWidgetCompact

@Deprecated("Use FP style, look into `domain.fp` package")
@@ -58,6 +70,7 @@ class CustomerJourneyLogic(
rateUsCard_2(),
joinTelegram2(),
ivyWalletIsOpenSource(),
githubBackups(),
)

fun adjustBalanceCard() = CustomerJourneyCardData(
@@ -148,7 +161,7 @@ class CustomerJourneyLogic(
fun shareIvyWalletCard() = CustomerJourneyCardData(
id = "share_ivy_wallet",
condition = { trnCount, _, _ ->
trnCount >= 14
trnCount >= 11
},
title = stringRes(R.string.share_ivy_wallet),
description = stringRes(R.string.help_us_grow),
@@ -177,10 +190,27 @@ class CustomerJourneyLogic(
}
)

fun githubBackups() = CustomerJourneyCardData(
id = "github_backups",
condition = { trnCount, _, _ ->
trnCount >= 18
},
title = "GitHub auto-backups",
description = "Keep you data safe! Ivy Wallet can perform an automatic backup" +
" of your data every day at 12:00 PM in a private GitHub repo of your choice.",
cta = "Enable",
ctaIcon = R.drawable.github_logo,
background = Gradient.solid(Blue3),
hasDismiss = true,
onAction = { nav, _, _ ->
nav.navigateTo(GitHubBackupScreen)
}
)

fun ivyWalletIsOpenSource() = CustomerJourneyCardData(
id = "open_source",
condition = { trnCount, _, _ ->
trnCount >= 18
trnCount >= 20
},
title = stringRes(R.string.ivy_wallet_is_opensource),
description = stringRes(R.string.ivy_wallet_is_opensource_description),
@@ -349,6 +379,18 @@ private fun PreviewIvyWallet_isOpenSource() {
}
}

@Preview
@Composable
private fun PreviewIvyWallet_gitHubBackups() {
IvyWalletComponentPreview {
CustomerJourneyCard(
cardData = CustomerJourneyLogic.githubBackups(),
onCTA = { },
onDismiss = {}
)
}
}