-
Notifications
You must be signed in to change notification settings - Fork 435
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor #1447: history package from java to kotlin
- Loading branch information
1 parent
936f29b
commit b362832
Showing
26 changed files
with
1,278 additions
and
1,386 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
85 changes: 0 additions & 85 deletions
85
mifospay/src/main/java/org/mifos/mobilewallet/mifospay/history/HistoryContract.java
This file was deleted.
Oops, something went wrong.
57 changes: 57 additions & 0 deletions
57
mifospay/src/main/java/org/mifos/mobilewallet/mifospay/history/HistoryContract.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,57 @@ | ||
package org.mifos.mobilewallet.mifospay.history | ||
|
||
import org.mifos.mobilewallet.core.data.fineract.entity.accounts.savings.TransferDetail | ||
import org.mifos.mobilewallet.core.domain.model.Transaction | ||
import org.mifos.mobilewallet.core.domain.model.TransactionType | ||
import org.mifos.mobilewallet.mifospay.base.BasePresenter | ||
import org.mifos.mobilewallet.mifospay.base.BaseView | ||
|
||
/** | ||
* Created by naman on 17/8/17. | ||
*/ | ||
interface HistoryContract { | ||
interface TransactionsHistoryAsync { | ||
fun onTransactionsFetchCompleted(transactions: List<Transaction>?) | ||
} | ||
|
||
interface HistoryView : BaseView<TransactionsHistoryPresenter?> { | ||
fun showRecyclerView() | ||
fun showStateView(drawable: Int, title: Int, subtitle: Int) | ||
fun showTransactions(transactions: List<Transaction>?) | ||
fun showEmptyTransactionTypeStateView(drawable: Int, title: String?, subtitle: String?) | ||
fun showTransactionDetailDialog(transactionIndex: Int, accountNumber: String?) | ||
fun showHistoryFetchingProgress() | ||
fun refreshTransactions(transactions: List<Transaction>?) | ||
} | ||
|
||
interface TransactionsHistoryPresenter : BasePresenter { | ||
fun fetchTransactions() | ||
fun filterTransactionType(type: TransactionType?) | ||
fun handleTransactionClick(transactionIndex: Int) | ||
} | ||
|
||
interface TransactionDetailView : BaseView<TransactionDetailPresenter?> { | ||
fun showTransferDetail(transferDetail: TransferDetail?) | ||
fun showProgressBar() | ||
fun hideProgressBar() | ||
fun showToast(message: String?) | ||
} | ||
|
||
interface TransactionDetailPresenter : BasePresenter { | ||
fun getTransferDetail(transferId: Long) | ||
} | ||
|
||
interface SpecificTransactionsView : BaseView<SpecificTransactionsPresenter?> { | ||
fun showSpecificTransactions(specificTransactions: ArrayList<Transaction?>) | ||
fun showProgress() | ||
fun hideProgress() | ||
fun showStateView(drawable: Int, title: Int, subtitle: Int) | ||
} | ||
|
||
interface SpecificTransactionsPresenter : BasePresenter { | ||
fun getSpecificTransactions( | ||
transactions: ArrayList<Transaction?>?, | ||
secondAccountNumber: String? | ||
): ArrayList<Transaction?>? | ||
} | ||
} |
53 changes: 0 additions & 53 deletions
53
mifospay/src/main/java/org/mifos/mobilewallet/mifospay/history/TransactionsHistory.java
This file was deleted.
Oops, something went wrong.
51 changes: 51 additions & 0 deletions
51
mifospay/src/main/java/org/mifos/mobilewallet/mifospay/history/TransactionsHistory.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,51 @@ | ||
package org.mifos.mobilewallet.mifospay.history | ||
|
||
import org.mifos.mobilewallet.core.base.TaskLooper | ||
import org.mifos.mobilewallet.core.base.UseCase.UseCaseCallback | ||
import org.mifos.mobilewallet.core.base.UseCaseFactory | ||
import org.mifos.mobilewallet.core.base.UseCaseHandler | ||
import org.mifos.mobilewallet.core.domain.model.Transaction | ||
import org.mifos.mobilewallet.core.domain.usecase.account.FetchAccount | ||
import org.mifos.mobilewallet.core.domain.usecase.account.FetchAccountTransactions | ||
import org.mifos.mobilewallet.mifospay.history.HistoryContract.TransactionsHistoryAsync | ||
import javax.inject.Inject | ||
|
||
class TransactionsHistory @Inject constructor(private val mUsecaseHandler: UseCaseHandler) { | ||
var delegate: TransactionsHistoryAsync? = null | ||
|
||
@JvmField | ||
@Inject | ||
var mFetchAccountUseCase: FetchAccount? = null | ||
|
||
@JvmField | ||
@Inject | ||
var fetchAccountTransactionsUseCase: FetchAccountTransactions? = null | ||
|
||
@JvmField | ||
@Inject | ||
var mTaskLooper: TaskLooper? = null | ||
|
||
@JvmField | ||
@Inject | ||
var mUseCaseFactory: UseCaseFactory? = null | ||
private var transactions: List<Transaction>? | ||
|
||
init { | ||
transactions = ArrayList() | ||
} | ||
|
||
fun fetchTransactionsHistory(accountId: Long) { | ||
mUsecaseHandler.execute(fetchAccountTransactionsUseCase, | ||
FetchAccountTransactions.RequestValues(accountId), | ||
object : UseCaseCallback<FetchAccountTransactions.ResponseValue?> { | ||
override fun onSuccess(response: FetchAccountTransactions.ResponseValue?) { | ||
transactions = response?.transactions | ||
delegate!!.onTransactionsFetchCompleted(transactions) | ||
} | ||
|
||
override fun onError(message: String) { | ||
transactions = null | ||
} | ||
}) | ||
} | ||
} |
Oops, something went wrong.