diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 11f9fbf..2927f81 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -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"> diff --git a/app/src/main/res/drawable/teira_launcher_background.xml b/app/src/main/res/drawable/teira_launcher_background.xml new file mode 100644 index 0000000..ca3826a --- /dev/null +++ b/app/src/main/res/drawable/teira_launcher_background.xml @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml deleted file mode 100644 index eca70cf..0000000 --- a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml deleted file mode 100644 index eca70cf..0000000 --- a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/app/src/main/res/mipmap-anydpi-v26/teira_launcher.xml b/app/src/main/res/mipmap-anydpi-v26/teira_launcher.xml new file mode 100644 index 0000000..aeb4c0d --- /dev/null +++ b/app/src/main/res/mipmap-anydpi-v26/teira_launcher.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-anydpi-v26/teira_launcher_round.xml b/app/src/main/res/mipmap-anydpi-v26/teira_launcher_round.xml new file mode 100644 index 0000000..aeb4c0d --- /dev/null +++ b/app/src/main/res/mipmap-anydpi-v26/teira_launcher_round.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.webp b/app/src/main/res/mipmap-hdpi/ic_launcher.webp deleted file mode 100644 index c209e78..0000000 Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher.webp and /dev/null differ diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp deleted file mode 100644 index b2dfe3d..0000000 Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp and /dev/null differ diff --git a/app/src/main/res/mipmap-hdpi/teira_launcher.webp b/app/src/main/res/mipmap-hdpi/teira_launcher.webp new file mode 100644 index 0000000..6959ebb Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/teira_launcher.webp differ diff --git a/app/src/main/res/mipmap-hdpi/teira_launcher_foreground.webp b/app/src/main/res/mipmap-hdpi/teira_launcher_foreground.webp new file mode 100644 index 0000000..9ae94db Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/teira_launcher_foreground.webp differ diff --git a/app/src/main/res/mipmap-hdpi/teira_launcher_round.webp b/app/src/main/res/mipmap-hdpi/teira_launcher_round.webp new file mode 100644 index 0000000..6c54dee Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/teira_launcher_round.webp differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.webp b/app/src/main/res/mipmap-mdpi/ic_launcher.webp deleted file mode 100644 index 4f0f1d6..0000000 Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher.webp and /dev/null differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp deleted file mode 100644 index 62b611d..0000000 Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp and /dev/null differ diff --git a/app/src/main/res/mipmap-mdpi/teira_launcher.webp b/app/src/main/res/mipmap-mdpi/teira_launcher.webp new file mode 100644 index 0000000..ff400ec Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/teira_launcher.webp differ diff --git a/app/src/main/res/mipmap-mdpi/teira_launcher_foreground.webp b/app/src/main/res/mipmap-mdpi/teira_launcher_foreground.webp new file mode 100644 index 0000000..68bc38c Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/teira_launcher_foreground.webp differ diff --git a/app/src/main/res/mipmap-mdpi/teira_launcher_round.webp b/app/src/main/res/mipmap-mdpi/teira_launcher_round.webp new file mode 100644 index 0000000..84bb08f Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/teira_launcher_round.webp differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xhdpi/ic_launcher.webp deleted file mode 100644 index 948a307..0000000 Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher.webp and /dev/null differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp deleted file mode 100644 index 1b9a695..0000000 Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp and /dev/null differ diff --git a/app/src/main/res/mipmap-xhdpi/teira_launcher.webp b/app/src/main/res/mipmap-xhdpi/teira_launcher.webp new file mode 100644 index 0000000..a1520bc Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/teira_launcher.webp differ diff --git a/app/src/main/res/mipmap-xhdpi/teira_launcher_foreground.webp b/app/src/main/res/mipmap-xhdpi/teira_launcher_foreground.webp new file mode 100644 index 0000000..59af75b Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/teira_launcher_foreground.webp differ diff --git a/app/src/main/res/mipmap-xhdpi/teira_launcher_round.webp b/app/src/main/res/mipmap-xhdpi/teira_launcher_round.webp new file mode 100644 index 0000000..715e6ff Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/teira_launcher_round.webp differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp deleted file mode 100644 index 28d4b77..0000000 Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp and /dev/null differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp deleted file mode 100644 index 9287f50..0000000 Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp and /dev/null differ diff --git a/app/src/main/res/mipmap-xxhdpi/teira_launcher.webp b/app/src/main/res/mipmap-xxhdpi/teira_launcher.webp new file mode 100644 index 0000000..7880371 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/teira_launcher.webp differ diff --git a/app/src/main/res/mipmap-xxhdpi/teira_launcher_foreground.webp b/app/src/main/res/mipmap-xxhdpi/teira_launcher_foreground.webp new file mode 100644 index 0000000..b10cc90 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/teira_launcher_foreground.webp differ diff --git a/app/src/main/res/mipmap-xxhdpi/teira_launcher_round.webp b/app/src/main/res/mipmap-xxhdpi/teira_launcher_round.webp new file mode 100644 index 0000000..98add3a Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/teira_launcher_round.webp differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp deleted file mode 100644 index aa7d642..0000000 Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp and /dev/null differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp deleted file mode 100644 index 9126ae3..0000000 Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp and /dev/null differ diff --git a/app/src/main/res/mipmap-xxxhdpi/teira_launcher.webp b/app/src/main/res/mipmap-xxxhdpi/teira_launcher.webp new file mode 100644 index 0000000..fc29b2c Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/teira_launcher.webp differ diff --git a/app/src/main/res/mipmap-xxxhdpi/teira_launcher_foreground.webp b/app/src/main/res/mipmap-xxxhdpi/teira_launcher_foreground.webp new file mode 100644 index 0000000..689cde8 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/teira_launcher_foreground.webp differ diff --git a/app/src/main/res/mipmap-xxxhdpi/teira_launcher_round.webp b/app/src/main/res/mipmap-xxxhdpi/teira_launcher_round.webp new file mode 100644 index 0000000..e04235e Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/teira_launcher_round.webp differ diff --git a/app/src/main/teira_launcher-playstore.png b/app/src/main/teira_launcher-playstore.png new file mode 100644 index 0000000..090e341 Binary files /dev/null and b/app/src/main/teira_launcher-playstore.png differ diff --git a/sdk/src/main/java/br/com/tick/sdk/database/UserDao.kt b/sdk/src/main/java/br/com/tick/sdk/database/UserDao.kt index da0022f..a5b3523 100644 --- a/sdk/src/main/java/br/com/tick/sdk/database/UserDao.kt +++ b/sdk/src/main/java/br/com/tick/sdk/database/UserDao.kt @@ -14,7 +14,7 @@ import kotlinx.coroutines.flow.Flow interface UserDao { @Query("SELECT * FROM user WHERE user_id = 1") - fun getUniqueUser(): Flow + fun getUniqueUser(): Flow @Insert(onConflict = OnConflictStrategy.ABORT) fun setInitialUser(user: User) diff --git a/sdk/src/main/java/br/com/tick/sdk/domain/ExpenseRisk.kt b/sdk/src/main/java/br/com/tick/sdk/domain/ExpenseRisk.kt index 217f72f..17e06ea 100644 --- a/sdk/src/main/java/br/com/tick/sdk/domain/ExpenseRisk.kt +++ b/sdk/src/main/java/br/com/tick/sdk/domain/ExpenseRisk.kt @@ -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), @@ -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 diff --git a/sdk/src/main/java/br/com/tick/sdk/repositories/user/UserRepositoryImpl.kt b/sdk/src/main/java/br/com/tick/sdk/repositories/user/UserRepositoryImpl.kt index 3393554..9b8110c 100644 --- a/sdk/src/main/java/br/com/tick/sdk/repositories/user/UserRepositoryImpl.kt +++ b/sdk/src/main/java/br/com/tick/sdk/repositories/user/UserRepositoryImpl.kt @@ -6,6 +6,8 @@ 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( @@ -13,11 +15,14 @@ class UserRepositoryImpl @Inject constructor( ) : UserRepository { override fun getUser(): Flow { - 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) {