From e27f851ed16796a64d782ee766e23123cbaf786b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C9=91rry=20Shiv=C9=91m?= Date: Sat, 24 Feb 2024 18:44:57 +0530 Subject: [PATCH] Bump version (#75) And some other fixes --------- Signed-off-by: starry-shivam --- app/build.gradle | 8 ++--- app/proguard-rules.pro | 11 ------ .../info/composables/GoalInfoScreen.kt | 7 ++-- .../ui/screens/input/composables/DWScreen.kt | 35 ++++++++++++------- .../screens/input/viewmodels/DWViewModel.kt | 10 ++++-- .../metadata/android/en-US/changelogs/310.txt | 7 ++++ 6 files changed, 47 insertions(+), 31 deletions(-) create mode 100644 fastlane/metadata/android/en-US/changelogs/310.txt diff --git a/app/build.gradle b/app/build.gradle index 98dece16..58cd993a 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -16,8 +16,8 @@ android { applicationId "com.starry.greenstash" minSdk 24 targetSdk 34 - versionCode 300 - versionName "3.0.0" + versionCode 310 + versionName "3.1.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" vectorDrawables { @@ -106,9 +106,9 @@ dependencies { androidTestImplementation "androidx.room:room-testing:$room_version" // Dagger - Hilt. implementation "com.google.dagger:hilt-android:$hilt_version" - implementation "androidx.hilt:hilt-navigation-compose:1.1.0" + implementation "androidx.hilt:hilt-navigation-compose:1.2.0" ksp "com.google.dagger:hilt-android-compiler:$hilt_version" - ksp "androidx.hilt:hilt-compiler:1.1.0" + ksp "androidx.hilt:hilt-compiler:1.2.0" // DataStore Preferences. implementation("androidx.datastore:datastore-preferences:1.0.0") // Gson JSON parser. diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index 4d58af0f..08dd9071 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -20,17 +20,6 @@ # hide the original source file name. #-renamesourcefileattribute SourceFile -# Keep all data classes. -# -# Rule explanation: -# 1. All data class has component1() method which returns data -# 2. All data class has at least one field. -# 3. Almost all the classes doesn’t satisfy criteria above. --keepclasseswithmembers class com.starry.greenstash.** { - public ** component1(); - ; -} - # Prevent proguard from stripping interface information from TypeAdapter, TypeAdapterFactory, # JsonSerializer, JsonDeserializer instances (so they can be used in @JsonAdapter) -keep class * implements com.google.gson.TypeAdapter diff --git a/app/src/main/java/com/starry/greenstash/ui/screens/info/composables/GoalInfoScreen.kt b/app/src/main/java/com/starry/greenstash/ui/screens/info/composables/GoalInfoScreen.kt index 1019036b..8919d55d 100644 --- a/app/src/main/java/com/starry/greenstash/ui/screens/info/composables/GoalInfoScreen.kt +++ b/app/src/main/java/com/starry/greenstash/ui/screens/info/composables/GoalInfoScreen.kt @@ -26,6 +26,7 @@ package com.starry.greenstash.ui.screens.info.composables import androidx.compose.animation.ExperimentalAnimationApi +import androidx.compose.animation.core.animateFloatAsState import androidx.compose.foundation.ExperimentalFoundationApi import androidx.compose.foundation.background import androidx.compose.foundation.layout.Arrangement @@ -233,6 +234,7 @@ fun GoalInfoCard( Utils.formatCurrency(Utils.roundDecimal(targetAmount), currencySymbol) val formattedSavedAmount = Utils.formatCurrency(Utils.roundDecimal(savedAmount), currencySymbol) + val animatedProgress = animateFloatAsState(targetValue = progress, label = "progress") Card( modifier = Modifier @@ -264,7 +266,8 @@ fun GoalInfoCard( text = formattedSavedAmount, fontWeight = FontWeight.Bold, fontSize = 38.sp, - modifier = Modifier.padding(start = 4.dp) + modifier = Modifier + .padding(start = 4.dp) ) @@ -283,7 +286,7 @@ fun GoalInfoCard( Spacer(modifier = Modifier.height(14.dp)) LinearProgressIndicator( - progress = { progress }, + progress = { animatedProgress.value }, modifier = Modifier .fillMaxWidth() .height(12.dp) diff --git a/app/src/main/java/com/starry/greenstash/ui/screens/input/composables/DWScreen.kt b/app/src/main/java/com/starry/greenstash/ui/screens/input/composables/DWScreen.kt index ce2284d3..5219936e 100644 --- a/app/src/main/java/com/starry/greenstash/ui/screens/input/composables/DWScreen.kt +++ b/app/src/main/java/com/starry/greenstash/ui/screens/input/composables/DWScreen.kt @@ -33,6 +33,7 @@ import androidx.compose.material3.TopAppBar import androidx.compose.material3.TopAppBarDefaults import androidx.compose.material3.surfaceColorAtElevation import androidx.compose.runtime.Composable +import androidx.compose.runtime.MutableState import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember @@ -69,6 +70,7 @@ import com.starry.greenstash.ui.screens.input.viewmodels.DWViewModel import com.starry.greenstash.ui.theme.greenstashFont import com.starry.greenstash.utils.Utils import com.starry.greenstash.utils.validateAmount +import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.delay import kotlinx.coroutines.launch @@ -192,9 +194,8 @@ fun DWScreen(goalId: String, transactionTypeName: String, navController: NavCont modifier = Modifier .size(280.dp) .padding(top = 24.dp), - enableMergePaths = true, - - ) + enableMergePaths = true + ) Card( modifier = Modifier @@ -241,8 +242,6 @@ fun DWScreen(goalId: String, transactionTypeName: String, navController: NavCont modifier = Modifier.padding(start = 8.dp, top = 2.dp) ) } - - } } @@ -312,11 +311,14 @@ fun DWScreen(goalId: String, transactionTypeName: String, navController: NavCont dateTime = selectedDateTime.value!!, onGoalAchieved = { coroutineScope.launch { + showTransactionAddedAnim.value = true delay(1100) withContext(Dispatchers.Main) { navController.navigate(Screens.CongratsScreen.route) } } + }, onComplete = { + navigateToHome(navController, coroutineScope, showTransactionAddedAnim) } ) } @@ -331,6 +333,9 @@ fun DWScreen(goalId: String, transactionTypeName: String, navController: NavCont context.getString(R.string.withdraw_overflow_error) ) } + }, + onComplete = { + navigateToHome(navController, coroutineScope, showTransactionAddedAnim) } ) } @@ -339,13 +344,6 @@ fun DWScreen(goalId: String, transactionTypeName: String, navController: NavCont throw IllegalArgumentException("Invalid transaction type") } } - - coroutineScope.launch { - showTransactionAddedAnim.value = true - delay(1100) - navController.popBackStack(DrawerScreens.Home.route, true) - navController.navigate(DrawerScreens.Home.route) - } } }, @@ -367,6 +365,19 @@ fun DWScreen(goalId: String, transactionTypeName: String, navController: NavCont } } +private fun navigateToHome( + navController: NavController, + coroutineScope: CoroutineScope, + showTransactionAddedAnim: MutableState +) { + coroutineScope.launch { + showTransactionAddedAnim.value = true + delay(1100) + navController.popBackStack(DrawerScreens.Home.route, true) + navController.navigate(DrawerScreens.Home.route) + } +} + @ExperimentalMaterial3Api @Preview @Composable diff --git a/app/src/main/java/com/starry/greenstash/ui/screens/input/viewmodels/DWViewModel.kt b/app/src/main/java/com/starry/greenstash/ui/screens/input/viewmodels/DWViewModel.kt index e3b52df9..16c0af83 100644 --- a/app/src/main/java/com/starry/greenstash/ui/screens/input/viewmodels/DWViewModel.kt +++ b/app/src/main/java/com/starry/greenstash/ui/screens/input/viewmodels/DWViewModel.kt @@ -51,7 +51,8 @@ class DWViewModel @Inject constructor( fun deposit( goalId: Long, dateTime: LocalDateTime, - onGoalAchieved: () -> Unit + onGoalAchieved: () -> Unit, + onComplete: () -> Unit ) { viewModelScope.launch(Dispatchers.IO) { val goal = getGoalById(goalId)!! @@ -71,6 +72,8 @@ class DWViewModel @Inject constructor( val remainingAmount = (goal.targetAmount - goalItem.getCurrentlySavedAmount()) if (remainingAmount <= 0f) { withContext(Dispatchers.Main) { onGoalAchieved() } + } else { + withContext(Dispatchers.Main) { onComplete() } } } } @@ -78,7 +81,8 @@ class DWViewModel @Inject constructor( fun withdraw( goalId: Long, dateTime: LocalDateTime, - onWithDrawOverflow: () -> Unit + onWithDrawOverflow: () -> Unit, + onComplete: () -> Unit ) { viewModelScope.launch(Dispatchers.IO) { val goal = getGoalById(goalId)!! @@ -97,6 +101,8 @@ class DWViewModel @Inject constructor( dateTime = dateTime, transactionType = TransactionType.Withdraw ) + + withContext(Dispatchers.Main) { onComplete() } } } diff --git a/fastlane/metadata/android/en-US/changelogs/310.txt b/fastlane/metadata/android/en-US/changelogs/310.txt new file mode 100644 index 00000000..2c326e61 --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/310.txt @@ -0,0 +1,7 @@ + +- Replaced the deposit/withdraw dialog with a dedicated screen for adding transactions. +- You can now set custom date and time for each transaction. +- Added an optional text field to add notes for each transaction. +- Added ability to delete individual transactions by swiping left on the transaction list. +- Removed the "Authentication Succeeded" toast message that appeared on every launch. +- Bunch of other small UI improvements and bug fixes. \ No newline at end of file