Skip to content

Commit

Permalink
Merge pull request #2079 from Infomaniak/confetti
Browse files Browse the repository at this point in the history
Put back easter egg in Account view
  • Loading branch information
KevinBoulongne authored Oct 18, 2024
2 parents 7e21d85 + dabb618 commit 72c7261
Showing 1 changed file with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,13 @@ import com.infomaniak.mail.MatomoMail.trackAccountEvent
import com.infomaniak.mail.R
import com.infomaniak.mail.databinding.BottomSheetAccountBinding
import com.infomaniak.mail.di.IoDispatcher
import com.infomaniak.mail.ui.MainActivity
import com.infomaniak.mail.ui.alertDialogs.DescriptionAlertDialog
import com.infomaniak.mail.ui.main.user.SwitchUserAdapter
import com.infomaniak.mail.ui.main.user.SwitchUserViewModel
import com.infomaniak.mail.utils.AccountUtils
import com.infomaniak.mail.utils.ConfettiUtils
import com.infomaniak.mail.utils.ConfettiUtils.ConfettiType.COLORED_SNOW
import com.infomaniak.mail.utils.LogoutUser
import com.infomaniak.mail.utils.extensions.bindAlertToViewLifecycle
import com.infomaniak.mail.utils.extensions.launchLoginActivity
Expand All @@ -60,9 +63,20 @@ class AccountBottomSheetDialog : BottomSheetDialogFragment() {

private val switchUserViewModel: SwitchUserViewModel by activityViewModels()

private val accountsAdapter = SwitchUserAdapter(AccountUtils.currentUserId) { user ->
switchUserViewModel.switchAccount(user)
}
private val accountsAdapter = SwitchUserAdapter(
currentUserId = AccountUtils.currentUserId,
onChangingUserAccount = { user ->
if (user.id == AccountUtils.currentUserId) {
ConfettiUtils.onEasterEggConfettiClicked(
container = (activity as? MainActivity)?.getConfettiContainer(),
type = COLORED_SNOW,
matomoValue = "Avatar",
)
} else {
switchUserViewModel.switchAccount(user)
}
},
)

override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
return BottomSheetAccountBinding.inflate(inflater, container, false).also { binding = it }.root
Expand Down

0 comments on commit 72c7261

Please sign in to comment.