Skip to content

Commit

Permalink
Merge pull request #1542 from robustTechie/savingConversion
Browse files Browse the repository at this point in the history
Converison: Savings Account related fragments
  • Loading branch information
Grandolf49 committed Feb 15, 2021
2 parents 55b5518 + 39e79f1 commit 6cad38e
Show file tree
Hide file tree
Showing 30 changed files with 1,794 additions and 2,161 deletions.

This file was deleted.

Large diffs are not rendered by default.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.mifos.mifosxdroid.online.savingaccountsummary

import com.mifos.api.GenericResponse
import com.mifos.mifosxdroid.base.MvpView
import com.mifos.objects.accounts.savings.SavingsAccountWithAssociations

/**
* Created by Rajan Maurya on 07/06/16.
*/
interface SavingsAccountSummaryMvpView : MvpView {
fun showSavingAccount(savingsAccountWithAssociations: SavingsAccountWithAssociations?)
fun showSavingsActivatedSuccessfully(genericResponse: GenericResponse?)
fun showFetchingError(errorMessage: Int)
fun showFetchingError(errorMessage: String?)
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package com.mifos.mifosxdroid.online.savingaccountsummary

import com.mifos.api.datamanager.DataManagerSavings
import com.mifos.mifosxdroid.R
import com.mifos.mifosxdroid.base.BasePresenter
import com.mifos.objects.accounts.savings.SavingsAccountWithAssociations
import com.mifos.utils.Constants
import rx.Subscriber
import rx.android.schedulers.AndroidSchedulers
import rx.schedulers.Schedulers
import rx.subscriptions.CompositeSubscription
import javax.inject.Inject

/**
* Created by Rajan Maurya on 07/06/16.
*/
class SavingsAccountSummaryPresenter @Inject constructor(private val mDataManagerSavings: DataManagerSavings) : BasePresenter<SavingsAccountSummaryMvpView?>() {
private val mSubscriptions: CompositeSubscription
override fun attachView(mvpView: SavingsAccountSummaryMvpView?) {
super.attachView(mvpView)
}

override fun detachView() {
super.detachView()
mSubscriptions.unsubscribe()
}

//This Method will hit end point ?associations=transactions
fun loadSavingAccount(type: String?, accountId: Int) {
checkViewAttached()
mvpView!!.showProgressbar(true)
mSubscriptions.add(mDataManagerSavings
.getSavingsAccount(type, accountId, Constants.TRANSACTIONS)
.observeOn(AndroidSchedulers.mainThread())
.subscribeOn(Schedulers.io())
.subscribe(object : Subscriber<SavingsAccountWithAssociations?>() {
override fun onCompleted() {
mvpView!!.showProgressbar(false)
}

override fun onError(e: Throwable) {
mvpView!!.showProgressbar(false)
mvpView!!.showFetchingError(R.string.failed_to_fetch_savingsaccount)
}

override fun onNext(savingsAccountWithAssociations: SavingsAccountWithAssociations?) {
mvpView!!.showProgressbar(false)
mvpView!!.showSavingAccount(savingsAccountWithAssociations)
}
}))
}

init {
mSubscriptions = CompositeSubscription()
}
}
Loading

0 comments on commit 6cad38e

Please sign in to comment.