Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating sorting logic in UserPreferencesRepository #32

Open
wants to merge 1 commit into
base: preferences_datastore
Choose a base branch
from

Conversation

anidhamal
Copy link

Issue

Fixes #31

Description

  • Inside enableSortByPriority / enableSortByDeadline methods , checking if the argument is true and SortOrder is already BY_DEADLINE_AND_PRIORITY, perform no updates in preferences.

Videos

Before After

Copy link

@Arrowsome Arrowsome left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of using if blocks, you could use when statement, which IMO makes the code more clear, example for enableSortByPriority method:

if (enable) {
  when (currentOrder) {
    SortOrder.BY_DEADLINE -> SortOrder.BY_DEADLINE_AND_PRIORITY
    SortOrder.NONE -> SortOrder.BY_PRIORITY
    else -> return@edit
  } else {
    // same as before
  }
}

@mmoczkowski mmoczkowski self-requested a review October 3, 2022 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants