Skip to content

Commit ab15b4d

Browse files
authored
Merge pull request #26 from afaneca/develop
1.2.0
2 parents 096a5fb + 962104e commit ab15b4d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+1872
-209
lines changed

android/.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,5 @@
1515
/.idea/
1616
/.idea/
1717
.idea
18+
keystore.properties
19+

android/.idea/gradle.xml

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

android/app/build.gradle

+14-16
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ plugins {
22
id("com.android.application")
33
id("kotlin-android")
44
id("kotlin-kapt")
5-
id("kotlin-android-extensions")
65
id("androidx.navigation.safeargs.kotlin")
76
id("dagger.hilt.android.plugin")
87
}
@@ -27,8 +26,8 @@ android {
2726
applicationId "$application_id"
2827
minSdkVersion 26
2928
targetSdkVersion 33
30-
versionCode 9
31-
versionName "1.1.0"
29+
versionCode 10
30+
versionName "1.2.0"
3231

3332
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
3433
}
@@ -71,31 +70,30 @@ android {
7170
}
7271

7372
compileOptions {
74-
sourceCompatibility JavaVersion.VERSION_1_8
75-
targetCompatibility JavaVersion.VERSION_1_8
73+
sourceCompatibility JavaVersion.VERSION_17
74+
targetCompatibility JavaVersion.VERSION_17
7675
}
7776
kotlinOptions {
78-
jvmTarget = '1.8'
77+
jvmTarget = '17'
7978
}
8079
namespace 'com.afaneca.myfin'
8180
}
8281

