Skip to content

Commit

Permalink
Fix detekt and remove dummy features
Browse files Browse the repository at this point in the history
  • Loading branch information
luispacheco-dev committed May 16, 2024
1 parent 3c52811 commit f031500
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -919,14 +919,14 @@ class EditTransactionViewModel @Inject constructor(

private suspend fun sortCategories(): ImmutableList<Category> {
val categories = categoryRepository.findAll()
val shouldSortCategoriesAlphabetically = shouldSortCategoriesAlphabetically()
?: return categories.toImmutableList()
return if (shouldSortCategoriesAlphabetically)
return if (shouldSortCategoriesAlphabetically()) {
categories.sortedBy { it.name.value }.toImmutableList()
else categories.toImmutableList()
} else {
categories.toImmutableList()
}
}

private suspend fun shouldSortCategoriesAlphabetically(): Boolean? {
return features.sortCategoriesAlphabetically.enabled(context).firstOrNull()
private suspend fun shouldSortCategoriesAlphabetically(): Boolean {
return features.sortCategoriesAlphabetically.enabled(context).firstOrNull() ?: false
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package com.ivy.domain.features

interface Features {
val homeV2: BoolFeature
val compactTransactions: BoolFeature
val sortCategoriesAlphabetically: BoolFeature

val allFeatures: List<BoolFeature>
Expand Down
13 changes: 0 additions & 13 deletions shared/domain/src/main/java/com/ivy/domain/features/IvyFeatures.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,6 @@ import javax.inject.Singleton

@Singleton
class IvyFeatures @Inject constructor() : Features {
override val homeV2 = BoolFeature(
key = "home_v2",
name = "Home screen v2",
description = "Activate the new Home screen."
)
override val compactTransactions = BoolFeature(
key = "compact_transaction",
name = "Compact transactions",
description = "Smaller transactions cards" +
" so you can fit more on your screen."
)
override val sortCategoriesAlphabetically = BoolFeature(
key = "sort_categories_alphabetically",
name = "Sort Categories Alphabetically",
Expand All @@ -25,8 +14,6 @@ class IvyFeatures @Inject constructor() : Features {

override val allFeatures: List<BoolFeature>
get() = listOf(
homeV2,
compactTransactions,
sortCategoriesAlphabetically
)
}

0 comments on commit f031500

Please sign in to comment.