Skip to content

Commit

Permalink
Merge pull request #2110 from Infomaniak/clean-code
Browse files Browse the repository at this point in the history
chore: Clean code
  • Loading branch information
KevinBoulongne authored Nov 25, 2024
2 parents 96b5a3c + 7c85645 commit 645b36d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,13 @@ class NoValidMailboxesFragment : Fragment(), MailboxListFragment {

private fun setupAdapters() = with(binding) {

lockedMailboxesRecyclerView.adapter = MailboxesAdapter(isInMenuDrawer, hasValidMailboxes)

invalidPasswordMailboxesRecyclerView.adapter = MailboxesAdapter(
isInMenuDrawer = isInMenuDrawer,
hasValidMailboxes = hasValidMailboxes,
onInvalidPasswordMailboxClicked = { mailbox -> onInvalidPasswordMailboxClicked(mailbox) },
)

lockedMailboxesRecyclerView.adapter = MailboxesAdapter(isInMenuDrawer, hasValidMailboxes)
}

private fun setupListeners() = with(binding) {
Expand All @@ -96,7 +96,8 @@ class NoValidMailboxesFragment : Fragment(), MailboxListFragment {
noValidMailboxesViewModel.invalidPasswordMailboxesLive.observe(viewLifecycleOwner) { invalidPasswordMailboxes ->
invalidPasswordMailboxesAdapter.setMailboxes(invalidPasswordMailboxes)
invalidPasswordMailboxesGroup.isVisible = invalidPasswordMailboxes.isNotEmpty()
invalidPasswordTitle.text = resources.getQuantityString(R.plurals.blockedPasswordTitle, invalidPasswordMailboxes.count())
invalidPasswordTitle.text =
resources.getQuantityString(R.plurals.blockedPasswordTitle, invalidPasswordMailboxes.count())
}

noValidMailboxesViewModel.lockedMailboxesLive.observe(viewLifecycleOwner) { lockedMailboxes ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ class NoValidMailboxesViewModel @Inject constructor(

private val ioCoroutineContext = viewModelScope.coroutineContext(ioDispatcher)

val lockedMailboxesLive = mailboxController.getLockedMailboxes(AccountUtils.currentUserId).asLiveData(ioCoroutineContext)

val invalidPasswordMailboxesLive = mailboxController.getInvalidPasswordMailboxes(AccountUtils.currentUserId)
.asLiveData(ioCoroutineContext)

val lockedMailboxesLive = mailboxController.getLockedMailboxes(AccountUtils.currentUserId).asLiveData(ioCoroutineContext)
}

0 comments on commit 645b36d

Please sign in to comment.