8382
dependencies {
8483
implementation fileTree(dir: "libs", include: ["*.jar"])
85-
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
86-
implementation "androidx.core:core-ktx:$kotlin_version"
87-
implementation 'androidx.appcompat:appcompat:1.5.1'
84+
implementation "androidx.core:core-ktx:1.9.0"
85+
implementation 'androidx.appcompat:appcompat:1.6.1'
8886
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
89-
implementation 'com.google.android.material:material:1.6.1'
87+
implementation 'com.google.android.material:material:1.9.0'
9088
implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
9189
implementation "androidx.navigation:navigation-ui-ktx:$nav_version"
92-
implementation 'androidx.annotation:annotation:1.5.0'
90+
implementation 'androidx.annotation:annotation:1.6.0'
9391
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
9492
implementation 'androidx.security:security-crypto:1.1.0-alpha01'
9593
implementation("androidx.preference:preference-ktx:$preference_version")
9694
testImplementation 'junit:junit:4.13.2'
97-
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
98-
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
95+
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
96+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
9997

10098
// Retrofit
10199
implementation "com.squareup.retrofit2:retrofit:$retrofit_version"
@@ -109,7 +107,7 @@ dependencies {
109107
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
110108

111109
// Coroutines
112-
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.1'
110+
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4'
113111

114112
// DI - Dagger-hilt
115113
implementation("com.google.dagger:hilt-android:$hilt_version")
@@ -141,8 +139,8 @@ dependencies {
141139

142140
// Testing
143141
testImplementation "com.google.truth:truth:1.1.3"
144-
testImplementation "androidx.arch.core:core-testing:2.1.0"
145-
testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.1'
142+
testImplementation "androidx.arch.core:core-testing:2.2.0"
143+
testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.4'
146144
}
147145

148146
// Allow references to generated code

android/app/proguard-rules.pro

+10
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,14 @@
4444
-keep class net.sqlcipher.** { *; }
4545
-keep class net.sqlcipher.database.* { *; }
4646

47+
-dontwarn org.bouncycastle.jsse.BCSSLParameters
48+
-dontwarn org.bouncycastle.jsse.BCSSLSocket
49+
-dontwarn org.bouncycastle.jsse.provider.BouncyCastleJsseProvider
50+
-dontwarn org.conscrypt.Conscrypt$Version
51+
-dontwarn org.conscrypt.Conscrypt
52+
-dontwarn org.conscrypt.ConscryptHostnameVerifier
53+
-dontwarn org.openjsse.javax.net.ssl.SSLParameters
54+
-dontwarn org.openjsse.javax.net.ssl.SSLSocket
55+
-dontwarn org.openjsse.net.ssl.OpenJSSE
56+
4757
-keep class com.afaneca.myfin.base.objects.** { *; }

android/app/src/main/java/com/afaneca/myfin/closed/PrivateActivity.kt

+10-12
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ import com.afaneca.myfin.databinding.ActivityPrivateBinding
2525
import com.afaneca.myfin.open.login.ui.LoginActivity
2626
import com.afaneca.myfin.utils.startNewActivity
2727
import dagger.hilt.android.AndroidEntryPoint
28-
import kotlinx.android.synthetic.main.activity_private.*
29-
import kotlinx.android.synthetic.main.nav_header_main.view.*
3028
import kotlinx.coroutines.Dispatchers
3129
import kotlinx.coroutines.launch
3230
import kotlinx.coroutines.withContext
@@ -68,31 +66,31 @@ class PrivateActivity : BaseActivity() {
6866

6967
/* Observers*/
7068
privateViewModel.apply {
71-
getUserAccounts().observe(this@PrivateActivity, {
69+
getUserAccounts().observe(this@PrivateActivity) {
7270
if (it.isNullOrEmpty()) return@observe
7371
privateViewModel.calculateAggregatedAccountBalances(it)
74-
})
72+
}
7573

76-
patrimonyBalance.observe(this@PrivateActivity, {
74+
patrimonyBalance.observe(this@PrivateActivity) {
7775
if (it.isNullOrEmpty()) return@observe
7876
populateMainPatrimonyBalance(it)
7977
populatePatrimonyBalance(it)
80-
})
78+
}
8179

82-
operatingFundsBalance.observe(this@PrivateActivity, {
80+
operatingFundsBalance.observe(this@PrivateActivity) {
8381
if (it.isNullOrEmpty()) return@observe
8482
populateOperatingFundsBalance(it)
85-
})
83+
}
8684

87-
investingBalance.observe(this@PrivateActivity, {
85+
investingBalance.observe(this@PrivateActivity) {
8886
if (it.isNullOrEmpty()) return@observe
8987
populateInvestmentsBalance(it)
90-
})
88+
}
9189

92-
debtBalance.observe(this@PrivateActivity, {
90+
debtBalance.observe(this@PrivateActivity) {
9391
if (it.isNullOrEmpty()) return@observe
9492
populateDebtBalance(it)
95-
})
93+
}
9694
}
9795
}
9896

android/app/src/main/java/com/afaneca/myfin/closed/budgets/ui/BudgetDetailsCategoryBottomSheetFragment.kt

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import com.afaneca.myfin.R
1616
import com.afaneca.myfin.closed.transactions.data.MyFinBudgetCategory
1717
import com.afaneca.myfin.databinding.FragmentBudgetDetailsCategoryBottomSheetBinding
1818
import com.afaneca.myfin.utils.formatMoney
19+
import com.afaneca.myfin.utils.safeNavigate
1920
import com.google.android.material.bottomsheet.BottomSheetBehavior
2021
import com.google.android.material.bottomsheet.BottomSheetDialog
2122
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
@@ -105,7 +106,7 @@ class BudgetDetailsCategoryBottomSheetFragment : BottomSheetDialogFragment() {
105106
budgetId,
106107
true
107108
)
108-
findNavController().navigate(action)
109+
findNavController().safeNavigate(action)
109110
}
110111

111112
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {

android/app/src/main/java/com/afaneca/myfin/closed/budgets/ui/BudgetsFragment.kt

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import com.afaneca.myfin.base.objects.MyFinBudget
1616
import com.afaneca.myfin.data.network.Resource
1717
import com.afaneca.myfin.databinding.FragmentBudgetsBinding
1818
import com.afaneca.myfin.utils.parseStringToBoolean
19+
import com.afaneca.myfin.utils.safeNavigate
1920
import com.afaneca.myfin.utils.visible
2021
import java.util.*
2122

@@ -107,7 +108,7 @@ class BudgetsFragment :
107108
budget.budgetId,
108109
parseStringToBoolean(budget.isOpen)
109110
)
110-
findNavController().navigate(action)
111+
findNavController().safeNavigate(action)
111112
}
112113

113114
}

android/app/src/main/java/com/afaneca/myfin/closed/dashboard/ui/DashboardTransactionsFragment.kt

+9-6
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,16 @@ import android.view.View
66
import android.view.ViewGroup
77
import android.widget.Toast
88
import androidx.fragment.app.viewModels
9+
import androidx.navigation.fragment.findNavController
910
import androidx.recyclerview.widget.DividerItemDecoration
1011
import androidx.recyclerview.widget.LinearLayoutManager
1112
import com.afaneca.myfin.base.BaseFragment
1213
import com.afaneca.myfin.base.objects.MyFinTransaction
13-
import com.afaneca.myfin.closed.transactions.ui.TransactionDetailsBottomSheetFragment
1414
import com.afaneca.myfin.closed.transactions.ui.TransactionsListAdapter
1515
import com.afaneca.myfin.closed.transactions.ui.TransactionsViewModel
1616
import com.afaneca.myfin.data.network.Resource
1717
import com.afaneca.myfin.databinding.FragmentDashboardTransactionsBinding
18+
import com.afaneca.myfin.utils.safeNavigate
1819
import com.afaneca.myfin.utils.visible
1920
import dagger.hilt.android.AndroidEntryPoint
2021

@@ -52,9 +53,11 @@ class DashboardTransactionsFragment :
5253
is Resource.Success -> {
5354

5455
}
56+
5557
is Resource.Failure -> {
5658
Toast.makeText(requireContext(), it.errorMessage, Toast.LENGTH_LONG).show()
5759
}
60+
5861
else -> {}
5962
}
6063
}
@@ -82,11 +85,11 @@ class DashboardTransactionsFragment :
8285
}
8386

