From 7c85645e7639e04da5a7f6dbfe58d278efb6e1de Mon Sep 17 00:00:00 2001 From: Kevin Boulongne Date: Fri, 22 Nov 2024 15:49:42 +0100 Subject: [PATCH] chore: Clean code --- .../mail/ui/noValidMailboxes/NoValidMailboxesFragment.kt | 7 ++++--- .../mail/ui/noValidMailboxes/NoValidMailboxesViewModel.kt | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/infomaniak/mail/ui/noValidMailboxes/NoValidMailboxesFragment.kt b/app/src/main/java/com/infomaniak/mail/ui/noValidMailboxes/NoValidMailboxesFragment.kt index f619e0618c..0205dddbb0 100644 --- a/app/src/main/java/com/infomaniak/mail/ui/noValidMailboxes/NoValidMailboxesFragment.kt +++ b/app/src/main/java/com/infomaniak/mail/ui/noValidMailboxes/NoValidMailboxesFragment.kt @@ -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) { @@ -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 -> diff --git a/app/src/main/java/com/infomaniak/mail/ui/noValidMailboxes/NoValidMailboxesViewModel.kt b/app/src/main/java/com/infomaniak/mail/ui/noValidMailboxes/NoValidMailboxesViewModel.kt index 608a9b7b19..a2ee461aa9 100644 --- a/app/src/main/java/com/infomaniak/mail/ui/noValidMailboxes/NoValidMailboxesViewModel.kt +++ b/app/src/main/java/com/infomaniak/mail/ui/noValidMailboxes/NoValidMailboxesViewModel.kt @@ -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) }