From 45c2948ed1818c5a97dcbd9fb12f553caaefc2e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kuba=20Szczodrzy=C5=84ski?= Date: Tue, 12 May 2020 18:23:29 +0200 Subject: [PATCH] [Login] Fix not showing errors after one successful login. --- .../edziennik/ui/modules/login/LoginProgressFragment.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/LoginProgressFragment.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/LoginProgressFragment.kt index 930ee367..7550b08c 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/LoginProgressFragment.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/login/LoginProgressFragment.kt @@ -59,6 +59,8 @@ class LoginProgressFragment : Fragment(), CoroutineScope { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { if (!isAdded) return + EventBus.getDefault().removeStickyEvent(FirstLoginFinishedEvent::class.java) + val args = arguments ?: run { activity.error(ApiError(TAG, LOGIN_NO_ARGUMENTS)) nav.navigateUp() @@ -93,6 +95,7 @@ class LoginProgressFragment : Fragment(), CoroutineScope { @Subscribe(threadMode = ThreadMode.MAIN, sticky = true) fun onFirstLoginFinishedEvent(event: FirstLoginFinishedEvent) { + EventBus.getDefault().removeStickyEvent(event) if (event.profileList.isEmpty()) { MaterialAlertDialogBuilder(activity) .setTitle(R.string.login_account_no_students)