-
Notifications
You must be signed in to change notification settings - Fork 688
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2245 from openMF/mvvm_architecture
Mvvm architecture
- Loading branch information
Showing
32 changed files
with
1,883 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
app/src/main/java/org/mifos/mobile/repositories/BeneficiaryRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package org.mifos.mobile.repositories | ||
|
||
import io.reactivex.Observable | ||
import okhttp3.ResponseBody | ||
import org.mifos.mobile.models.beneficiary.Beneficiary | ||
import org.mifos.mobile.models.beneficiary.BeneficiaryPayload | ||
import org.mifos.mobile.models.beneficiary.BeneficiaryUpdatePayload | ||
import org.mifos.mobile.models.templates.beneficiary.BeneficiaryTemplate | ||
|
||
interface BeneficiaryRepository { | ||
|
||
fun beneficiaryTemplate(): Observable<BeneficiaryTemplate?>? | ||
|
||
fun createBeneficiary(beneficiaryPayload: BeneficiaryPayload?): Observable<ResponseBody?>? | ||
|
||
fun updateBeneficiary( | ||
beneficiaryId: Long?, | ||
payload: BeneficiaryUpdatePayload?, | ||
): Observable<ResponseBody?>? | ||
|
||
fun deleteBeneficiary(beneficiaryId: Long?): Observable<ResponseBody?>? | ||
|
||
fun beneficiaryList(): Observable<List<Beneficiary?>?>? | ||
|
||
} |
38 changes: 38 additions & 0 deletions
38
app/src/main/java/org/mifos/mobile/repositories/BeneficiaryRepositoryImp.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package org.mifos.mobile.repositories | ||
|
||
import io.reactivex.Observable | ||
import okhttp3.ResponseBody | ||
import org.mifos.mobile.api.DataManager | ||
import org.mifos.mobile.models.beneficiary.Beneficiary | ||
import org.mifos.mobile.models.beneficiary.BeneficiaryPayload | ||
import org.mifos.mobile.models.beneficiary.BeneficiaryUpdatePayload | ||
import org.mifos.mobile.models.templates.beneficiary.BeneficiaryTemplate | ||
import javax.inject.Inject | ||
|
||
class BeneficiaryRepositoryImp @Inject constructor(private val dataManager: DataManager) : | ||
BeneficiaryRepository { | ||
|
||
override fun beneficiaryTemplate(): Observable<BeneficiaryTemplate?>? { | ||
return dataManager.beneficiaryTemplate | ||
} | ||
|
||
override fun createBeneficiary(beneficiaryPayload: BeneficiaryPayload?): Observable<ResponseBody?>? { | ||
return dataManager.createBeneficiary(beneficiaryPayload) | ||
} | ||
|
||
override fun updateBeneficiary( | ||
beneficiaryId: Long?, | ||
payload: BeneficiaryUpdatePayload? | ||
): Observable<ResponseBody?>? { | ||
return dataManager.updateBeneficiary(beneficiaryId, payload) | ||
} | ||
|
||
override fun deleteBeneficiary(beneficiaryId: Long?): Observable<ResponseBody?>? { | ||
return dataManager.deleteBeneficiary(beneficiaryId) | ||
} | ||
|
||
override fun beneficiaryList(): Observable<List<Beneficiary?>?>? { | ||
return dataManager.beneficiaryList | ||
} | ||
|
||
} |
27 changes: 27 additions & 0 deletions
27
app/src/main/java/org/mifos/mobile/repositories/GuarantorRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package org.mifos.mobile.repositories | ||
|
||
import io.reactivex.Observable | ||
import okhttp3.ResponseBody | ||
import org.mifos.mobile.models.guarantor.GuarantorApplicationPayload | ||
import org.mifos.mobile.models.guarantor.GuarantorPayload | ||
import org.mifos.mobile.models.guarantor.GuarantorTemplatePayload | ||
|
||
interface GuarantorRepository { | ||
|
||
fun getGuarantorTemplate(loanId: Long?): Observable<GuarantorTemplatePayload?>? | ||
|
||
fun createGuarantor( | ||
loanId: Long?, | ||
payload: GuarantorApplicationPayload?, | ||
): Observable<ResponseBody?>? | ||
|
||
fun updateGuarantor( | ||
payload: GuarantorApplicationPayload?, | ||
loanId: Long?, | ||
guarantorId: Long?, | ||
): Observable<ResponseBody?>? | ||
|
||
fun deleteGuarantor(loanId: Long?, guarantorId: Long?): Observable<ResponseBody?>? | ||
|
||
fun getGuarantorList(loanId: Long): Observable<List<GuarantorPayload?>?>? | ||
} |
40 changes: 40 additions & 0 deletions
40
app/src/main/java/org/mifos/mobile/repositories/GuarantorRepositoryImp.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package org.mifos.mobile.repositories | ||
|
||
import io.reactivex.Observable | ||
import okhttp3.ResponseBody | ||
import org.mifos.mobile.api.DataManager | ||
import org.mifos.mobile.models.guarantor.GuarantorApplicationPayload | ||
import org.mifos.mobile.models.guarantor.GuarantorPayload | ||
import org.mifos.mobile.models.guarantor.GuarantorTemplatePayload | ||
import javax.inject.Inject | ||
|
||
class GuarantorRepositoryImp @Inject constructor(private val dataManager: DataManager) : | ||
GuarantorRepository { | ||
|
||
override fun getGuarantorTemplate(loanId: Long?): Observable<GuarantorTemplatePayload?>? { | ||
return dataManager.getGuarantorTemplate(loanId) | ||
} | ||
|
||
override fun createGuarantor( | ||
loanId: Long?, | ||
payload: GuarantorApplicationPayload? | ||
): Observable<ResponseBody?>? { | ||
return dataManager.createGuarantor(loanId, payload) | ||
} | ||
|
||
override fun updateGuarantor( | ||
payload: GuarantorApplicationPayload?, | ||
loanId: Long?, | ||
guarantorId: Long? | ||
): Observable<ResponseBody?>? { | ||
return dataManager.updateGuarantor(payload, loanId, guarantorId) | ||
} | ||
|
||
override fun deleteGuarantor(loanId: Long?, guarantorId: Long?): Observable<ResponseBody?>? { | ||
return dataManager.deleteGuarantor(loanId, guarantorId) | ||
} | ||
|
||
override fun getGuarantorList(loanId: Long): Observable<List<GuarantorPayload?>?>? { | ||
return dataManager.getGuarantorList(loanId) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.