Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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