Skip to content

Commit

Permalink
refactor: history & merchant package cleanup (#1691)
Browse files Browse the repository at this point in the history
* refactor: history & merchant package cleanup

* refactor: deleted merchants & history package from mifospay module
  • Loading branch information
PratyushSingh07 authored Jul 3, 2024
1 parent f8e9fc1 commit 86fca88
Show file tree
Hide file tree
Showing 49 changed files with 148 additions and 3,991 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,9 @@ val mifosText = Color(0xFF212121)
val chipSelectedColor = Color(0xFF00BFFF)
val creditTextColor = Color(0xFF009688)
val debitTextColor = Color(0xFFF10606)
val otherTextColor = Color.Yellow
val greyBackgroundColor = Color(0xFFF7F7F7)
val primaryDarkBlue = Color(0xFF303F9F)
val primaryDarkBlue = Color(0xFF303F9F)
val InitialAvatarBgColor = Color(0xFF9999CC)
val submitButtonColor = Color(0xFF0000FF)
val ElectricViolet = Color(0xFF6200EE)
1 change: 0 additions & 1 deletion feature/history/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@ android {
dependencies {
implementation(projects.feature.receipt)
implementation(projects.core.data)
implementation(projects.mifospay)
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
package org.mifospay.feature

import com.mifospay.core.model.entity.accounts.savings.TransferDetail
import com.mifospay.core.model.domain.Transaction
import com.mifospay.core.model.domain.TransactionType
import org.mifospay.base.BasePresenter
import org.mifospay.base.BaseView

/**
* Created by naman on 17/8/17.
Expand All @@ -13,45 +9,4 @@ 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?>?
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ package org.mifospay.feature.specific.transactions
import android.content.Intent
import android.net.Uri
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.viewModels
import androidx.appcompat.app.AppCompatActivity
import dagger.hilt.android.AndroidEntryPoint
import org.mifospay.common.Constants
import org.mifospay.core.designsystem.theme.MifosTheme
import org.mifospay.feature.receipt.ReceiptActivity

@AndroidEntryPoint
class SpecificTransactionsActivity : AppCompatActivity() {
class SpecificTransactionsActivity : ComponentActivity() {

private val viewModel: SpecificTransactionsViewModel by viewModels()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.itemsIndexed
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.rounded.Info
import androidx.compose.material3.Divider
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
Expand All @@ -32,18 +33,17 @@ import com.mifospay.core.model.domain.Transaction
import com.mifospay.core.model.domain.TransactionType
import com.mifospay.core.model.domain.client.Client
import com.mifospay.core.model.entity.accounts.savings.SavingAccount
import org.mifospay.R
import org.mifospay.core.designsystem.component.MfLoadingWheel
import org.mifospay.core.designsystem.component.MifosScaffold
import org.mifospay.core.designsystem.icon.MifosIcons
import org.mifospay.core.designsystem.theme.MifosTheme
import org.mifospay.core.designsystem.theme.creditTextColor
import org.mifospay.core.designsystem.theme.debitTextColor
import org.mifospay.core.designsystem.theme.otherTextColor
import org.mifospay.core.designsystem.theme.primaryDarkBlue
import org.mifospay.core.ui.EmptyContentScreen
import org.mifospay.core.ui.ErrorScreenContent
import org.mifospay.invoice.ui.Divider
import org.mifospay.theme.creditColor
import org.mifospay.theme.debitColor
import org.mifospay.theme.otherColor
import org.mifospay.feature.history.R


@Composable
Expand Down Expand Up @@ -72,22 +72,22 @@ fun SpecificTransactionsScreen(
transactionItemClicked: (String) -> Unit,
) {
MifosScaffold(
topBarTitle = R.string.specific_transactions_history,
topBarTitle = R.string.feature_history_specific_transactions_history,
backPress = backPress,
scaffoldContent = { paddingValues ->
Box(modifier = Modifier.padding(paddingValues)) {
when (uiState) {
SpecificTransactionsUiState.Error -> {
ErrorScreenContent(
modifier = Modifier,
title = stringResource(id = R.string.error_oops),
subTitle = stringResource(id = R.string.unexpected_error_subtitle),
title = stringResource(id = R.string.feature_history_error_oops),
subTitle = stringResource(id = R.string.feature_history_unexpected_error_subtitle),
)
}

SpecificTransactionsUiState.Loading -> {
MfLoadingWheel(
contentDesc = stringResource(R.string.loading),
contentDesc = stringResource(R.string.feature_history_loading),
backgroundColor = Color.White
)
}
Expand All @@ -96,8 +96,8 @@ fun SpecificTransactionsScreen(
if (uiState.transactionsList.isEmpty()) {
EmptyContentScreen(
modifier = Modifier,
title = stringResource(id = R.string.error_oops),
subTitle = stringResource(id = R.string.no_transactions_found),
title = stringResource(id = R.string.feature_history_error_oops),
subTitle = stringResource(id = R.string.feature_history_no_transactions_found),
iconTint = Color.Black,
iconImageVector = Icons.Rounded.Info
)
Expand Down Expand Up @@ -165,19 +165,19 @@ fun SpecificTransactionItem(
) {
Column {
Text(
text = stringResource(id = R.string.transaction_id) + transaction.transactionId,
text = stringResource(id = R.string.feature_receipt_transaction_id) + transaction.transactionId,
style = MaterialTheme.typography.bodyLarge,
color = primaryDarkBlue
)
Text(
text = stringResource(id = R.string.date) + transaction.date,
text = stringResource(id = R.string.feature_receipt_transaction_date) + transaction.date,
style = MaterialTheme.typography.bodyLarge,
)
Text(
text = when (transaction.transactionType) {
TransactionType.DEBIT -> stringResource(id = R.string.debit)
TransactionType.CREDIT -> stringResource(id = R.string.Credit)
TransactionType.OTHER -> stringResource(id = R.string.other)
TransactionType.DEBIT -> stringResource(id = R.string.feature_history_debits)
TransactionType.CREDIT -> stringResource(id = R.string.feature_history_credits)
TransactionType.OTHER -> stringResource(id = R.string.feature_receipt_other)
},
style = MaterialTheme.typography.bodyLarge,
)
Expand All @@ -187,9 +187,9 @@ fun SpecificTransactionItem(
text = "${transaction.currency.code}${transaction.amount}",
style = MaterialTheme.typography.displaySmall,
color = when (transaction.transactionType) {
TransactionType.DEBIT -> debitColor
TransactionType.CREDIT -> creditColor
TransactionType.OTHER -> otherColor
TransactionType.DEBIT -> debitTextColor
TransactionType.CREDIT -> creditTextColor
TransactionType.OTHER -> otherTextColor
},
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.mifospay.core.model.domain.Transaction
import com.mifospay.core.model.domain.TransactionType
import com.mifospay.core.model.entity.accounts.savings.TransferDetail
import org.mifospay.R
import org.mifospay.common.Constants
import org.mifospay.core.designsystem.component.MfLoadingWheel
import org.mifospay.core.designsystem.theme.MifosTheme
import org.mifospay.core.designsystem.theme.primaryDarkBlue
import org.mifospay.core.ui.ErrorScreenContent
import org.mifospay.feature.history.R
import org.mifospay.feature.specific.transactions.SpecificTransactionAccountInfo


Expand Down Expand Up @@ -114,17 +114,17 @@ fun TransactionsDetailContent(
) {
Column {
Text(
text = stringResource(id = R.string.transaction_id) + transaction.transactionId,
text = stringResource(id = R.string.feature_receipt_transaction_id) + transaction.transactionId,
style = MaterialTheme.typography.bodyLarge,
color = primaryDarkBlue
)
Text(
text = stringResource(id = R.string.date) + transaction.date,
text = stringResource(id = R.string.feature_receipt_transaction_date) + transaction.date,
style = MaterialTheme.typography.bodyLarge,
)
if (transaction.receiptId != null) {
Text(
text = stringResource(id = R.string.receipt_id) + transaction.receiptId,
text = stringResource(id = R.string.feature_receipt_pan_id) + transaction.receiptId,
style = MaterialTheme.typography.bodyLarge,
)
}
Expand Down Expand Up @@ -160,7 +160,7 @@ fun TransactionsDetailContent(
HorizontalDivider(modifier = Modifier.padding(vertical = 12.dp))

Text(
text = stringResource(id = R.string.view_receipt),
text = stringResource(id = R.string.feature_receipt_view_Receipt),
style = MaterialTheme.typography.bodyLarge,
color = primaryDarkBlue,
textAlign = TextAlign.Center,
Expand Down
5 changes: 5 additions & 0 deletions feature/history/src/main/res/drawable/ic_send.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:autoMirrored="true" android:height="24dp" android:tint="#000000" android:viewportHeight="24" android:viewportWidth="24" android:width="24dp">

<path android:fillColor="@android:color/white" android:pathData="M2.01,21L23,12 2.01,3 2,10l15,2 -15,2z"/>

</vector>
3 changes: 3 additions & 0 deletions feature/history/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,7 @@
<string name="feature_history_credits">Credits</string>
<string name="feature_history_debits">Debits</string>
<string name="feature_history_loading">Loading</string>
<string name="feature_history_no_transactions_found">No transactions found</string>
<string name="feature_history_specific_transactions_history">Specific Transactions History</string>

</resources>
2 changes: 1 addition & 1 deletion feature/merchants/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ android {
dependencies {
implementation(projects.core.data)
implementation(libs.compose.material)
implementation(projects.feature.history)

//Todo: Remove these after migration of MerchantTransferActivity
implementation("com.jakewharton:butterknife-annotations:10.2.3")
implementation("com.jakewharton:butterknife:10.2.3@aar")
implementation("com.mifos.mobile:mifos-passcode:0.3.0@aar")
implementation(project(":mifospay"))
}
Loading

0 comments on commit 86fca88

Please sign in to comment.