Skip to content

Commit

Permalink
Converison: Savings Account related fragments
Browse files Browse the repository at this point in the history
  • Loading branch information
iamsh4shank committed Aug 20, 2020
1 parent c59191c commit 39e79f1
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 39e79f1

Please sign in to comment.