Skip to content

Commit 5f44c46

Browse files
authored
refactor: final cleanup (#2265)
* Remove Unused XML, Resources, and Kotlin Code deleted themeHelper.kt deleted unused files * actions/upload-artifact version update * remove unused testFiles * applied spotless and detekt on whole project * added dependency guard * fix build failure
1 parent fee8541 commit 5f44c46

File tree

375 files changed

+2780
-13838
lines changed

Some content is hidden

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

375 files changed

+2780
-13838
lines changed

.github/workflows/android.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323

2424
# Upload APK
2525
- name: Upload APK
26-
uses: actions/upload-artifact@v2.2.0
26+
uses: actions/upload-artifact@v4
2727
with:
2828
# Artifact name
2929
name: android-client-app

core/data/src/main/java/com/mifos/core/data/di/DataModule.kt

+3-3
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,18 @@ import com.mifos.core.data.repository.SearchRepository
4949
import com.mifos.core.data.repository.SignatureRepository
5050
import com.mifos.core.data.repository.SurveyListRepository
5151
import com.mifos.core.data.repository.SurveySubmitRepository
52+
import com.mifos.core.data.repositoryImp.ActivateRepositoryImp
5253
import com.mifos.core.data.repositoryImp.CenterDetailsRepositoryImp
5354
import com.mifos.core.data.repositoryImp.CenterListRepositoryImp
5455
import com.mifos.core.data.repositoryImp.ChargeDialogRepositoryImp
5556
import com.mifos.core.data.repositoryImp.CheckerInboxRepositoryImp
5657
import com.mifos.core.data.repositoryImp.CheckerInboxTasksRepositoryImp
5758
import com.mifos.core.data.repositoryImp.ClientChargeRepositoryImp
5859
import com.mifos.core.data.repositoryImp.ClientIdentifierDialogRepositoryImp
60+
import com.mifos.core.data.repositoryImp.ClientIdentifiersRepositoryImp
5961
import com.mifos.core.data.repositoryImp.CreateNewCenterRepositoryImp
6062
import com.mifos.core.data.repositoryImp.CreateNewGroupRepositoryImp
63+
import com.mifos.core.data.repositoryImp.DataTableDataRepositoryImp
6164
import com.mifos.core.data.repositoryImp.DataTableListRepositoryImp
6265
import com.mifos.core.data.repositoryImp.DataTableRepositoryImp
6366
import com.mifos.core.data.repositoryImp.DataTableRowDialogRepositoryImp
@@ -86,9 +89,6 @@ import com.mifos.core.data.repositoryImp.SearchRepositoryImp
8689
import com.mifos.core.data.repositoryImp.SignatureRepositoryImp
8790
import com.mifos.core.data.repositoryImp.SurveyListRepositoryImp
8891
import com.mifos.core.data.repositoryImp.SurveySubmitRepositoryImp
89-
import com.mifos.core.data.repository_imp.ActivateRepositoryImp
90-
import com.mifos.core.data.repository_imp.ClientIdentifiersRepositoryImp
91-
import com.mifos.core.data.repository_imp.DataTableDataRepositoryImp
9292
import dagger.Binds
9393
import dagger.Module
9494
import dagger.hilt.InstallIn

core/data/src/main/java/com/mifos/core/data/pagingSource/CenterListPagingSource.kt

+13-6
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.core.data.pagingSource
211

312
import androidx.paging.PagingSource
@@ -18,7 +27,7 @@ class CenterListPagingSource(private val dataManagerCenter: DataManagerCenter) :
1827
override fun getRefreshKey(state: PagingState<Int, Center>): Int? {
1928
return state.anchorPosition?.let { position ->
2029
state.closestPageToPosition(position)?.prevKey?.plus(10) ?: state.closestPageToPosition(
21-
position
30+
position,
2231
)?.nextKey?.minus(10)
2332
}
2433
}
@@ -34,7 +43,7 @@ class CenterListPagingSource(private val dataManagerCenter: DataManagerCenter) :
3443
LoadResult.Page(
3544
data = centerListWithSync,
3645
prevKey = if (position <= 0) null else position - 10,
37-
nextKey = if (position >= totalCenters) null else position + 10
46+
nextKey = if (position >= totalCenters) null else position + 10,
3847
)
3948
} catch (e: Exception) {
4049
LoadResult.Error(e)
@@ -48,7 +57,6 @@ class CenterListPagingSource(private val dataManagerCenter: DataManagerCenter) :
4857

4958
private suspend fun getCenterDbList(): List<Center> = suspendCoroutine { continuation ->
5059
try {
51-
5260
dataManagerCenter.allDatabaseCenters
5361
.observeOn(AndroidSchedulers.mainThread())
5462
.subscribeOn(Schedulers.io())
@@ -69,10 +77,9 @@ class CenterListPagingSource(private val dataManagerCenter: DataManagerCenter) :
6977
}
7078
}
7179

72-
7380
private fun getCenterListWithSync(
7481
centerList: List<Center>,
75-
centerDbList: List<Center>
82+
centerDbList: List<Center>,
7683
): List<Center> {
7784
if (centerDbList.isNotEmpty()) {
7885
centerList.forEach { center ->
@@ -85,4 +92,4 @@ class CenterListPagingSource(private val dataManagerCenter: DataManagerCenter) :
8592
}
8693
return centerList
8794
}
88-
}
95+
}

