Skip to content

Commit f56d564

Browse files
authored
fix: Fixed Login Issue & API (#2323)
1 parent 47cb236 commit f56d564

File tree

34 files changed

+229
-381
lines changed

34 files changed

+229
-381
lines changed

README.md

+17-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<div align="center">
22
<img src="https://user-images.githubusercontent.com/37406965/51083189-d5dc3a80-173b-11e9-8ca0-28015e0893ac.png" alt="Android Client" />
33

4-
# Android-Client Android Application for MifosX
4+
# Android-Client - Field Officer Application For MifosX
55

66
This Android application is built on the powerful [MifosX](https://mifosforge.jira.com/wiki/spaces/MIFOSX/overview) platform and written in Kotlin. MifosX is a comprehensive core banking platform designed for field officers to efficiently process transactions, manage client data, track center records, group details, and handle various types of accounts such as loans, savings, and recurring accounts. The application's primary goal is to streamline field operations, making them easier and more efficient.
77

@@ -20,15 +20,20 @@ One of the standout features of this application is its offline capability, allo
2020
[![Slack](https://img.shields.io/badge/Slack-4A154B?style=flat-square&logo=slack&logoColor=white)](https://join.slack.com/t/mifos/shared_invite/zt-2wvi9t82t-DuSBdqdQVOY9fsqsLjkKPA)
2121
[![Jira](https://img.shields.io/badge/jira-%230A0FFF.svg?style=flat-square&logo=jira&logoColor=white)](https://mifosforge.jira.com/jira/software/c/projects/MIFOSAC/issues/?filter=allissues&jql=project%20%3D%20%22MM%22%20ORDER%20BY%20created%20DESC)
2222
[![Zoom](https://img.shields.io/badge/Zoom-2D8CFF?style=flat-square&logo=zoom&logoColor=white)](https://us02web.zoom.us/meeting/register/PIZxFF_3Qi2H056amyjj2Q#/registration)
23+
2324
</div>
2425

25-
> \[!Note]
26+
> \[!Important]
2627
> **We're moving towards to Jira for issue tracking. Please use [Jira](https://mifosforge.jira.com/jira/software/c/projects/MIFOSAC/issues/) for issue tracking.**
2728
> **And Join our [slack](https://join.slack.com/t/mifos/shared_invite/zt-2wvi9t82t-DuSBdqdQVOY9fsqsLjkKPA) community channel `android-client` to discuss all things about Android Client development. Please keep discussions focused and avoid cross-posting across channels.**
2829
> **Please join our daily Mobile Stand-Up on [Zoom](https://us02web.zoom.us/meeting/register/PIZxFF_3Qi2H056amyjj2Q#/registration).**
2930
30-
## Demo credentials
31-
- **Fineract Instance**: `gsoc.mifos.community`
31+
## Download The Latest App
32+
[<img alt='Get it on Google Play' src='https://play.google.com/intl/en_us/badges/static/images/badges/en_badge_web_generic.png' height="80" />](https://play.google.com/store/apps/details?id=com.mifos.mifosxdroid)
33+
[<img alt='Get it on Github' src='https://github.com/user-attachments/assets/28de125a-29d3-42a6-9a2b-66f06c72325f' height="80" />](https://github.com/openMF/android-client/releases/latest)
34+
35+
## Demo Credentials
36+
- **Fineract Instance**: `tt.mifos.community`
3237
- **Username**: `mifos`
3338
- **Password**: `password`
3439

@@ -71,3 +76,11 @@ Special thanks to the incredible code contributors who continue to drive this pr
7176
<a href="https://github.com/openMF/android-client/graphs/contributors">
7277
<img src="https://contrib.rocks/image?repo=openMF/android-client" />
7378
</a>
79+
80+
---
81+
## Join the beta
82+
Try new features before they're officially released and give feedback.
83+
84+
[<img src="https://github.com/user-attachments/assets/a123e5a9-1c99-4b1b-880b-2fdd6e3f56cb" alt="firebase" />](https://appdistribution.firebase.dev/i/0786ea6feeba9468)
85+
![]()
86+
[<img src="https://github.com/user-attachments/assets/4a3c98aa-699c-464c-b171-0252383bd52d" alt="playstore" />](https://play.google.com/apps/testing/com.mifos.mifosxdroid)

core/common/src/main/java/com/mifos/core/common/utils/BaseUrl.kt

-29
This file was deleted.

core/common/src/main/java/com/mifos/core/common/utils/Page.kt

-19
This file was deleted.

core/common/src/main/java/com/mifos/core/common/utils/Resource.kt

+10
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
*/
1010
package com.mifos.core.common.utils
1111

12+
import kotlinx.coroutines.flow.Flow
13+
import kotlinx.coroutines.flow.catch
14+
import kotlinx.coroutines.flow.map
15+
import kotlinx.coroutines.flow.onStart
16+
1217
/**
1318
* Created by Aditya Gupta on 11/02/24.
1419
*/
@@ -21,3 +26,8 @@ sealed class Resource<T>(val data: T? = null, val message: String? = null) {
2126

2227
class Loading<T>(data: T? = null) : Resource<T>(data)
2328
}
29+
30+
fun <T> Flow<T>.asResourceFlow(): Flow<Resource<T>> =
31+
map<T, Resource<T>> { Resource.Success(it) }
32+
.onStart { emit(Resource.Loading()) }
33+
.catch { emit(Resource.Error(it.message ?: "Unknown error", null)) }

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

+5-3
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,21 @@
99
*/
1010
package com.mifos.core.data.repository
1111

12+
import com.mifos.core.common.utils.Resource
1213
import com.mifos.core.objects.noncore.IdentifierCreationResponse
1314
import com.mifos.core.objects.noncore.IdentifierPayload
1415
import com.mifos.core.objects.noncore.IdentifierTemplate
16+
import kotlinx.coroutines.flow.Flow
1517

1618
/**
1719
* Created by Aditya Gupta on 16/08/23.
1820
*/
1921
interface ClientIdentifierDialogRepository {
2022

21-
suspend fun getClientIdentifierTemplate(clientId: Int): IdentifierTemplate
23+
fun getClientIdentifierTemplate(clientId: Int): Flow<Resource<IdentifierTemplate>>
2224

23-
suspend fun createClientIdentifier(
25+
fun createClientIdentifier(
2426
clientId: Int,
2527
identifierPayload: IdentifierPayload,
26-
): IdentifierCreationResponse
28+
): Flow<Resource<IdentifierCreationResponse>>
2729
}

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

+5-3
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@
99
*/
1010
package com.mifos.core.data.repositoryImp
1111

12+
import com.mifos.core.common.utils.Resource
1213
import com.mifos.core.data.repository.ClientIdentifierDialogRepository
1314
import com.mifos.core.network.datamanager.DataManagerClient
1415
import com.mifos.core.objects.noncore.IdentifierCreationResponse
1516
import com.mifos.core.objects.noncore.IdentifierPayload
1617
import com.mifos.core.objects.noncore.IdentifierTemplate
18+
import kotlinx.coroutines.flow.Flow
1719
import javax.inject.Inject
1820

1921
/**
@@ -22,14 +24,14 @@ import javax.inject.Inject
2224
class ClientIdentifierDialogRepositoryImp @Inject constructor(private val dataManagerClient: DataManagerClient) :
2325
ClientIdentifierDialogRepository {
2426

25-
override suspend fun getClientIdentifierTemplate(clientId: Int): IdentifierTemplate {
27+
override fun getClientIdentifierTemplate(clientId: Int): Flow<Resource<IdentifierTemplate>> {
2628
return dataManagerClient.getClientIdentifierTemplate(clientId)
2729
}
2830

29-
override suspend fun createClientIdentifier(
31+
override fun createClientIdentifier(
3032
clientId: Int,
3133
identifierPayload: IdentifierPayload,
32-
): IdentifierCreationResponse {
34+
): Flow<Resource<IdentifierCreationResponse>> {
3335
return dataManagerClient.createClientIdentifier(clientId, identifierPayload)
3436
}
3537
}

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

+10-3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
*/
1010
package com.mifos.core.data.repositoryImp
1111

12+
import android.util.Log
1213
import com.mifos.core.data.repository.LoginRepository
1314
import com.mifos.core.network.datamanger.DataManagerAuth
1415
import org.openapitools.client.models.PostAuthenticationResponse
@@ -18,10 +19,16 @@ import javax.inject.Inject
1819
* Created by Aditya Gupta on 06/08/23.
1920
*/
2021

21-
class LoginRepositoryImp @Inject constructor(private val dataManagerAuth: DataManagerAuth) :
22-
LoginRepository {
22+
class LoginRepositoryImp @Inject constructor(
23+
private val dataManagerAuth: DataManagerAuth,
24+
) : LoginRepository {
2325

2426
override suspend fun login(username: String, password: String): PostAuthenticationResponse {
25-
return dataManagerAuth.login(username, password)
27+
return try {
28+
dataManagerAuth.login(username, password)
29+
} catch (e: Exception) {
30+
Log.e("Login", "${e.message}")
31+
throw e
32+
}
2633
}
2734
}

core/database/src/main/java/com/mifos/core/objects/client/Client.kt

+1
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ data class Client(
100100

101101
@Column
102102
var externalId: String? = null,
103+
103104
) : MifosBaseModel(), Parcelable {
104105

105106
/**

core/domain/src/main/java/com/mifos/core/domain/useCases/CreateClientIdentifierUseCase.kt

+6-12
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,15 @@ import com.mifos.core.data.repository.ClientIdentifierDialogRepository
1414
import com.mifos.core.objects.noncore.IdentifierCreationResponse
1515
import com.mifos.core.objects.noncore.IdentifierPayload
1616
import kotlinx.coroutines.flow.Flow
17-
import kotlinx.coroutines.flow.flow
1817
import javax.inject.Inject
1918

20-
class CreateClientIdentifierUseCase @Inject constructor(private val repository: ClientIdentifierDialogRepository) {
19+
class CreateClientIdentifierUseCase @Inject constructor(
20+
private val repository: ClientIdentifierDialogRepository,
21+
) {
2122

22-
suspend operator fun invoke(
23+
operator fun invoke(
2324
clientId: Int,
2425
identifierPayload: IdentifierPayload,
25-
): Flow<Resource<IdentifierCreationResponse>> = flow {
26-
try {
27-
emit(Resource.Loading())
28-
val response = repository.createClientIdentifier(clientId, identifierPayload)
29-
emit(Resource.Success(response))
30-
} catch (exception: Exception) {
31-
emit(Resource.Error(exception.message.toString()))
32-
}
33-
}
26+
): Flow<Resource<IdentifierCreationResponse>> =
27+
repository.createClientIdentifier(clientId, identifierPayload)
3428
}

core/domain/src/main/java/com/mifos/core/domain/useCases/GetClientIdentifierTemplateUseCase.kt

+5-12
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,11 @@ import com.mifos.core.common.utils.Resource
1313
import com.mifos.core.data.repository.ClientIdentifierDialogRepository
1414
import com.mifos.core.objects.noncore.IdentifierTemplate
1515
import kotlinx.coroutines.flow.Flow
16-
import kotlinx.coroutines.flow.flow
1716
import javax.inject.Inject
1817

19-
class GetClientIdentifierTemplateUseCase @Inject constructor(private val repository: ClientIdentifierDialogRepository) {
20-
21-
suspend operator fun invoke(clientId: Int): Flow<Resource<IdentifierTemplate>> = flow {
22-
try {
23-
emit(Resource.Loading())
24-
val response = repository.getClientIdentifierTemplate(clientId)
25-
emit(Resource.Success(response))
26-
} catch (exception: Exception) {
27-
emit(Resource.Error(exception.message.toString()))
28-
}
29-
}
18+
class GetClientIdentifierTemplateUseCase @Inject constructor(
19+
private val repository: ClientIdentifierDialogRepository,
20+
) {
21+
operator fun invoke(clientId: Int): Flow<Resource<IdentifierTemplate>> =
22+
repository.getClientIdentifierTemplate(clientId)
3023
}

core/model/src/main/kotlin/com/mifos/core/model/ServerConfig.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ data class ServerConfig(
2626
companion object {
2727
val DEFAULT = ServerConfig(
2828
protocol = "https://",
29-
endPoint = "dev.mifos.io",
29+
endPoint = "tt.mifos.community",
3030
apiPath = "/fineract-provider/api/v1/",
3131
port = "80",
3232
tenant = "default",

core/network/src/main/java/com/mifos/core/network/BaseApiManager.kt

+22-51
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import com.google.gson.GsonBuilder
1313
import com.mifos.core.datastore.PrefManager
1414
import com.mifos.core.model.getInstanceUrl
1515
import com.mifos.core.network.adapter.FlowCallAdapterFactory
16+
import com.mifos.core.network.services.AuthService
1617
import com.mifos.core.network.services.CenterService
1718
import com.mifos.core.network.services.ChargeService
1819
import com.mifos.core.network.services.CheckerInboxService
@@ -85,6 +86,8 @@ class BaseApiManager @Inject constructor(
8586
get() = Companion.noteApi
8687
val runReportsService: RunReportsService
8788
get() = Companion.runReportsService
89+
val authApi: AuthService
90+
get() = Companion.authApi
8891

8992
companion object {
9093
private var mRetrofit: Retrofit? = null
@@ -105,59 +108,27 @@ class BaseApiManager @Inject constructor(
105108
private lateinit var noteApi: NoteService
106109
private lateinit var collectionSheetApi: CollectionSheetService
107110
private lateinit var checkerInboxApi: CheckerInboxService
111+
private lateinit var authApi: AuthService
108112

109113
fun init() {
110-
centerApi = createApi(
111-
CenterService::class.java,
112-
)
113-
accountsApi = createApi(
114-
ClientAccountsService::class.java,
115-
)
116-
clientsApi = createApi(
117-
ClientService::class.java,
118-
)
119-
dataTableApi = createApi(
120-
DataTableService::class.java,
121-
)
122-
loanApi = createApi(
123-
LoanService::class.java,
124-
)
125-
savingsApi = createApi(
126-
SavingsAccountService::class.java,
127-
)
128-
searchApi = createApi(
129-
SearchService::class.java,
130-
)
131-
groupApi = createApi(
132-
GroupService::class.java,
133-
)
134-
documentApi = createApi(
135-
DocumentService::class.java,
136-
)
137-
officeApi = createApi(
138-
OfficeService::class.java,
139-
)
140-
staffApi = createApi(
141-
StaffService::class.java,
142-
)
143-
surveyApi = createApi(
144-
SurveyService::class.java,
145-
)
146-
chargeApi = createApi(
147-
ChargeService::class.java,
148-
)
149-
runReportsService = createApi(
150-
RunReportsService::class.java,
151-
)
152-
noteApi = createApi(
153-
NoteService::class.java,
154-
)
155-
collectionSheetApi = createApi(
156-
CollectionSheetService::class.java,
157-
)
158-
checkerInboxApi = createApi(
159-
CheckerInboxService::class.java,
160-
)
114+
centerApi = createApi(CenterService::class.java)
115+
accountsApi = createApi(ClientAccountsService::class.java)
116+
clientsApi = createApi(ClientService::class.java)
117+
dataTableApi = createApi(DataTableService::class.java)
118+
loanApi = createApi(LoanService::class.java)
119+
savingsApi = createApi(SavingsAccountService::class.java)
120+
searchApi = createApi(SearchService::class.java)
121+
groupApi = createApi(GroupService::class.java)
122+
documentApi = createApi(DocumentService::class.java)
123+
officeApi = createApi(OfficeService::class.java)
124+
staffApi = createApi(StaffService::class.java)
125+
surveyApi = createApi(SurveyService::class.java)
126+
chargeApi = createApi(ChargeService::class.java)
127+
runReportsService = createApi(RunReportsService::class.java)
128+
noteApi = createApi(NoteService::class.java)
129+
collectionSheetApi = createApi(CollectionSheetService::class.java)
130+
checkerInboxApi = createApi(CheckerInboxService::class.java)
131+
authApi = createApi(AuthService::class.java)
161132
}
162133

163134
private fun <T> createApi(clazz: Class<T>): T {

core/network/src/main/java/com/mifos/core/network/BaseUrl.kt

-27
This file was deleted.

0 commit comments

Comments
 (0)