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

[65] Final Touches #71

Merged
merged 1 commit into from
Sep 18, 2023
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
4 changes: 2 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:icon="@mipmap/teira_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:roundIcon="@mipmap/teira_launcher"
android:supportsRtl="true"
android:theme="@style/Theme.Teira"
tools:targetApi="31">
Expand Down
74 changes: 74 additions & 0 deletions app/src/main/res/drawable/teira_launcher_background.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="utf-8"?>
<vector
android:height="108dp"
android:width="108dp"
android:viewportHeight="108"
android:viewportWidth="108"
xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#3DDC84"
android:pathData="M0,0h108v108h-108z"/>
<path android:fillColor="#00000000" android:pathData="M9,0L9,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,0L19,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M29,0L29,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M39,0L39,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M49,0L49,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M59,0L59,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M69,0L69,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M79,0L79,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M89,0L89,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M99,0L99,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,9L108,9"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,19L108,19"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,29L108,29"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,39L108,39"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,49L108,49"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,59L108,59"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,69L108,69"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,79L108,79"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,89L108,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,99L108,99"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,29L89,29"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,39L89,39"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,49L89,49"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,59L89,59"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,69L89,69"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,79L89,79"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M29,19L29,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M39,19L39,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M49,19L49,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M59,19L59,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M69,19L69,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M79,19L79,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
</vector>
5 changes: 0 additions & 5 deletions app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml

This file was deleted.

5 changes: 0 additions & 5 deletions app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml

This file was deleted.

5 changes: 5 additions & 0 deletions app/src/main/res/mipmap-anydpi-v26/teira_launcher.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/teira_launcher_background"/>
<foreground android:drawable="@mipmap/teira_launcher_foreground"/>
</adaptive-icon>
5 changes: 5 additions & 0 deletions app/src/main/res/mipmap-anydpi-v26/teira_launcher_round.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/teira_launcher_background"/>
<foreground android:drawable="@mipmap/teira_launcher_foreground"/>
</adaptive-icon>
Binary file removed app/src/main/res/mipmap-hdpi/ic_launcher.webp
Binary file not shown.
Binary file removed app/src/main/res/mipmap-hdpi/ic_launcher_round.webp
Binary file not shown.
Binary file added app/src/main/res/mipmap-hdpi/teira_launcher.webp
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed app/src/main/res/mipmap-mdpi/ic_launcher.webp
Binary file not shown.
Binary file removed app/src/main/res/mipmap-mdpi/ic_launcher_round.webp
Binary file not shown.
Binary file added app/src/main/res/mipmap-mdpi/teira_launcher.webp
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed app/src/main/res/mipmap-xhdpi/ic_launcher.webp
Binary file not shown.
Binary file removed app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp
Binary file not shown.
Binary file added app/src/main/res/mipmap-xhdpi/teira_launcher.webp
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed app/src/main/res/mipmap-xxhdpi/ic_launcher.webp
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added app/src/main/teira_launcher-playstore.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion sdk/src/main/java/br/com/tick/sdk/database/UserDao.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import kotlinx.coroutines.flow.Flow
interface UserDao {

@Query("SELECT * FROM user WHERE user_id = 1")
fun getUniqueUser(): Flow<User>
fun getUniqueUser(): Flow<User?>

@Insert(onConflict = OnConflictStrategy.ABORT)
fun setInitialUser(user: User)
Expand Down
5 changes: 1 addition & 4 deletions sdk/src/main/java/br/com/tick/sdk/domain/ExpenseRisk.kt
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package br.com.tick.sdk.domain

/**
* This class holds business logic to determine weather an expense value is categorized as certain threshold.
*/
enum class ExpenseRisk(private val percentageThreshold: Double) {
HIGHEST(20.0),
HIGH(10.0),
Expand All @@ -12,7 +9,7 @@ enum class ExpenseRisk(private val percentageThreshold: Double) {

companion object {
fun getRiskFromValue(monthlyIncome: Double, expenseValue: Double): ExpenseRisk {
require(expenseValue > 0) { "There's no way to calculate risks for a negative value. What is that anyway?" }
require(expenseValue >= 0) { "There's no way to calculate risks for a negative value. What is that anyway?" }

return when ((expenseValue * 100) / monthlyIncome) {
in 0.0..LOWEST.percentageThreshold -> LOWEST
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,23 @@ import br.com.tick.sdk.domain.AccountingDate
import br.com.tick.sdk.domain.CurrencyFormat
import br.com.tick.sdk.domain.NotificationPeriodicity
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.filterNotNull
import kotlinx.coroutines.flow.first
import javax.inject.Inject

class UserRepositoryImpl @Inject constructor(
private val userDao: UserDao
) : UserRepository {

override fun getUser(): Flow<User> {
return userDao.getUniqueUser()
return userDao.getUniqueUser().filterNotNull()
}

override suspend fun setInitialUser() {
userDao.setInitialUser(User.initial())
val user = userDao.getUniqueUser().first()
if (user == null) {
userDao.setInitialUser(User.initial())
}
}

override suspend fun setMonthlyIncome(newValue: Double) {
Expand Down