Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #380

Merged
merged 7 commits into from
Jan 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ class PlannedPaymentsTest : IvyComposeTest() {
amount = "2,000",
category = "Bills & Fees",
startDate = timeNowUTC().withDayOfMonth(1),
intervalN = 4,
intervalType = IntervalType.WEEK,
intervalN = 1,
intervalType = IntervalType.MONTH,
title = "Salary"
)

Expand Down Expand Up @@ -218,7 +218,7 @@ class PlannedPaymentsTest : IvyComposeTest() {
amount = "5,250.33",
category = "Bills & Fees",
startDate = timeNowUTC().withDayOfMonth(1),
intervalN = 28,
intervalN = 31,
intervalType = IntervalType.DAY,
title = "Salary"
)
Expand Down
1 change: 1 addition & 0 deletions app/src/main/java/com/ivy/wallet/network/RestClient.kt
Original file line number Diff line number Diff line change
Expand Up @@ -211,4 +211,5 @@ class RestClient private constructor(
retrofit.create(BankIntegrationsService::class.java)
}
val githubService: GithubService by lazy { retrofit.create(GithubService::class.java) }
val nukeService: NukeService by lazy { retrofit.create(NukeService::class.java) }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.ivy.wallet.network.service

import retrofit2.http.POST

interface NukeService {
@POST("wallet/nuke/delete-all-user-data")
suspend fun deleteAllUserData()
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ private fun BoxWithConstraintsScope.UI(
.navigationBarsPadding()
.verticalScroll(rememberScrollState())
.horizontalSwipeListener(
sensitivity = 250,
sensitivity = 200,
onSwipeLeft = {
ivyContext.selectMainTab(MainTab.HOME)
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ private fun ImportOption(
.clickable {
onImportFrom(importType)
}
.padding(top = 24.dp, bottom = 22.dp),
.padding(vertical = 24.dp),
verticalAlignment = Alignment.CenterVertically
) {
Spacer(Modifier.width(20.dp))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,7 @@ private fun TransferRowMini(
color = fromContrastColor,
fontWeight = FontWeight.ExtraBold
),
paddingTop = 10.dp,
paddingBottom = 12.dp
padding = 10.dp,
) {
onSetExpanded()
}
Expand All @@ -350,8 +349,7 @@ private fun TransferRowMini(
color = toContrastColor,
fontWeight = FontWeight.ExtraBold
),
paddingTop = 10.dp,
paddingBottom = 12.dp
padding = 10.dp,
) {
onSetExpanded()
}
Expand Down Expand Up @@ -532,7 +530,7 @@ private fun Account(
Spacer(Modifier.width(4.dp))

Text(
modifier = Modifier.padding(top = 10.dp, bottom = 12.dp),
modifier = Modifier.padding(vertical = 10.dp),
text = account.name,
style = Typo.body2.style(
color = textColor,
Expand Down Expand Up @@ -567,7 +565,7 @@ private fun AddAccount(
Spacer(Modifier.width(4.dp))

Text(
modifier = Modifier.padding(top = 10.dp, bottom = 12.dp),
modifier = Modifier.padding(vertical = 10.dp),
text = "Add account",
style = Typo.body2.style(
color = IvyTheme.colors.pureInverse,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,7 @@ fun CustomerJourneyCard(
color = cardData.backgroundColor,
fontWeight = FontWeight.Bold
),
paddingTop = 8.dp,
paddingBottom = 10.dp,
padding = 8.dp,
backgroundGradient = Gradient.solid(findContrastTextColor(cardData.backgroundColor))
) {
onCTA()
Expand Down
3 changes: 1 addition & 2 deletions app/src/main/java/com/ivy/wallet/ui/home/HomeMoreMenu.kt
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,7 @@ private fun SearchButton(

Text(
modifier = Modifier.padding(
top = 12.dp,
bottom = 14.dp
vertical = 12.dp,
),
text = "Search transactions",
style = Typo.body2.style(
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/ivy/wallet/ui/home/HomeTab.kt
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import com.ivy.wallet.ui.theme.modal.*
import com.ivy.wallet.ui.theme.transaction.TransactionsDividerLine
import com.ivy.wallet.ui.theme.transaction.transactions

private const val SWIPE_HORIZONTAL_THRESHOLD = 250
private const val SWIPE_HORIZONTAL_THRESHOLD = 200

@ExperimentalAnimationApi
@ExperimentalFoundationApi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ private fun Suggestion(
Spacer(Modifier.width(8.dp))

Text(
modifier = Modifier.padding(top = 14.dp, bottom = 18.dp),
modifier = Modifier.padding(vertical = 16.dp),
text = name,
style = Typo.body2.style(
fontWeight = FontWeight.Bold
Expand Down Expand Up @@ -113,7 +113,7 @@ private fun AddNewButton(
Spacer(Modifier.width(8.dp))

Text(
modifier = Modifier.padding(top = 14.dp, bottom = 18.dp),
modifier = Modifier.padding(vertical = 16.dp),
text = "Add new",
style = Typo.body2.style(
color = IvyTheme.colors.pure,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ fun BuyPremiumRow(

Text(
modifier = Modifier
.padding(top = 10.dp, bottom = 14.dp)
.padding(vertical = 12.dp)
.padding(start = 12.dp, end = 32.dp),
text = "Buy premium for unlimited number of $itemLabelPlural",
style = Typo.body2.style(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ private fun CategoryCard(
Text(
modifier = Modifier
.padding(start = 16.dp, end = 24.dp)
.padding(top = 22.dp, bottom = 26.dp),
.padding(vertical = 24.dp),
text = category.name,
style = Typo.body2.style(
fontWeight = FontWeight.Bold
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -465,10 +465,7 @@ private fun LoginButton(
Spacer(Modifier.width(16.dp))

Text(
modifier = Modifier.padding(
top = 18.dp,
bottom = 22.dp
),
modifier = Modifier.padding(vertical = 20.dp),
text = text,
style = Typo.body2.style(
color = textColor,
Expand Down
3 changes: 1 addition & 2 deletions app/src/main/java/com/ivy/wallet/ui/paywall/PlansSheet.kt
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,7 @@ fun BoxWithConstraintsScope.PlansSheet(
fontWeight = FontWeight.Bold
),
iconStart = R.drawable.ic_custom_crown_s,
paddingTop = 16.dp,
paddingBottom = 16.dp,
padding = 16.dp,
iconEdgePadding = 24.dp,
) {
selectedPlan?.let {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,7 @@ private fun PlannedPaymentHeaderRow(
color = findContrastTextColor(category.color.toComposeColor()),
fontWeight = FontWeight.ExtraBold
),
paddingTop = 8.dp,
paddingBottom = 10.dp,
padding = 8.dp,
iconEdgePadding = 10.dp
) {
ivyContext.navigateTo(
Expand All @@ -161,8 +160,7 @@ private fun PlannedPaymentHeaderRow(
color = IvyTheme.colors.pureInverse,
fontWeight = FontWeight.ExtraBold
),
paddingTop = 8.dp,
paddingBottom = 10.dp,
padding = 8.dp,
iconEdgePadding = 10.dp
) {
account?.let {
Expand Down
14 changes: 5 additions & 9 deletions app/src/main/java/com/ivy/wallet/ui/reports/FilterOverlay.kt
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,7 @@ fun BoxWithConstraintsScope.FilterOverlay(
text = "Apply filter",
iconStart = R.drawable.ic_filter_xs,
backgroundGradient = GradientGreen,
paddingTop = 10.dp,
paddingBottom = 12.dp
padding = 10.dp,
) {
if (localFilter != null) {
onSetFilter(localFilter!!)
Expand Down Expand Up @@ -432,8 +431,7 @@ private fun PeriodFilter(
text = filter?.period?.toDisplayLong(LocalIvyContext.current.startDayOfMonth)
?.capitalizeLocal()
?: "Select time range",
paddingTop = 12.dp,
paddingBottom = 14.dp
padding = 12.dp,
) {
onShowPeriodChooserModal()
}
Expand Down Expand Up @@ -656,7 +654,7 @@ fun ListItem(
Spacer(Modifier.width(4.dp))

Text(
modifier = Modifier.padding(top = 10.dp, bottom = 12.dp),
modifier = Modifier.padding(vertical = 10.dp),
text = text,
style = Typo.body2.style(
color = textColor,
Expand Down Expand Up @@ -841,8 +839,7 @@ private fun Keyword(
iconStart = R.drawable.ic_remove,
iconTint = Red,
borderColor = borderColor,
paddingTop = 10.dp,
paddingBottom = 12.dp
padding = 10.dp,
) {
onClick()
}
Expand All @@ -856,8 +853,7 @@ private fun AddKeywordButton(
IvyOutlinedButton(
text = text,
iconStart = R.drawable.ic_plus,
paddingTop = 10.dp,
paddingBottom = 12.dp
padding = 10.dp,
) {
onCLick()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -346,8 +346,7 @@ private fun Toolbar(
iconTint = Green,
textColor = Green,
solidBackground = true,
paddingTop = 8.dp,
paddingBottom = 10.dp,
padding = 8.dp,
iconStart = R.drawable.ic_export_csv
) {
onExport()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,7 @@ private fun SearchInput(
val searchFocus = FocusRequester()
IvyBasicTextField(
modifier = Modifier
.padding(
top = 12.dp,
bottom = 14.dp
)
.padding(vertical = 12.dp)
.focusRequester(searchFocus),
value = searchQueryTextFieldValue,
hint = "Search transactions",
Expand Down
59 changes: 50 additions & 9 deletions app/src/main/java/com/ivy/wallet/ui/settings/SettingsScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,7 @@ import com.ivy.wallet.ui.theme.components.IvyButton
import com.ivy.wallet.ui.theme.components.IvyIcon
import com.ivy.wallet.ui.theme.components.IvySwitch
import com.ivy.wallet.ui.theme.components.IvyToolbar
import com.ivy.wallet.ui.theme.modal.ChooseStartDateOfMonthModal
import com.ivy.wallet.ui.theme.modal.CurrencyModal
import com.ivy.wallet.ui.theme.modal.NameModal
import com.ivy.wallet.ui.theme.modal.RequestFeatureModal
import com.ivy.wallet.ui.theme.modal.*
import java.util.*

@ExperimentalFoundationApi
Expand Down Expand Up @@ -93,7 +90,8 @@ fun BoxWithConstraintsScope.SettingsScreen(screen: Screen.Settings) {
title = title,
body = body
)
}
},
onDeleteAllUserData = viewModel::deleteAllUserData
)
}

Expand All @@ -119,12 +117,16 @@ private fun BoxWithConstraintsScope.UI(
onExportToCSV: () -> Unit = {},
onSetLockApp: (Boolean) -> Unit = {},
onSetStartDateOfMonth: (Int) -> Unit = {},
onRequestFeature: (String, String) -> Unit = { _, _ -> }
onRequestFeature: (String, String) -> Unit = { _, _ -> },
onDeleteAllUserData: () -> Unit = {}
) {
var currencyModalVisible by remember { mutableStateOf(false) }
var nameModalVisible by remember { mutableStateOf(false) }
var chooseStartDateOfMonthVisible by remember { mutableStateOf(false) }
var requestFeatureModalVisible by remember { mutableStateOf(false) }
var deleteAllDataModalVisible by remember { mutableStateOf(false) }
var deleteAllDataModalFinalVisible by remember { mutableStateOf(false) }

LazyColumn(
modifier = Modifier
.fillMaxSize()
Expand Down Expand Up @@ -289,6 +291,23 @@ private fun BoxWithConstraintsScope.UI(
TCAndPrivacyPolicy()
}

item {
SettingsSectionDivider(
text = "Danger zone",
color = Red
)

Spacer(Modifier.height(16.dp))

SettingsPrimaryButton(
icon = R.drawable.ic_delete,
text = "Delete all user data",
backgroundGradient = Gradient.solid(Red)
) {
deleteAllDataModalVisible = true
}
}

item {
Spacer(modifier = Modifier.height(120.dp)) //last item spacer
}
Expand Down Expand Up @@ -326,6 +345,27 @@ private fun BoxWithConstraintsScope.UI(
},
onSubmit = onRequestFeature
)

DeleteModal(
title = "Delete all user data?",
description = "WARNING! This action will delete all data for ${user?.email ?: "your account"} PERMANENTLY and you won't be able to recover it.",
visible = deleteAllDataModalVisible,
dismiss = { deleteAllDataModalVisible = false },
onDelete = {
deleteAllDataModalVisible = false
deleteAllDataModalFinalVisible = true
}
)

DeleteModal(
title = "Confirm permanent deletion for '${user?.email ?: "all of your data"}'",
description = "FINAL WARNING! After clicking \"Delete\" your data will be gone forever.",
visible = deleteAllDataModalFinalVisible,
dismiss = { deleteAllDataModalFinalVisible = false },
onDelete = {
onDeleteAllUserData()
}
)
}

@Composable
Expand Down Expand Up @@ -883,7 +923,7 @@ private fun AccountCardButton(

Text(
modifier = Modifier
.padding(top = 10.dp, bottom = 12.dp),
.padding(vertical = 10.dp),
text = text,
style = Typo.body2.style(
fontWeight = FontWeight.Bold,
Expand Down Expand Up @@ -946,15 +986,16 @@ private fun CurrencyButton(

@Composable
private fun SettingsSectionDivider(
text: String
text: String,
color: Color = Gray
) {
Spacer(Modifier.height(32.dp))

Text(
modifier = Modifier.padding(start = 32.dp),
text = text,
style = Typo.body2.style(
color = Gray,
color = color,
fontWeight = FontWeight.Bold
)
)
Expand Down
Loading