8487
private fun showTransactionDetailsBottomSheetFragment(trx: MyFinTransaction) {
85-
val bottomSheetFragment = TransactionDetailsBottomSheetFragment.newInstance(trx)
86-
bottomSheetFragment.show(
87-
parentFragmentManager,
88-
TransactionDetailsBottomSheetFragment.javaClass.name
89-
)
88+
val direction =
89+
DashboardFragmentDirections.actionDashboardFragmentToTransactionDetailsBottomSheetFragment(
90+
trx
91+
)
92+
findNavController().safeNavigate(direction)
9093
}
9194

9295
private fun setupTransactionsRecyclerView(dataset: List<MyFinTransaction>) {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
package com.afaneca.myfin.closed.transactions.data
2+
3+
import androidx.annotation.Keep
4+
import com.google.gson.annotations.SerializedName
5+
6+
@Keep
7+
class AddTransactionStep0Response(
8+
@SerializedName("entities")
9+
val entities: List<EntityResponse>,
10+
@SerializedName("categories")
11+
val categories: List<CategoryResponse>,
12+
@SerializedName("type")
13+
val types: List<TypeResponse>,
14+
@SerializedName("accounts")
15+
val accounts: List<AccountResponse>,
16+
)
17+
18+
@Keep
19+
data class EntityResponse(
20+
@SerializedName("entity_id")
21+
val entityId: String,
22+
@SerializedName("name")
23+
val name: String,
24+
)
25+
26+
@Keep
27+
data class CategoryResponse(
28+
@SerializedName("category_id")
29+
val categoryId: String,
30+
@SerializedName("name")
31+
val name: String,
32+
@SerializedName("description")
33+
val description: String,
34+
)
35+
36+
@Keep
37+
data class TypeResponse(
38+
@SerializedName("letter")
39+
val letter: String,
40+
@SerializedName("name")
41+
val name: String,
42+
)
43+
44+
@Keep
45+
data class AccountResponse(
46+
@SerializedName("account_id")
47+
val accountId: String,
48+
@SerializedName("name")
49+
val name: String,
50+
@SerializedName("type")
51+
val type: String,
52+
)

android/app/src/main/java/com/afaneca/myfin/closed/transactions/data/LiveTransactionsRepository.kt

+58-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.afaneca.myfin.closed.transactions.data
22

3-
import com.afaneca.myfin.data.UserDataManager
43
import com.afaneca.myfin.data.network.BaseRepository
54
import com.afaneca.myfin.data.network.MyFinAPIServices
65

@@ -9,7 +8,6 @@ import com.afaneca.myfin.data.network.MyFinAPIServices
98
*/
109
class LiveTransactionsRepository(
1110
private val api: MyFinAPIServices,
12-
private val userData: UserDataManager
1311
) : TransactionsRepository, BaseRepository() {
1412
override suspend fun getTransactionsList(
1513
trxLimit: Int
@@ -19,4 +17,62 @@ class LiveTransactionsRepository(
1917
page: Int,
2018
pageSize: Int
2119
) = safeAPICall { api.getTransactionsListByPage(page, pageSize) }
20+
21+
override suspend fun addTransactionStep0() = safeAPICall { api.addTransactionStep0() }
22+
23+
override suspend fun addTransactionStep1(
24+
dateTimestamp: Long,
25+
amount: String,
26+
type: Char,
27+
accountFromId: String?,
28+
accountToId: String?,
29+
description: String,
30+
entityId: String?,
31+
categoryId: String?,
32+
isEssential: Boolean
33+
) = safeAPICall {
34+
api.addTransactionStep1(
35+
amount,
36+
type,
37+
description,
38+
entityId,
39+
accountFromId,
40+
accountToId,
41+
categoryId,
42+
dateTimestamp,
43+
isEssential
44+
)
45+
}
46+
47+
override suspend fun updateTransaction(
48+
transactionId: Int,
49+
newDateTimestamp: Long,
50+
newAmount: String,
51+
newType: Char,
52+
newAccountFromId: String?,
53+
newAccountToId: String?,
54+
newDescription: String,
55+
newEntityId: String?,
56+
newCategoryId: String?,
57+
newIsEssential: Boolean
58+
) = safeAPICall {
59+
api.updateTransaction(
60+
transactionId,
61+
newAmount,
62+
newType,
63+
newDescription,
64+
newEntityId,
65+
newAccountFromId,
66+
newAccountToId,
67+
newCategoryId,
68+
newDateTimestamp,
69+
newIsEssential
70+
)
71+
}
72+
73+
override suspend fun removeTransaction(
74+
transactionId: Int,
75+
) = safeAPICall {
76+
api.deleteTransaction(transactionId)
77+
}
2278
}

0 commit comments

Comments
 (0)