Skip to content

Commit ecd0f92

Browse files
authored
savings cleanup (#2232)
spotless fix editorconfig added
1 parent 1e3ed79 commit ecd0f92

File tree

39 files changed

+721
-1870
lines changed

39 files changed

+721
-1870
lines changed

.editorconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# https://editorconfig.org/
2+
# This configuration is used by ktlint when spotless invokes it
3+
4+
[*.{kt,kts}]
5+
ij_kotlin_allow_trailing_comma=true
6+
ij_kotlin_allow_trailing_comma_on_call_site=true
7+
ktlint_function_naming_ignore_when_annotated_with=Composable, Test, Preview

build-logic/convention/src/main/kotlin/org/mifos/Badging.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import org.gradle.api.tasks.OutputFile
1919
import org.gradle.api.tasks.PathSensitive
2020
import org.gradle.api.tasks.PathSensitivity
2121
import org.gradle.api.tasks.TaskAction
22-
import org.gradle.configurationcache.extensions.capitalized
22+
import org.gradle.internal.extensions.stdlib.capitalized
2323
import org.gradle.kotlin.dsl.register
2424
import org.gradle.language.base.plugins.LifecycleBasePlugin
2525
import org.gradle.process.ExecOperations

config/detekt/.editorconfig

Whitespace-only changes.

config/detekt/detekt.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ complexity:
168168
threshold: 600
169169
LongMethod:
170170
active: true
171-
threshold: 180 #60
171+
threshold: 360 #180 #60
172172
LongParameterList:
173173
active: true
174174
# Updating Common values based on current scenario
@@ -785,7 +785,7 @@ style:
785785
maxChainedCalls: 5
786786
MaxLineLength:
787787
active: true
788-
maxLineLength: 120
788+
maxLineLength: 150
789789
excludePackageStatements: true
790790
excludeImportStatements: true
791791
excludeCommentStatements: false
@@ -828,7 +828,7 @@ style:
828828
active: false
829829
ReturnCount:
830830
active: true
831-
max: 2
831+
max: 4
832832
excludedFunctions:
833833
- "equals"
834834
excludeLabeled: false

feature/savings/build.gradle.kts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
/*
2+
* Copyright 2024 Mifos Initiative
3+
*
4+
* This Source Code Form is subject to the terms of the Mozilla Public
5+
* License, v. 2.0. If a copy of the MPL was not distributed with this
6+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
7+
*
8+
* See https://github.com/openMF/android-client/blob/master/LICENSE.md
9+
*/
110
plugins {
211
alias(libs.plugins.mifos.android.feature)
312
alias(libs.plugins.mifos.android.library.compose)

feature/savings/src/androidTest/java/com/mifos/feature/savings/ExampleInstrumentedTest.kt

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
1+
/*
2+
* Copyright 2024 Mifos Initiative
3+
*
4+
* This Source Code Form is subject to the terms of the Mozilla Public
5+
* License, v. 2.0. If a copy of the MPL was not distributed with this
6+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
7+
*
8+
* See https://github.com/openMF/android-client/blob/master/LICENSE.md
9+
*/
110
package com.mifos.feature.savings
211

3-
import androidx.test.platform.app.InstrumentationRegistry
412
import androidx.test.ext.junit.runners.AndroidJUnit4
5-
13+
import androidx.test.platform.app.InstrumentationRegistry
14+
import org.junit.Assert.assertEquals
615
import org.junit.Test
716
import org.junit.runner.RunWith
817

9-
import org.junit.Assert.*
10-
1118
/**
1219
* Instrumented test, which will execute on an Android device.
1320
*
@@ -21,4 +28,4 @@ class ExampleInstrumentedTest {
2128
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
2229
assertEquals("com.mifos.feature.savings.test", appContext.packageName)
2330
}
24-
}
31+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
11
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
Copyright 2024 Mifos Initiative
4+
5+
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
6+
If a copy of the MPL was not distributed with this file,
7+
You can obtain one at https://mozilla.org/MPL/2.0/.
8+
9+
See https://github.com/openMF/android-client/blob/master/LICENSE.md
10+
-->
211
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
312

413
</manifest>
Lines changed: 50 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
/*
2+
* Copyright 2024 Mifos Initiative
3+
*
4+
* This Source Code Form is subject to the terms of the Mozilla Public
5+
* License, v. 2.0. If a copy of the MPL was not distributed with this
6+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
7+
*
8+
* See https://github.com/openMF/android-client/blob/master/LICENSE.md
9+
*/
110
package com.mifos.feature.savings.navigation
211

312
import androidx.navigation.NavController
@@ -9,11 +18,11 @@ import androidx.navigation.navigation
918
import com.mifos.core.common.utils.Constants
1019
import com.mifos.core.objects.accounts.savings.DepositType
1120
import com.mifos.core.objects.accounts.savings.SavingsAccountWithAssociations
12-
import com.mifos.feature.savings.account.SavingsAccountScreen
13-
import com.mifos.feature.savings.account_activate.SavingsAccountActivateScreen
14-
import com.mifos.feature.savings.account_approval.SavingsAccountApprovalScreen
15-
import com.mifos.feature.savings.account_summary.SavingsAccountSummaryScreen
16-
import com.mifos.feature.savings.account_transaction.SavingsAccountTransactionScreen
21+
import com.mifos.feature.savings.savingsAccount.SavingsAccountScreen
22+
import com.mifos.feature.savings.savingsAccountActivate.SavingsAccountActivateScreen
23+
import com.mifos.feature.savings.savingsAccountApproval.SavingsAccountApprovalScreen
24+
import com.mifos.feature.savings.savingsAccountSummary.SavingsAccountSummaryScreen
25+
import com.mifos.feature.savings.savingsAccountTransaction.SavingsAccountTransactionScreen
1726

1827
/**
1928
* Created by Pronay Sarker on 14/08/2024 (1:10 PM)
@@ -22,41 +31,41 @@ import com.mifos.feature.savings.account_transaction.SavingsAccountTransactionSc
2231
fun NavGraphBuilder.savingsNavGraph(
2332
navController: NavController,
2433
onBackPressed: () -> Unit,
25-
loadMoreSavingsAccountInfo: (Int) -> Unit,
26-
loadDocuments: (Int) -> Unit,
34+
loadMoreSavingsAccountInfo: (String, Int) -> Unit,
35+
loadDocuments: (Int, String) -> Unit,
2736
) {
2837
navigation(
2938
startDestination = SavingsScreens.SavingsAccountSummary.route,
30-
route = "savings_summary_route"
39+
route = "savings_summary_route",
3140
) {
3241
savingsSummaryScreen(
3342
onBackPressed = navController::popBackStack,
34-
loadMoreSavingsAccountInfo = loadMoreSavingsAccountInfo,
35-
loadDocuments = loadDocuments,
43+
loadMoreSavingsAccountInfo = { loadMoreSavingsAccountInfo(Constants.DATA_TABLE_NAME_SAVINGS, it) },
44+
loadDocuments = { loadDocuments(it, Constants.ENTITY_TYPE_SAVINGS) },
3645
onDepositClick = { savingsAccountWithAssociations, depositType ->
3746
navController.navigateToSavingsAccountTransactionScreen(
3847
savingsAccountWithAssociations = savingsAccountWithAssociations,
3948
depositType = depositType,
40-
transactionType = Constants.SAVINGS_ACCOUNT_TRANSACTION_DEPOSIT
49+
transactionType = Constants.SAVINGS_ACCOUNT_TRANSACTION_DEPOSIT,
4150
)
4251
},
4352
onWithdrawButtonClicked = { savingsAccountWithAssociations, depositType ->
4453
navController.navigateToSavingsAccountTransactionScreen(
4554
savingsAccountWithAssociations = savingsAccountWithAssociations,
4655
depositType = depositType,
47-
transactionType = Constants.SAVINGS_ACCOUNT_TRANSACTION_WITHDRAWAL
56+
transactionType = Constants.SAVINGS_ACCOUNT_TRANSACTION_WITHDRAWAL,
4857
)
4958
},
5059
approveSavings = { _, accountNumber ->
5160
navController.navigateToSavingsAccountApproval(
52-
accountNumber
61+
accountNumber,
5362
)
5463
},
5564
activateSavings = { _, accountNumber ->
5665
navController.navigateToSavingsAccountActivate(
57-
accountNumber
66+
accountNumber,
5867
)
59-
}
68+
},
6069
)
6170

6271
addSavingsAccountScreen {
@@ -78,18 +87,18 @@ fun NavGraphBuilder.savingsNavGraph(
7887
}
7988

8089
fun NavGraphBuilder.addSavingsAccountScreen(
81-
onBackPressed: () -> Unit
90+
onBackPressed: () -> Unit,
8291
) {
8392
composable(
8493
route = SavingsScreens.SavingsAccount.route,
8594
arguments = listOf(
8695
navArgument(name = Constants.GROUP_ID, builder = { type = NavType.IntType }),
8796
navArgument(name = Constants.CLIENT_ID, builder = { type = NavType.IntType }),
88-
navArgument(name = Constants.GROUP_ACCOUNT, builder = { type = NavType.BoolType })
89-
)
97+
navArgument(name = Constants.GROUP_ACCOUNT, builder = { type = NavType.BoolType }),
98+
),
9099
) {
91100
SavingsAccountScreen(
92-
navigateBack = onBackPressed
101+
navigateBack = onBackPressed,
93102
)
94103
}
95104
}
@@ -101,13 +110,13 @@ fun NavGraphBuilder.savingsSummaryScreen(
101110
onDepositClick: (SavingsAccountWithAssociations, DepositType?) -> Unit,
102111
onWithdrawButtonClicked: (SavingsAccountWithAssociations, DepositType?) -> Unit,
103112
approveSavings: (savingsAccountType: DepositType?, savingsAccountNumber: Int) -> Unit,
104-
activateSavings: (savingsAccountType: DepositType?, savingsAccountNumber: Int) -> Unit
113+
activateSavings: (savingsAccountType: DepositType?, savingsAccountNumber: Int) -> Unit,
105114
) {
106115
composable(
107116
route = SavingsScreens.SavingsAccountSummary.route,
108117
arguments = listOf(
109-
navArgument(name = "arg" , builder = { type = NavType.StringType })
110-
)
118+
navArgument(name = "arg", builder = { type = NavType.StringType }),
119+
),
111120
) {
112121
SavingsAccountSummaryScreen(
113122
navigateBack = onBackPressed,
@@ -116,60 +125,60 @@ fun NavGraphBuilder.savingsSummaryScreen(
116125
onDepositClick = onDepositClick,
117126
onWithdrawButtonClicked = onWithdrawButtonClicked,
118127
approveSavings = approveSavings,
119-
activateSavings = activateSavings
128+
activateSavings = activateSavings,
120129
)
121130
}
122131
}
123132

124133
fun NavGraphBuilder.savingsAccountActivateScreen(
125-
onBackPressed: () -> Unit
134+
onBackPressed: () -> Unit,
126135
) {
127136
composable(
128137
route = SavingsScreens.SavingsAccountActivate.route,
129138
arguments = listOf(
130-
navArgument(name = Constants.SAVINGS_ACCOUNT_ID, builder = { type = NavType.IntType })
131-
)
139+
navArgument(name = Constants.SAVINGS_ACCOUNT_ID, builder = { type = NavType.IntType }),
140+
),
132141
) {
133142
SavingsAccountActivateScreen(
134-
navigateBack = onBackPressed
143+
navigateBack = onBackPressed,
135144
)
136145
}
137146
}
138147

139148
fun NavGraphBuilder.savingsAccountApprovalScreen(
140-
onBackPressed: () -> Unit
149+
onBackPressed: () -> Unit,
141150
) {
142151
composable(
143152
route = SavingsScreens.SavingsAccountApproval.route,
144153
arguments = listOf(
145-
navArgument(name = Constants.SAVINGS_ACCOUNT_ID, builder = { type = NavType.IntType })
146-
)
154+
navArgument(name = Constants.SAVINGS_ACCOUNT_ID, builder = { type = NavType.IntType }),
155+
),
147156
) {
148157
SavingsAccountApprovalScreen(
149-
navigateBack = onBackPressed
158+
navigateBack = onBackPressed,
150159
)
151160
}
152161
}
153162

154163
fun NavGraphBuilder.savingsAccountTransactionScreen(
155-
onBackPressed: () -> Unit
164+
onBackPressed: () -> Unit,
156165
) {
157166
composable(
158167
route = SavingsScreens.SavingsAccountTransaction.route,
159168
arguments = listOf(
160-
navArgument(name = "arg" , builder = { type = NavType.StringType })
161-
)
169+
navArgument(name = "arg", builder = { type = NavType.StringType }),
170+
),
162171
) {
163172
SavingsAccountTransactionScreen(
164-
navigateBack = onBackPressed
173+
navigateBack = onBackPressed,
165174
)
166175
}
167176
}
168177

169178
fun NavController.navigateToAddSavingsAccount(
170179
groupId: Int,
171180
clientId: Int,
172-
isGroupAccount: Boolean
181+
isGroupAccount: Boolean,
173182
) {
174183
navigate(SavingsScreens.SavingsAccount.argument(groupId, clientId, isGroupAccount))
175184
}
@@ -182,20 +191,20 @@ fun NavController.navigateToSavingsAccountActivate(savingsAccountId: Int) {
182191
navigate(SavingsScreens.SavingsAccountActivate.argument(savingsAccountId))
183192
}
184193

185-
fun NavController.navigateToSavingsAccountSummaryScreen(id : Int, type: DepositType){
194+
fun NavController.navigateToSavingsAccountSummaryScreen(id: Int, type: DepositType) {
186195
navigate(SavingsScreens.SavingsAccountSummary.argument(id, type))
187196
}
188197

189198
fun NavController.navigateToSavingsAccountTransactionScreen(
190199
savingsAccountWithAssociations: SavingsAccountWithAssociations,
191200
transactionType: String,
192-
depositType: DepositType?
201+
depositType: DepositType?,
193202
) {
194203
navigate(
195204
SavingsScreens.SavingsAccountTransaction.argument(
196205
savingsAccountWithAssociations,
197206
transactionType,
198-
depositType
199-
)
207+
depositType,
208+
),
200209
)
201-
}
210+
}

feature/savings/src/main/java/com/mifos/feature/savings/navigation/SavingsScreens.kt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
/*
2+
* Copyright 2024 Mifos Initiative
3+
*
4+
* This Source Code Form is subject to the terms of the Mozilla Public
5+
* License, v. 2.0. If a copy of the MPL was not distributed with this
6+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
7+
*
8+
* See https://github.com/openMF/android-client/blob/master/LICENSE.md
9+
*/
110
package com.mifos.feature.savings.navigation
211

312
import com.google.gson.Gson
@@ -45,7 +54,7 @@ sealed class SavingsScreens(val route: String) {
4554
fun argument(
4655
savingsAccountWithAssociations: SavingsAccountWithAssociations,
4756
transactionType: String,
48-
depositType: DepositType?
57+
depositType: DepositType?,
4958
): String {
5059
val gson = Gson()
5160
val arg = SavingsTransactionData(savingsAccountWithAssociations, depositType, transactionType)
@@ -58,4 +67,3 @@ sealed class SavingsScreens(val route: String) {
5867
data object SavingsSyncAccountTransaction :
5968
SavingsScreens("savings_sync_account_transaction")
6069
}
61-

feature/savings/src/main/java/com/mifos/feature/savings/account/SavingAccountUiState.kt renamed to feature/savings/src/main/java/com/mifos/feature/savings/savingsAccount/SavingAccountUiState.kt

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
1-
package com.mifos.feature.savings.account
1+
/*
2+
* Copyright 2024 Mifos Initiative
3+
*
4+
* This Source Code Form is subject to the terms of the Mozilla Public
5+
* License, v. 2.0. If a copy of the MPL was not distributed with this
6+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
7+
*
8+
* See https://github.com/openMF/android-client/blob/master/LICENSE.md
9+
*/
10+
package com.mifos.feature.savings.savingsAccount
211

312
import com.mifos.core.objects.client.Savings
413
import com.mifos.core.objects.zipmodels.SavingProductsAndTemplate
@@ -18,4 +27,4 @@ sealed class SavingAccountUiState {
1827
data class ShowSavingsAccountCreatedSuccessfully(val savings: Savings?) : SavingAccountUiState()
1928

2029
data class ShowFetchingErrorString(val message: String) : SavingAccountUiState()
21-
}
30+
}

0 commit comments

Comments
 (0)