From 1d89776eb733150bf57bb5c17cbdd5d5316d44c3 Mon Sep 17 00:00:00 2001 From: Iliyan Germanov Date: Thu, 9 Dec 2021 01:19:53 +0200 Subject: [PATCH 1/6] Make swiping between "Home" and "Accounts" tab more sensitive --- app/src/main/java/com/ivy/wallet/ui/accounts/AccountsTab.kt | 2 +- app/src/main/java/com/ivy/wallet/ui/home/HomeTab.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/ivy/wallet/ui/accounts/AccountsTab.kt b/app/src/main/java/com/ivy/wallet/ui/accounts/AccountsTab.kt index eb1f4d3179..605124f5ce 100644 --- a/app/src/main/java/com/ivy/wallet/ui/accounts/AccountsTab.kt +++ b/app/src/main/java/com/ivy/wallet/ui/accounts/AccountsTab.kt @@ -76,7 +76,7 @@ private fun BoxWithConstraintsScope.UI( .navigationBarsPadding() .verticalScroll(rememberScrollState()) .horizontalSwipeListener( - sensitivity = 250, + sensitivity = 200, onSwipeLeft = { ivyContext.selectMainTab(MainTab.HOME) }, diff --git a/app/src/main/java/com/ivy/wallet/ui/home/HomeTab.kt b/app/src/main/java/com/ivy/wallet/ui/home/HomeTab.kt index 3fec947157..8aff881ed7 100644 --- a/app/src/main/java/com/ivy/wallet/ui/home/HomeTab.kt +++ b/app/src/main/java/com/ivy/wallet/ui/home/HomeTab.kt @@ -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 From 6f0acb94b63c60fabd2527d56498366acd4eada2 Mon Sep 17 00:00:00 2001 From: Swapnil Kadlag Date: Sat, 1 Jan 2022 12:25:20 +0530 Subject: [PATCH 2/6] Fixed font baseline alignment using baseline shift instead of padding workaround --- .../wallet/ui/csvimport/flow/ImportFrom.kt | 2 +- .../wallet/ui/edit/core/EditBottomSheet.kt | 8 ++-- .../com/ivy/wallet/ui/home/CustomerJourney.kt | 3 +- .../com/ivy/wallet/ui/home/HomeMoreMenu.kt | 3 +- .../ui/onboarding/components/Suggestions.kt | 4 +- .../ui/onboarding/steps/OnboardingAccounts.kt | 2 +- .../onboarding/steps/OnboardingCategories.kt | 2 +- .../onboarding/steps/OnboardingSplashLogin.kt | 5 +-- .../com/ivy/wallet/ui/paywall/PlansSheet.kt | 3 +- .../ui/planned/list/PlannedPaymentCard.kt | 6 +-- .../ivy/wallet/ui/reports/FilterOverlay.kt | 14 +++---- .../com/ivy/wallet/ui/reports/ReportScreen.kt | 3 +- .../com/ivy/wallet/ui/search/SearchScreen.kt | 5 +-- .../ivy/wallet/ui/settings/SettingsScreen.kt | 2 +- .../com/ivy/wallet/ui/theme/IvyTypography.kt | 38 +++++++++++++------ .../wallet/ui/theme/components/BalanceRow.kt | 3 -- .../ui/theme/components/IvyBorderButton.kt | 6 +-- .../wallet/ui/theme/components/IvyButton.kt | 6 +-- .../wallet/ui/theme/components/IvyCheckbox.kt | 1 - .../ui/theme/components/IvyOutlinedButton.kt | 10 ++--- .../theme/components/OnboardingComponents.kt | 5 +-- .../ui/theme/modal/ChoosePeriodModal.kt | 6 +-- .../theme/modal/edit/ChooseCategoryModal.kt | 5 +-- .../ui/theme/transaction/TransactionCard.kt | 10 ++--- .../transaction/TransactionSectionDivider.kt | 2 - 25 files changed, 65 insertions(+), 89 deletions(-) diff --git a/app/src/main/java/com/ivy/wallet/ui/csvimport/flow/ImportFrom.kt b/app/src/main/java/com/ivy/wallet/ui/csvimport/flow/ImportFrom.kt index 3c3e357876..ef77245205 100644 --- a/app/src/main/java/com/ivy/wallet/ui/csvimport/flow/ImportFrom.kt +++ b/app/src/main/java/com/ivy/wallet/ui/csvimport/flow/ImportFrom.kt @@ -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)) diff --git a/app/src/main/java/com/ivy/wallet/ui/edit/core/EditBottomSheet.kt b/app/src/main/java/com/ivy/wallet/ui/edit/core/EditBottomSheet.kt index 84fd471748..b4788fec5f 100644 --- a/app/src/main/java/com/ivy/wallet/ui/edit/core/EditBottomSheet.kt +++ b/app/src/main/java/com/ivy/wallet/ui/edit/core/EditBottomSheet.kt @@ -328,8 +328,7 @@ private fun TransferRowMini( color = fromContrastColor, fontWeight = FontWeight.ExtraBold ), - paddingTop = 10.dp, - paddingBottom = 12.dp + padding = 10.dp, ) { onSetExpanded() } @@ -350,8 +349,7 @@ private fun TransferRowMini( color = toContrastColor, fontWeight = FontWeight.ExtraBold ), - paddingTop = 10.dp, - paddingBottom = 12.dp + padding = 10.dp, ) { onSetExpanded() } @@ -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, diff --git a/app/src/main/java/com/ivy/wallet/ui/home/CustomerJourney.kt b/app/src/main/java/com/ivy/wallet/ui/home/CustomerJourney.kt index b210917114..8346ca3f74 100644 --- a/app/src/main/java/com/ivy/wallet/ui/home/CustomerJourney.kt +++ b/app/src/main/java/com/ivy/wallet/ui/home/CustomerJourney.kt @@ -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() diff --git a/app/src/main/java/com/ivy/wallet/ui/home/HomeMoreMenu.kt b/app/src/main/java/com/ivy/wallet/ui/home/HomeMoreMenu.kt index 7a9b4020b1..9dcf3871c2 100644 --- a/app/src/main/java/com/ivy/wallet/ui/home/HomeMoreMenu.kt +++ b/app/src/main/java/com/ivy/wallet/ui/home/HomeMoreMenu.kt @@ -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( diff --git a/app/src/main/java/com/ivy/wallet/ui/onboarding/components/Suggestions.kt b/app/src/main/java/com/ivy/wallet/ui/onboarding/components/Suggestions.kt index fbdb662145..bc85c93c4e 100644 --- a/app/src/main/java/com/ivy/wallet/ui/onboarding/components/Suggestions.kt +++ b/app/src/main/java/com/ivy/wallet/ui/onboarding/components/Suggestions.kt @@ -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 @@ -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, diff --git a/app/src/main/java/com/ivy/wallet/ui/onboarding/steps/OnboardingAccounts.kt b/app/src/main/java/com/ivy/wallet/ui/onboarding/steps/OnboardingAccounts.kt index e245dfb29f..89cdcd2c7e 100644 --- a/app/src/main/java/com/ivy/wallet/ui/onboarding/steps/OnboardingAccounts.kt +++ b/app/src/main/java/com/ivy/wallet/ui/onboarding/steps/OnboardingAccounts.kt @@ -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( diff --git a/app/src/main/java/com/ivy/wallet/ui/onboarding/steps/OnboardingCategories.kt b/app/src/main/java/com/ivy/wallet/ui/onboarding/steps/OnboardingCategories.kt index d912dad579..ddcc486e47 100644 --- a/app/src/main/java/com/ivy/wallet/ui/onboarding/steps/OnboardingCategories.kt +++ b/app/src/main/java/com/ivy/wallet/ui/onboarding/steps/OnboardingCategories.kt @@ -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 diff --git a/app/src/main/java/com/ivy/wallet/ui/onboarding/steps/OnboardingSplashLogin.kt b/app/src/main/java/com/ivy/wallet/ui/onboarding/steps/OnboardingSplashLogin.kt index 8a7839100f..aacae80e30 100644 --- a/app/src/main/java/com/ivy/wallet/ui/onboarding/steps/OnboardingSplashLogin.kt +++ b/app/src/main/java/com/ivy/wallet/ui/onboarding/steps/OnboardingSplashLogin.kt @@ -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, diff --git a/app/src/main/java/com/ivy/wallet/ui/paywall/PlansSheet.kt b/app/src/main/java/com/ivy/wallet/ui/paywall/PlansSheet.kt index 1257be3fe8..9ff5e449aa 100644 --- a/app/src/main/java/com/ivy/wallet/ui/paywall/PlansSheet.kt +++ b/app/src/main/java/com/ivy/wallet/ui/paywall/PlansSheet.kt @@ -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 { diff --git a/app/src/main/java/com/ivy/wallet/ui/planned/list/PlannedPaymentCard.kt b/app/src/main/java/com/ivy/wallet/ui/planned/list/PlannedPaymentCard.kt index ea10779ad7..673f33a491 100644 --- a/app/src/main/java/com/ivy/wallet/ui/planned/list/PlannedPaymentCard.kt +++ b/app/src/main/java/com/ivy/wallet/ui/planned/list/PlannedPaymentCard.kt @@ -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( @@ -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 { diff --git a/app/src/main/java/com/ivy/wallet/ui/reports/FilterOverlay.kt b/app/src/main/java/com/ivy/wallet/ui/reports/FilterOverlay.kt index 4ea2b9220b..beb4ad019f 100644 --- a/app/src/main/java/com/ivy/wallet/ui/reports/FilterOverlay.kt +++ b/app/src/main/java/com/ivy/wallet/ui/reports/FilterOverlay.kt @@ -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!!) @@ -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() } @@ -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, @@ -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() } @@ -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() } diff --git a/app/src/main/java/com/ivy/wallet/ui/reports/ReportScreen.kt b/app/src/main/java/com/ivy/wallet/ui/reports/ReportScreen.kt index b724021875..4d2ddde555 100644 --- a/app/src/main/java/com/ivy/wallet/ui/reports/ReportScreen.kt +++ b/app/src/main/java/com/ivy/wallet/ui/reports/ReportScreen.kt @@ -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() diff --git a/app/src/main/java/com/ivy/wallet/ui/search/SearchScreen.kt b/app/src/main/java/com/ivy/wallet/ui/search/SearchScreen.kt index 4e814ca2e5..f7a10e009e 100644 --- a/app/src/main/java/com/ivy/wallet/ui/search/SearchScreen.kt +++ b/app/src/main/java/com/ivy/wallet/ui/search/SearchScreen.kt @@ -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", diff --git a/app/src/main/java/com/ivy/wallet/ui/settings/SettingsScreen.kt b/app/src/main/java/com/ivy/wallet/ui/settings/SettingsScreen.kt index 9130841ffc..87e44f484c 100644 --- a/app/src/main/java/com/ivy/wallet/ui/settings/SettingsScreen.kt +++ b/app/src/main/java/com/ivy/wallet/ui/settings/SettingsScreen.kt @@ -883,7 +883,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, diff --git a/app/src/main/java/com/ivy/wallet/ui/theme/IvyTypography.kt b/app/src/main/java/com/ivy/wallet/ui/theme/IvyTypography.kt index bccce23ca9..4f59a14775 100644 --- a/app/src/main/java/com/ivy/wallet/ui/theme/IvyTypography.kt +++ b/app/src/main/java/com/ivy/wallet/ui/theme/IvyTypography.kt @@ -6,10 +6,14 @@ import androidx.compose.ui.text.TextStyle import androidx.compose.ui.text.font.Font import androidx.compose.ui.text.font.FontFamily import androidx.compose.ui.text.font.FontWeight +import androidx.compose.ui.text.style.BaselineShift import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.sp import com.ivy.wallet.R +const val OPEN_SANS_BASELINE_SHIFT = 0.075f +const val RALEWAY_BASELINE_SHIFT = 0.2f + val OpenSans = FontFamily( Font(R.font.opensans_regular, FontWeight.Normal), Font(R.font.opensans_regular, FontWeight.Medium), @@ -33,53 +37,63 @@ val Typo = IvyTypography( h1 = TextStyle( fontFamily = RaleWay, fontWeight = FontWeight.Black, - fontSize = 42.sp + fontSize = 42.sp, + baselineShift = BaselineShift(RALEWAY_BASELINE_SHIFT), ), h2 = TextStyle( fontFamily = RaleWay, fontWeight = FontWeight.Normal, - fontSize = 32.sp + fontSize = 32.sp, + baselineShift = BaselineShift(RALEWAY_BASELINE_SHIFT), ), body1 = TextStyle( fontFamily = RaleWay, fontWeight = FontWeight.ExtraBold, - fontSize = 20.sp + fontSize = 20.sp, + baselineShift = BaselineShift(RALEWAY_BASELINE_SHIFT), ), body2 = TextStyle( fontFamily = RaleWay, fontWeight = FontWeight.Medium, - fontSize = 16.sp + fontSize = 16.sp, + baselineShift = BaselineShift(RALEWAY_BASELINE_SHIFT), ), caption = TextStyle( fontFamily = RaleWay, fontWeight = FontWeight.ExtraBold, - fontSize = 12.sp + fontSize = 12.sp, + baselineShift = BaselineShift(RALEWAY_BASELINE_SHIFT), ), numberH1 = TextStyle( fontFamily = OpenSans, fontWeight = FontWeight.Bold, - fontSize = 42.sp + fontSize = 42.sp, + baselineShift = BaselineShift(OPEN_SANS_BASELINE_SHIFT), ), numberH2 = TextStyle( fontFamily = OpenSans, fontWeight = FontWeight.Normal, - fontSize = 32.sp + fontSize = 32.sp, + baselineShift = BaselineShift(OPEN_SANS_BASELINE_SHIFT), ), numberBody1 = TextStyle( fontFamily = OpenSans, fontWeight = FontWeight.Bold, - fontSize = 20.sp + fontSize = 20.sp, + baselineShift = BaselineShift(OPEN_SANS_BASELINE_SHIFT), ), numberBody2 = TextStyle( fontFamily = OpenSans, fontWeight = FontWeight.Normal, - fontSize = 16.sp + fontSize = 16.sp, + baselineShift = BaselineShift(OPEN_SANS_BASELINE_SHIFT), ), numberCaption = TextStyle( fontFamily = OpenSans, fontWeight = FontWeight.Bold, - fontSize = 12.sp + fontSize = 12.sp, + baselineShift = BaselineShift(OPEN_SANS_BASELINE_SHIFT), ), ) @@ -103,9 +117,9 @@ fun TextStyle.colorAs(color: Color) = this.copy(color = color) fun TextStyle.style( color: Color = IvyTheme.colors.pureInverse, fontWeight: FontWeight = FontWeight.Bold, - textAlign: TextAlign = TextAlign.Start + textAlign: TextAlign = TextAlign.Start, ) = this.copy( color = color, fontWeight = fontWeight, - textAlign = textAlign + textAlign = textAlign, ) \ No newline at end of file diff --git a/app/src/main/java/com/ivy/wallet/ui/theme/components/BalanceRow.kt b/app/src/main/java/com/ivy/wallet/ui/theme/components/BalanceRow.kt index 3249cc3513..41492248b9 100644 --- a/app/src/main/java/com/ivy/wallet/ui/theme/components/BalanceRow.kt +++ b/app/src/main/java/com/ivy/wallet/ui/theme/components/BalanceRow.kt @@ -180,9 +180,6 @@ private fun Currency( textColor: Color, ) { Text( - modifier = Modifier.padding( - bottom = if (currencyFontSize == null || currencyFontSize.value > 30) 4.dp else 2.dp - ), text = currency, style = if (currencyFontSize == null) { Typo.h1.style( diff --git a/app/src/main/java/com/ivy/wallet/ui/theme/components/IvyBorderButton.kt b/app/src/main/java/com/ivy/wallet/ui/theme/components/IvyBorderButton.kt index c08a3d9264..8e751d0b51 100644 --- a/app/src/main/java/com/ivy/wallet/ui/theme/components/IvyBorderButton.kt +++ b/app/src/main/java/com/ivy/wallet/ui/theme/components/IvyBorderButton.kt @@ -39,8 +39,7 @@ fun IvyBorderButton( enabled: Boolean = true, wrapContentMode: Boolean = true, - paddingTop: Dp = 12.dp, - paddingBottom: Dp = 14.dp, //center hack + padding: Dp = 12.dp, onClick: () -> Unit ) { Row( @@ -80,8 +79,7 @@ fun IvyBorderButton( Text( modifier = Modifier.padding( - top = paddingTop, - bottom = paddingBottom + vertical = padding, ), text = text, style = textStyle diff --git a/app/src/main/java/com/ivy/wallet/ui/theme/components/IvyButton.kt b/app/src/main/java/com/ivy/wallet/ui/theme/components/IvyButton.kt index 8ebf5dc682..9dc709e4fc 100644 --- a/app/src/main/java/com/ivy/wallet/ui/theme/components/IvyButton.kt +++ b/app/src/main/java/com/ivy/wallet/ui/theme/components/IvyButton.kt @@ -39,8 +39,7 @@ fun IvyButton( shadowAlpha: Float = 0.15f, wrapContentMode: Boolean = true, hasGlow: Boolean = true, - paddingTop: Dp = 12.dp, - paddingBottom: Dp = 14.dp, //center hack + padding: Dp = 12.dp, iconEdgePadding: Dp = 12.dp, onClick: () -> Unit ) { @@ -92,8 +91,7 @@ fun IvyButton( Text( modifier = Modifier.padding( - top = paddingTop, - bottom = paddingBottom + vertical = padding, ), text = text, style = textStyle diff --git a/app/src/main/java/com/ivy/wallet/ui/theme/components/IvyCheckbox.kt b/app/src/main/java/com/ivy/wallet/ui/theme/components/IvyCheckbox.kt index 77e7c2fb34..03ed994da5 100644 --- a/app/src/main/java/com/ivy/wallet/ui/theme/components/IvyCheckbox.kt +++ b/app/src/main/java/com/ivy/wallet/ui/theme/components/IvyCheckbox.kt @@ -66,7 +66,6 @@ fun IvyCheckboxWithText( Spacer(modifier = Modifier.width(4.dp)) Text( - modifier = Modifier.padding(bottom = 2.dp), text = text, style = Typo.body2.style( color = IvyTheme.colors.pureInverse, diff --git a/app/src/main/java/com/ivy/wallet/ui/theme/components/IvyOutlinedButton.kt b/app/src/main/java/com/ivy/wallet/ui/theme/components/IvyOutlinedButton.kt index 87e7f51c9d..868a4a44a7 100644 --- a/app/src/main/java/com/ivy/wallet/ui/theme/components/IvyOutlinedButton.kt +++ b/app/src/main/java/com/ivy/wallet/ui/theme/components/IvyOutlinedButton.kt @@ -28,8 +28,7 @@ fun IvyOutlinedButton( iconTint: Color = IvyTheme.colors.pureInverse, borderColor: Color = IvyTheme.colors.medium, textColor: Color = IvyTheme.colors.pureInverse, - paddingTop: Dp = 10.dp, - paddingBottom: Dp = 14.dp, + padding: Dp = 12.dp, onClick: () -> Unit, ) { Row( @@ -58,7 +57,7 @@ fun IvyOutlinedButton( } Text( - modifier = Modifier.padding(top = paddingTop, bottom = paddingBottom), + modifier = Modifier.padding(vertical = padding), text = text, style = Typo.body2.style( fontWeight = FontWeight.Bold, @@ -79,8 +78,7 @@ fun IvyOutlinedButtonFillMaxWidth( iconTint: Color = IvyTheme.colors.pureInverse, borderColor: Color = IvyTheme.colors.medium, textColor: Color = IvyTheme.colors.pureInverse, - paddingTop: Dp = 14.dp, - paddingBottom: Dp = 18.dp, + padding: Dp = 16.dp, onClick: () -> Unit, ) { Row( @@ -108,7 +106,7 @@ fun IvyOutlinedButtonFillMaxWidth( Spacer(Modifier.weight(1f)) Text( - modifier = Modifier.padding(top = paddingTop, bottom = paddingBottom), + modifier = Modifier.padding(vertical = padding), text = text, style = Typo.body2.style( fontWeight = FontWeight.Bold, diff --git a/app/src/main/java/com/ivy/wallet/ui/theme/components/OnboardingComponents.kt b/app/src/main/java/com/ivy/wallet/ui/theme/components/OnboardingComponents.kt index 75bcf0b3b8..dc754b4a91 100644 --- a/app/src/main/java/com/ivy/wallet/ui/theme/components/OnboardingComponents.kt +++ b/app/src/main/java/com/ivy/wallet/ui/theme/components/OnboardingComponents.kt @@ -67,10 +67,7 @@ fun OnboardingButton( } Text( - modifier = Modifier.padding( - top = 14.dp, - bottom = 18.dp //center hack - ), + modifier = Modifier.padding(vertical = 16.dp), text = text, style = Typo.body2.style( color = textColor, diff --git a/app/src/main/java/com/ivy/wallet/ui/theme/modal/ChoosePeriodModal.kt b/app/src/main/java/com/ivy/wallet/ui/theme/modal/ChoosePeriodModal.kt index 6161217ea9..4a75b275f4 100644 --- a/app/src/main/java/com/ivy/wallet/ui/theme/modal/ChoosePeriodModal.kt +++ b/app/src/main/java/com/ivy/wallet/ui/theme/modal/ChoosePeriodModal.kt @@ -204,8 +204,7 @@ private fun MonthButton( } .padding(horizontal = 24.dp) .padding( - top = 10.dp, - bottom = 14.dp + vertical = 12.dp, ), text = text, style = Typo.body2.style( @@ -310,8 +309,7 @@ private fun IntervalFromToDate( Text( modifier = Modifier .padding( - top = 14.dp, - bottom = 18.dp + vertical = 16.dp, ), text = if (border == IntervalBorder.FROM) "From" else "To", style = Typo.body2.style( diff --git a/app/src/main/java/com/ivy/wallet/ui/theme/modal/edit/ChooseCategoryModal.kt b/app/src/main/java/com/ivy/wallet/ui/theme/modal/edit/ChooseCategoryModal.kt index 3e9f618376..6a42c1bca2 100644 --- a/app/src/main/java/com/ivy/wallet/ui/theme/modal/edit/ChooseCategoryModal.kt +++ b/app/src/main/java/com/ivy/wallet/ui/theme/modal/edit/ChooseCategoryModal.kt @@ -200,7 +200,7 @@ private fun CategoryButton( Text( modifier = Modifier - .padding(top = 10.dp, bottom = 14.dp) + .padding(vertical = 12.dp) .padding( start = if (selected) 12.dp else 12.dp, end = if (selected) 20.dp else 24.dp @@ -246,8 +246,7 @@ fun AddNewButton( fontWeight = FontWeight.Bold ), iconTint = IvyTheme.colors.pureInverse, - paddingTop = 10.dp, - paddingBottom = 12.dp, + padding = 10.dp, onClick = onClick ) } diff --git a/app/src/main/java/com/ivy/wallet/ui/theme/transaction/TransactionCard.kt b/app/src/main/java/com/ivy/wallet/ui/theme/transaction/TransactionCard.kt index fab653dff6..d5e72cc5a0 100644 --- a/app/src/main/java/com/ivy/wallet/ui/theme/transaction/TransactionCard.kt +++ b/app/src/main/java/com/ivy/wallet/ui/theme/transaction/TransactionCard.kt @@ -181,8 +181,7 @@ private fun TransactionHeaderRow( color = findContrastTextColor(category.color.toComposeColor()), fontWeight = FontWeight.ExtraBold ), - paddingTop = 8.dp, - paddingBottom = 10.dp, + padding = 8.dp, iconEdgePadding = 10.dp ) { ivyContext.navigateTo( @@ -211,8 +210,7 @@ private fun TransactionHeaderRow( color = IvyTheme.colors.pureInverse, fontWeight = FontWeight.ExtraBold ), - paddingTop = 8.dp, - paddingBottom = 10.dp, + padding = 8.dp, iconEdgePadding = 10.dp ) { account?.let { @@ -251,7 +249,7 @@ private fun TransferHeader( Text( modifier = Modifier - .padding(top = 8.dp, bottom = 10.dp), + .padding(vertical = 8.dp), text = account?.name ?: "null", style = Typo.caption.style( fontWeight = FontWeight.ExtraBold, @@ -275,7 +273,7 @@ private fun TransferHeader( Text( modifier = Modifier - .padding(top = 8.dp, bottom = 10.dp), + .padding(vertical = 8.dp), text = toAccount?.name ?: "null", style = Typo.caption.style( fontWeight = FontWeight.ExtraBold, diff --git a/app/src/main/java/com/ivy/wallet/ui/theme/transaction/TransactionSectionDivider.kt b/app/src/main/java/com/ivy/wallet/ui/theme/transaction/TransactionSectionDivider.kt index 7243fa9e7f..375ea39eac 100644 --- a/app/src/main/java/com/ivy/wallet/ui/theme/transaction/TransactionSectionDivider.kt +++ b/app/src/main/java/com/ivy/wallet/ui/theme/transaction/TransactionSectionDivider.kt @@ -104,7 +104,6 @@ private fun SectionDividerIncomeExpenseRow( ) ) Text( - modifier = Modifier.padding(bottom = 2.dp), text = " expenses", style = Typo.caption.style( fontWeight = FontWeight.Normal, @@ -131,7 +130,6 @@ private fun SectionDividerIncomeExpenseRow( ) ) Text( - modifier = Modifier.padding(bottom = 2.dp), text = " income", style = Typo.caption.style( fontWeight = FontWeight.Normal, From af72b08f2d88004d51beff55420aac3eca278333 Mon Sep 17 00:00:00 2001 From: Swapnil Kadlag Date: Sat, 1 Jan 2022 13:37:56 +0530 Subject: [PATCH 3/6] Replaced top/bottom padding with vertical padding for Account button in EditBottomSheet. --- .../main/java/com/ivy/wallet/ui/edit/core/EditBottomSheet.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/com/ivy/wallet/ui/edit/core/EditBottomSheet.kt b/app/src/main/java/com/ivy/wallet/ui/edit/core/EditBottomSheet.kt index b4788fec5f..14b3c878ff 100644 --- a/app/src/main/java/com/ivy/wallet/ui/edit/core/EditBottomSheet.kt +++ b/app/src/main/java/com/ivy/wallet/ui/edit/core/EditBottomSheet.kt @@ -530,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, From b5338b33896a83ee0a6ac448488b578c4f710947 Mon Sep 17 00:00:00 2001 From: Iliyan Germanov Date: Sun, 2 Jan 2022 22:30:15 +0200 Subject: [PATCH 4/6] Fix broken UI tests --- .../com/ivy/wallet/compose/scenario/PlannedPaymentsTest.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/androidTest/java/com/ivy/wallet/compose/scenario/PlannedPaymentsTest.kt b/app/src/androidTest/java/com/ivy/wallet/compose/scenario/PlannedPaymentsTest.kt index 84257e4f85..fad385352e 100644 --- a/app/src/androidTest/java/com/ivy/wallet/compose/scenario/PlannedPaymentsTest.kt +++ b/app/src/androidTest/java/com/ivy/wallet/compose/scenario/PlannedPaymentsTest.kt @@ -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" ) @@ -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" ) From badb0d0f77ea7e71c0d00a858e8f881a0689296f Mon Sep 17 00:00:00 2001 From: Iliyan Germanov Date: Mon, 3 Jan 2022 14:47:39 +0200 Subject: [PATCH 5/6] Implement option to delete all user data --- .../java/com/ivy/wallet/network/RestClient.kt | 1 + .../ivy/wallet/network/service/NukeService.kt | 8 +++ .../ivy/wallet/ui/settings/SettingsScreen.kt | 57 ++++++++++++++++--- .../wallet/ui/settings/SettingsViewModel.kt | 11 ++++ 4 files changed, 69 insertions(+), 8 deletions(-) create mode 100644 app/src/main/java/com/ivy/wallet/network/service/NukeService.kt diff --git a/app/src/main/java/com/ivy/wallet/network/RestClient.kt b/app/src/main/java/com/ivy/wallet/network/RestClient.kt index 9f268f1668..71ad4e3eee 100644 --- a/app/src/main/java/com/ivy/wallet/network/RestClient.kt +++ b/app/src/main/java/com/ivy/wallet/network/RestClient.kt @@ -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) } } \ No newline at end of file diff --git a/app/src/main/java/com/ivy/wallet/network/service/NukeService.kt b/app/src/main/java/com/ivy/wallet/network/service/NukeService.kt new file mode 100644 index 0000000000..4cd7928d00 --- /dev/null +++ b/app/src/main/java/com/ivy/wallet/network/service/NukeService.kt @@ -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() +} \ No newline at end of file diff --git a/app/src/main/java/com/ivy/wallet/ui/settings/SettingsScreen.kt b/app/src/main/java/com/ivy/wallet/ui/settings/SettingsScreen.kt index 87e44f484c..339d1cbf58 100644 --- a/app/src/main/java/com/ivy/wallet/ui/settings/SettingsScreen.kt +++ b/app/src/main/java/com/ivy/wallet/ui/settings/SettingsScreen.kt @@ -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 @@ -93,7 +90,8 @@ fun BoxWithConstraintsScope.SettingsScreen(screen: Screen.Settings) { title = title, body = body ) - } + }, + onDeleteAllUserData = viewModel::deleteAllUserData ) } @@ -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() @@ -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 } @@ -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 @@ -946,7 +986,8 @@ private fun CurrencyButton( @Composable private fun SettingsSectionDivider( - text: String + text: String, + color: Color = Gray ) { Spacer(Modifier.height(32.dp)) @@ -954,7 +995,7 @@ private fun SettingsSectionDivider( modifier = Modifier.padding(start = 32.dp), text = text, style = Typo.body2.style( - color = Gray, + color = color, fontWeight = FontWeight.Bold ) ) diff --git a/app/src/main/java/com/ivy/wallet/ui/settings/SettingsViewModel.kt b/app/src/main/java/com/ivy/wallet/ui/settings/SettingsViewModel.kt index ef48a4ba07..48ef09ebbd 100644 --- a/app/src/main/java/com/ivy/wallet/ui/settings/SettingsViewModel.kt +++ b/app/src/main/java/com/ivy/wallet/ui/settings/SettingsViewModel.kt @@ -273,4 +273,15 @@ class SettingsViewModel @Inject constructor( TestIdlingResource.decrement() } } + + fun deleteAllUserData() { + viewModelScope.launch { + try { + restClient.nukeService.deleteAllUserData() + } catch (e: Exception) { + e.printStackTrace() + } + logout() + } + } } \ No newline at end of file From 32d36e63e88b09a6ae8909ca53f70b104ce27544 Mon Sep 17 00:00:00 2001 From: Iliyan Germanov Date: Mon, 3 Jan 2022 14:49:52 +0200 Subject: [PATCH 6/6] Bump version --- .../src/main/java/com/ivy/wallet/buildsrc/dependencies.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/buildSrc/src/main/java/com/ivy/wallet/buildsrc/dependencies.kt b/buildSrc/src/main/java/com/ivy/wallet/buildsrc/dependencies.kt index e140f6e5fc..26cc667dd5 100644 --- a/buildSrc/src/main/java/com/ivy/wallet/buildsrc/dependencies.kt +++ b/buildSrc/src/main/java/com/ivy/wallet/buildsrc/dependencies.kt @@ -21,8 +21,8 @@ object Libs { object Project { //Version - const val versionName = "2.3.2-halley" - const val versionCode = 92 + const val versionName = "2.3.3-halley" + const val versionCode = 93 //Compile SDK & Build Tools const val compileSdkVersion = 31