core/data/src/main/java/com/mifos/core/data/pagingSource/ClientListPagingSource.kt

+14-5
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.core.data.pagingSource
211

312
import androidx.paging.PagingSource
@@ -17,13 +26,13 @@ import kotlin.coroutines.suspendCoroutine
1726
*/
1827

1928
class ClientListPagingSource(
20-
private val dataManagerClient: DataManagerClient
29+
private val dataManagerClient: DataManagerClient,
2130
) : PagingSource<Int, Client>() {
2231

2332
override fun getRefreshKey(state: PagingState<Int, Client>): Int? {
2433
return state.anchorPosition?.let { position ->
2534
state.closestPageToPosition(position)?.prevKey?.plus(10) ?: state.closestPageToPosition(
26-
position
35+
position,
2736
)?.nextKey?.minus(10)
2837
}
2938
}
@@ -39,7 +48,7 @@ class ClientListPagingSource(
3948
LoadResult.Page(
4049
data = clientListWithSync,
4150
prevKey = if (position <= 0) null else position - 10,
42-
nextKey = if (position >= totalClients) null else position + 10
51+
nextKey = if (position >= totalClients) null else position + 10,
4352
)
4453
} catch (e: Exception) {
4554
LoadResult.Error(e)
@@ -73,7 +82,7 @@ class ClientListPagingSource(
7382

7483
private fun getClientListWithSync(
7584
clientList: List<Client>,
76-
clientDbList: List<Client>
85+
clientDbList: List<Client>,
7786
): List<Client> {
7887
if (clientDbList.isNotEmpty()) {
7988
clientList.forEach { client ->
@@ -86,4 +95,4 @@ class ClientListPagingSource(
8695
}
8796
return clientList
8897
}
89-
}
98+
}

core/data/src/main/java/com/mifos/core/data/repository/ActivateRepository.kt

+13-5
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.core.data.repository
211

312
import com.mifos.core.network.GenericResponse
@@ -14,17 +23,16 @@ interface ActivateRepository {
1423

1524
suspend fun activateClient(
1625
clientId: Int,
17-
clientActivate: ActivatePayload?
26+
clientActivate: ActivatePayload?,
1827
): PostClientsClientIdResponse
1928

2029
suspend fun activateCenter(
2130
centerId: Int,
22-
activatePayload: ActivatePayload?
31+
activatePayload: ActivatePayload?,
2332
): PostCentersCenterIdResponse
2433

2534
fun activateGroup(
2635
groupId: Int,
27-
activatePayload: ActivatePayload?
36+
activatePayload: ActivatePayload?,
2837
): Observable<GenericResponse>
29-
30-
}
38+
}

core/data/src/main/java/com/mifos/core/data/repository/ClientDetailsRepository.kt

+10-2
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.core.data.repository
211

312
import com.mifos.core.objects.accounts.ClientAccounts
@@ -18,5 +27,4 @@ interface ClientDetailsRepository {
1827
suspend fun getClientAccounts(clientId: Int): ClientAccounts
1928

2029
suspend fun getClient(clientId: Int): Client
21-
22-
}
30+
}

core/data/src/main/java/com/mifos/core/data/repository/ClientIdentifiersRepository.kt

+11-2
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.core.data.repository
211

312
import com.mifos.core.objects.noncore.Identifier
@@ -12,6 +21,6 @@ interface ClientIdentifiersRepository {
1221

1322
suspend fun deleteClientIdentifier(
1423
clientId: Int,
15-
identifierId: Int
24+
identifierId: Int,
1625
): DeleteClientsClientIdIdentifiersIdentifierIdResponse
17-
}
26+
}

