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

Bump version #75

Merged
merged 2 commits into from
Feb 24, 2024
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
8 changes: 4 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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.
Expand Down
11 changes: 0 additions & 11 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -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();
<fields>;
}

# 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
)


Expand All @@ -283,7 +286,7 @@ fun GoalInfoCard(
Spacer(modifier = Modifier.height(14.dp))

LinearProgressIndicator(
progress = { progress },
progress = { animatedProgress.value },
modifier = Modifier
.fillMaxWidth()
.height(12.dp)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -241,8 +242,6 @@ fun DWScreen(goalId: String, transactionTypeName: String, navController: NavCont
modifier = Modifier.padding(start = 8.dp, top = 2.dp)
)
}


}
}

Expand Down Expand Up @@ -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)
}
)
}
Expand All @@ -331,6 +333,9 @@ fun DWScreen(goalId: String, transactionTypeName: String, navController: NavCont
context.getString(R.string.withdraw_overflow_error)
)
}
},
onComplete = {
navigateToHome(navController, coroutineScope, showTransactionAddedAnim)
}
)
}
Expand All @@ -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)
}
}

},
Expand All @@ -367,6 +365,19 @@ fun DWScreen(goalId: String, transactionTypeName: String, navController: NavCont
}
}

private fun navigateToHome(
navController: NavController,
coroutineScope: CoroutineScope,
showTransactionAddedAnim: MutableState<Boolean>
) {
coroutineScope.launch {
showTransactionAddedAnim.value = true
delay(1100)
navController.popBackStack(DrawerScreens.Home.route, true)
navController.navigate(DrawerScreens.Home.route)
}
}

@ExperimentalMaterial3Api
@Preview
@Composable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)!!
Expand All @@ -71,14 +72,17 @@ class DWViewModel @Inject constructor(
val remainingAmount = (goal.targetAmount - goalItem.getCurrentlySavedAmount())
if (remainingAmount <= 0f) {
withContext(Dispatchers.Main) { onGoalAchieved() }
} else {
withContext(Dispatchers.Main) { onComplete() }
}
}
}

fun withdraw(
goalId: Long,
dateTime: LocalDateTime,
onWithDrawOverflow: () -> Unit
onWithDrawOverflow: () -> Unit,
onComplete: () -> Unit
) {
viewModelScope.launch(Dispatchers.IO) {
val goal = getGoalById(goalId)!!
Expand All @@ -97,6 +101,8 @@ class DWViewModel @Inject constructor(
dateTime = dateTime,
transactionType = TransactionType.Withdraw
)

withContext(Dispatchers.Main) { onComplete() }
}
}

Expand Down
7 changes: 7 additions & 0 deletions fastlane/metadata/android/en-US/changelogs/310.txt
Original file line number Diff line number Diff line change
@@ -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.
Loading