Skip to content

Commit 10830a7

Browse files
committed
updated
1 parent d4c0d92 commit 10830a7

File tree

2 files changed

+26
-32
lines changed

2 files changed

+26
-32
lines changed

feature/center/src/commonMain/kotlin/com/mifos/feature/center/centerList/ui/CenterListScreen.kt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ package com.mifos.feature.center.centerList.ui
1313

1414
import androidclient.feature.center.generated.resources.Res
1515
import androidclient.feature.center.generated.resources.feature_center_error_loading_centers
16+
import androidclient.feature.center.generated.resources.feature_center_ic_done_all_black_24dp
1617
import androidclient.feature.center.generated.resources.feature_center_no_more_centers
1718
import androidclient.feature.center.generated.resources.feature_center_sync
1819
import androidx.compose.foundation.Canvas
@@ -63,17 +64,19 @@ import androidx.compose.ui.text.style.TextAlign
6364
import androidx.compose.ui.unit.dp
6465
import androidx.compose.ui.unit.sp
6566
import androidx.lifecycle.compose.collectAsStateWithLifecycle
67+
import androidx.paging.LoadState
68+
import coil3.compose.AsyncImage
6669
import com.mifos.core.designsystem.component.MifosCircularProgress
6770
import com.mifos.core.designsystem.component.MifosPagingAppendProgress
6871
import com.mifos.core.designsystem.component.MifosSweetError
6972
import com.mifos.core.designsystem.icon.MifosIcons
7073
import com.mifos.core.ui.components.SelectionModeTopAppBar
7174
import com.mifos.feature.center.syncCentersDialog.SyncCenterDialogScreen
7275
import com.mifos.room.entities.group.CenterEntity
73-
import kotlinx.coroutines.flow.flowOf
7476
import org.jetbrains.compose.resources.stringResource
7577
import org.koin.compose.viewmodel.koinViewModel
7678

79+
7780
@Composable
7881
internal fun CenterListScreen(
7982
paddingValues: PaddingValues,
@@ -420,7 +423,7 @@ private fun CenterListContent(
420423
if (centerPagingList[index]?.sync == true) {
421424
AsyncImage(
422425
modifier = Modifier.size(20.dp),
423-
model = R.drawable.feature_center_ic_done_all_black_24dp,
426+
model = Res.drawable.feature_center_ic_done_all_black_24dp,
424427
contentDescription = null,
425428
)
426429
}
@@ -564,7 +567,7 @@ private fun CenterListDbContent(
564567
}
565568
AsyncImage(
566569
modifier = Modifier.size(20.dp),
567-
model = R.drawable.feature_center_ic_done_all_black_24dp,
570+
model = Res.drawable.feature_center_ic_done_all_black_24dp,
568571
contentDescription = null,
569572
)
570573
}

feature/center/src/commonMain/kotlin/com/mifos/feature/center/syncCentersDialog/SyncCentersDialogViewModel.kt

Lines changed: 20 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -346,8 +346,8 @@ class SyncCentersDialogViewModel(
346346
repository.syncLoanRepaymentTemplate(loanId),
347347
) { loanWithAssociations, loanRepaymentTemplate ->
348348
LoanAndLoanRepayment(
349-
loanWithAssociations,
350-
loanRepaymentTemplate,
349+
loanWithAssociations.data,
350+
loanRepaymentTemplate.data,
351351
)
352352
}
353353
}
@@ -376,8 +376,8 @@ class SyncCentersDialogViewModel(
376376
),
377377
) { savingsAccountWithAssociations, savingsAccountTransactionTemplate ->
378378
SavingsAccountAndTransactionTemplate(
379-
savingsAccountWithAssociations,
380-
savingsAccountTransactionTemplate,
379+
savingsAccountWithAssociations.data,
380+
savingsAccountTransactionTemplate.data,
381381
)
382382
}
383383
}
@@ -763,41 +763,32 @@ class SyncCentersDialogViewModel(
763763
}
764764

765765
fun getActiveLoanAccounts(loanAccountList: List<LoanAccountEntity>?): List<LoanAccountEntity> {
766-
val loanAccounts: MutableList<LoanAccountEntity> = ArrayList()
767-
Observable.from(loanAccountList)
768-
.filter { loanAccount -> loanAccount.status?.active }
769-
.subscribe { loanAccount -> loanAccounts.add(loanAccount) }
770-
return loanAccounts
766+
return loanAccountList?.filter {
767+
it.status?.active == true
768+
}.orEmpty()
771769
}
772770

773771
fun getActiveSavingsAccounts(savingsAccounts: List<SavingsAccountEntity>?): List<SavingsAccountEntity> {
774-
val accounts: MutableList<SavingsAccountEntity> = ArrayList()
775-
Observable.from(savingsAccounts)
776-
.filter { savingsAccount ->
777-
savingsAccount.status?.active == true &&
778-
!savingsAccount.depositType!!.isRecurring
772+
return savingsAccounts
773+
?.filter { account ->
774+
account.status?.active == true && account.depositType?.isRecurring == false
779775
}
780-
.subscribe { savingsAccount -> accounts.add(savingsAccount) }
781-
return accounts
776+
.orEmpty()
782777
}
783778

784779
fun getActiveClients(clients: List<ClientEntity>?): List<ClientEntity> {
785-
val accounts: MutableList<ClientEntity> = ArrayList()
786-
Observable.from(clients)
787-
.filter { client -> client.active }
788-
.subscribe { client -> accounts.add(client) }
789-
return accounts
780+
return clients
781+
?.filter { it.active }
782+
.orEmpty()
790783
}
791784

792785
fun getSyncableSavingsAccounts(savingsAccounts: List<SavingsAccountEntity>?): List<SavingsAccountEntity> {
793-
val accounts: MutableList<SavingsAccountEntity> = ArrayList()
794-
Observable.from(savingsAccounts)
795-
.filter { savingsAccount ->
796-
savingsAccount.depositType?.value == "Savings" &&
797-
savingsAccount.status?.active == true &&
798-
!savingsAccount.depositType!!.isRecurring
786+
return savingsAccounts
787+
?.filter { account ->
788+
account.depositType?.value == "Savings" &&
789+
account.status?.active == true &&
790+
account.depositType?.isRecurring == false
799791
}
800-
.subscribe { savingsAccount -> accounts.add(savingsAccount) }
801-
return accounts
792+
.orEmpty()
802793
}
803794
}

0 commit comments

Comments
 (0)