diff --git a/screen/edit-transaction/src/main/java/com/ivy/transaction/EditTransactionScreen.kt b/screen/edit-transaction/src/main/java/com/ivy/transaction/EditTransactionScreen.kt index b87a1f772e..7aa6e97723 100644 --- a/screen/edit-transaction/src/main/java/com/ivy/transaction/EditTransactionScreen.kt +++ b/screen/edit-transaction/src/main/java/com/ivy/transaction/EditTransactionScreen.kt @@ -44,11 +44,10 @@ import com.ivy.legacy.IvyWalletPreview import com.ivy.legacy.data.EditTransactionDisplayLoan import com.ivy.legacy.datamodel.Account import com.ivy.legacy.ivyWalletCtx -import com.ivy.legacy.rootView import com.ivy.legacy.ui.component.edit.TransactionDateTime +import com.ivy.legacy.ui.component.edit.core.Description import com.ivy.legacy.ui.component.tags.AddTagButton import com.ivy.legacy.ui.component.tags.ShowTagModal -import com.ivy.legacy.utils.convertUTCtoLocal import com.ivy.legacy.utils.onScreenStart import com.ivy.navigation.EditPlannedScreen import com.ivy.navigation.EditTransactionScreen @@ -57,11 +56,10 @@ import com.ivy.navigation.navigation import com.ivy.navigation.screenScopedViewModel import com.ivy.ui.R import com.ivy.wallet.domain.data.CustomExchangeRateState +import com.ivy.wallet.domain.data.IvyCurrency import com.ivy.wallet.domain.deprecated.logic.model.CreateAccountData import com.ivy.wallet.domain.deprecated.logic.model.CreateCategoryData import com.ivy.wallet.ui.edit.core.Category -import com.ivy.legacy.ui.component.edit.core.Description -import com.ivy.wallet.domain.data.IvyCurrency import com.ivy.wallet.ui.edit.core.DueDate import com.ivy.wallet.ui.edit.core.EditBottomSheet import com.ivy.wallet.ui.edit.core.Title diff --git a/screen/edit-transaction/src/main/java/com/ivy/transaction/EditTransactionViewModel.kt b/screen/edit-transaction/src/main/java/com/ivy/transaction/EditTransactionViewModel.kt index f58c8a1c26..eb3e0b2220 100644 --- a/screen/edit-transaction/src/main/java/com/ivy/transaction/EditTransactionViewModel.kt +++ b/screen/edit-transaction/src/main/java/com/ivy/transaction/EditTransactionViewModel.kt @@ -306,6 +306,7 @@ class EditTransactionViewModel @Inject constructor( return transactionAssociatedTags.value } + @Suppress("CyclomaticComplexMethod") override fun onEvent(event: EditTransactionViewEvent) { when (event) { is EditTransactionViewEvent.CreateAccount -> createAccount(event.data) @@ -332,14 +333,18 @@ class EditTransactionViewModel @Inject constructor( is EditTransactionViewEvent.Save -> save(event.closeScreen) is EditTransactionViewEvent.SetHasChanges -> setHasChanges(event.hasChangesValue) is EditTransactionViewEvent.UpdateExchangeRate -> updateExchangeRate(event.exRate) - is EditTransactionViewEvent.TagEvent -> when (event) { - is EditTransactionViewEvent.TagEvent.SaveTag -> onTagSaved(event.name) - is EditTransactionViewEvent.TagEvent.OnTagSelect -> associateTagToTransaction(event.selectedTag) - is EditTransactionViewEvent.TagEvent.OnTagDeSelect -> removeTagAssociation(event.selectedTag) - is EditTransactionViewEvent.TagEvent.OnTagSearch -> searchTag(event.query) - is EditTransactionViewEvent.TagEvent.OnTagDelete -> deleteTag(event.selectedTag) - is EditTransactionViewEvent.TagEvent.OnTagEdit -> updateTagInformation(event.newTag) - } + is EditTransactionViewEvent.TagEvent -> handleTagEvent(event) + } + } + + private fun handleTagEvent(event: EditTransactionViewEvent.TagEvent) { + when (event) { + is EditTransactionViewEvent.TagEvent.SaveTag -> onTagSaved(event.name) + is EditTransactionViewEvent.TagEvent.OnTagSelect -> associateTagToTransaction(event.selectedTag) + is EditTransactionViewEvent.TagEvent.OnTagDeSelect -> removeTagAssociation(event.selectedTag) + is EditTransactionViewEvent.TagEvent.OnTagSearch -> searchTag(event.query) + is EditTransactionViewEvent.TagEvent.OnTagDelete -> deleteTag(event.selectedTag) + is EditTransactionViewEvent.TagEvent.OnTagEdit -> updateTagInformation(event.newTag) } } diff --git a/temp/legacy-code/src/main/java/com/ivy/legacy/legacy/ui/theme/components/DateTimeRow.kt b/temp/legacy-code/src/main/java/com/ivy/legacy/legacy/ui/theme/components/DateTimeRow.kt index 8438ff8647..43662c5172 100644 --- a/temp/legacy-code/src/main/java/com/ivy/legacy/legacy/ui/theme/components/DateTimeRow.kt +++ b/temp/legacy-code/src/main/java/com/ivy/legacy/legacy/ui/theme/components/DateTimeRow.kt @@ -8,7 +8,6 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp -import com.ivy.design.api.LocalTimeConverter import com.ivy.legacy.ivyWalletCtx import com.ivy.legacy.utils.convertLocalToUTC import com.ivy.legacy.utils.convertUTCToLocal @@ -36,7 +35,6 @@ fun DateTimeRow( ) { Spacer(Modifier.width(24.dp)) - val timeConverter = LocalTimeConverter.current IvyOutlinedButton( text = dateTime.formatNicely(), iconStart = R.drawable.ic_date diff --git a/temp/legacy-code/src/main/java/com/ivy/legacy/ui/component/edit/core/DueDate.kt b/temp/legacy-code/src/main/java/com/ivy/legacy/ui/component/edit/core/DueDate.kt index 631c8cefa9..3bac46a856 100644 --- a/temp/legacy-code/src/main/java/com/ivy/legacy/ui/component/edit/core/DueDate.kt +++ b/temp/legacy-code/src/main/java/com/ivy/legacy/ui/component/edit/core/DueDate.kt @@ -85,6 +85,7 @@ private fun DueDateCard( } } +@Suppress("MagicNumber") @Preview @Composable private fun Preview_OneTime() {