core/data/src/main/java/com/mifos/core/data/repository/DataTableDataRepository.kt

+11-3
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.core.data.repository
211

312
import com.google.gson.JsonArray
@@ -13,7 +22,6 @@ interface DataTableDataRepository {
1322
suspend fun deleteDataTableEntry(
1423
table: String,
1524
entity: Int,
16-
rowId: Int
25+
rowId: Int,
1726
): DeleteDataTablesDatatableAppTableIdDatatableIdResponse
18-
19-
}
27+
}

core/data/src/main/java/com/mifos/core/data/repository/DataTableRepository.kt

+10-2
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.core.data.repository
211

312
import com.mifos.core.objects.noncore.DataTable
@@ -8,5 +17,4 @@ import com.mifos.core.objects.noncore.DataTable
817
interface DataTableRepository {
918

1019
suspend fun getDataTable(tableName: String?): List<DataTable>
11-
12-
}
20+
}

core/data/src/main/java/com/mifos/core/data/repository/LoginRepository.kt

+10-2
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.core.data.repository
211

312
import org.openapitools.client.models.PostAuthenticationResponse
@@ -9,5 +18,4 @@ import org.openapitools.client.models.PostAuthenticationResponse
918
interface LoginRepository {
1019

1120
suspend fun login(username: String, password: String): PostAuthenticationResponse
12-
13-
}
21+
}

core/data/src/main/java/com/mifos/core/data/repositoryImp/ActivateRepositoryImp.kt

+15-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
1-
package com.mifos.core.data.repository_imp
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.core.data.repositoryImp
211

312
import com.mifos.core.data.repository.ActivateRepository
413
import com.mifos.core.network.GenericResponse
@@ -17,27 +26,27 @@ import javax.inject.Inject
1726
class ActivateRepositoryImp @Inject constructor(
1827
private val dataManagerClient: DataManagerClient,
1928
private val dataManagerCenter: DataManagerCenter,
20-
private val dataManagerGroups: DataManagerGroups
29+
private val dataManagerGroups: DataManagerGroups,
2130
) : ActivateRepository {
2231

2332
override suspend fun activateClient(
2433
clientId: Int,
25-
clientActivate: ActivatePayload?
34+
clientActivate: ActivatePayload?,
2635
): PostClientsClientIdResponse {
2736
return dataManagerClient.activateClient(clientId, clientActivate)
2837
}
2938

3039
override suspend fun activateCenter(
3140
centerId: Int,
32-
activatePayload: ActivatePayload?
41+
activatePayload: ActivatePayload?,
3342
): PostCentersCenterIdResponse {
3443
return dataManagerCenter.activateCenter(centerId, activatePayload)
3544
}
3645

3746
override fun activateGroup(
3847
groupId: Int,
39-
activatePayload: ActivatePayload?
48+
activatePayload: ActivatePayload?,
4049
): Observable<GenericResponse> {
4150
return dataManagerGroups.activateGroup(groupId, activatePayload)
4251
}
43-
}
52+
}

core/data/src/main/java/com/mifos/core/data/repositoryImp/ClientIdentifiersRepositoryImp.kt

+12-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
1-
package com.mifos.core.data.repository_imp
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.core.data.repositoryImp
211

312
import com.mifos.core.data.repository.ClientIdentifiersRepository
413
import com.mifos.core.network.datamanager.DataManagerClient
@@ -18,9 +27,8 @@ class ClientIdentifiersRepositoryImp @Inject constructor(private val dataManager
1827

1928
override suspend fun deleteClientIdentifier(
2029
clientId: Int,
21-
identifierId: Int
30+
identifierId: Int,
2231
): DeleteClientsClientIdIdentifiersIdentifierIdResponse {
2332
return dataManagerClient.deleteClientIdentifier(clientId, identifierId)
2433
}
25-
26-
}
34+
}

0 commit comments

Comments
 (0)