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

Commit

Permalink
ivyfeatures-text-enhancement
Browse files Browse the repository at this point in the history
  • Loading branch information
nvllz committed Oct 7, 2024
1 parent 2b7c04c commit 8e46b8d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -987,14 +987,14 @@ class EditTransactionViewModel @Inject constructor(

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

private suspend fun shouldSortCategoriesAlphabetically(): Boolean {
return features.sortCategoriesAlphabetically.isEnabled(context)
private suspend fun shouldSortCategoriesAscending(): Boolean {
return features.sortCategoriesAscending.isEnabled(context)
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.ivy.domain.features

interface Features {
val sortCategoriesAlphabetically: BoolFeature
val sortCategoriesAscending: BoolFeature
val compactAccountsMode: BoolFeature
val compactCategoriesMode: BoolFeature
val showTitleSuggestions: BoolFeature
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import javax.inject.Singleton
@Singleton
class IvyFeatures @Inject constructor() : Features {

override val sortCategoriesAlphabetically = BoolFeature(
key = "sort_categories_alphabetically",
override val sortCategoriesAscending = BoolFeature(
key = "sort_categories_ascending",
group = FeatureGroup.Category,
name = "Sort categories list",
description = "Show categories in ascending order (A-Z) on the transaction entry screen"
Expand All @@ -16,15 +16,15 @@ class IvyFeatures @Inject constructor() : Features {
override val compactAccountsMode = BoolFeature(
key = "compact_account_ui",
group = FeatureGroup.Account,
name = "Compact account UI",
name = "Compact account cards",
description = "Make the \"Accounts\" tab UI more compact and dense"
)

override val compactCategoriesMode = BoolFeature(
key = "compact_categories_ui",
key = "compact_category_ui",
group = FeatureGroup.Category,
name = "Compact category UI",
description = "More compact and space-saving layout for the \"Categories\" screen"
name = "Compact category cards",
description = "Simplified design of the \"Categories\" screen"
)

override val showTitleSuggestions = BoolFeature(
Expand Down Expand Up @@ -61,7 +61,7 @@ class IvyFeatures @Inject constructor() : Features {

override val allFeatures: List<BoolFeature>
get() = listOf(
sortCategoriesAlphabetically,
sortCategoriesAscending,
compactAccountsMode,
compactCategoriesMode,
showTitleSuggestions,
Expand Down

0 comments on commit 8e46b8d

Please sign in to comment.