Skip to content
This repository has been archived by the owner on Nov 5, 2024. It is now read-only.

Commit

Permalink
Fix Detekt
Browse files Browse the repository at this point in the history
  • Loading branch information
ILIYANGERMANOV committed Aug 30, 2024
1 parent af17364 commit e695394
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -36,7 +35,6 @@ fun DateTimeRow(
) {
Spacer(Modifier.width(24.dp))

val timeConverter = LocalTimeConverter.current
IvyOutlinedButton(
text = dateTime.formatNicely(),
iconStart = R.drawable.ic_date
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ private fun DueDateCard(
}
}

@Suppress("MagicNumber")
@Preview
@Composable
private fun Preview_OneTime() {
Expand Down

0 comments on commit e695394

Please sign in to comment.