1
0
mirror of https://github.com/wulkanowy/wulkanowy.git synced 2025-02-21 20:04:44 +01:00

Fix ghost account after logout not current student (#1518)

This commit is contained in:
Rafał Borcz 2021-09-16 11:29:11 +02:00 committed by GitHub
parent da668f93cf
commit c568bc1515
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 6 deletions

View File

@ -121,10 +121,14 @@ class AccountDetailsFragment :
} }
} }
override fun popView() { override fun popViewToMain() {
(requireActivity() as MainActivity).popView(2) (requireActivity() as MainActivity).popView(2)
} }
override fun popViewToAccounts() {
(requireActivity() as MainActivity).popView(1)
}
override fun recreateMainView() { override fun recreateMainView() {
requireActivity().recreate() requireActivity().recreate()
} }

View File

@ -119,7 +119,7 @@ class AccountDetailsPresenter @Inject constructor(
} }
} }
}.afterLoading { }.afterLoading {
view?.popView() view?.popViewToMain()
}.launch("switch") }.launch("switch")
} }
@ -152,11 +152,14 @@ class AccountDetailsPresenter @Inject constructor(
syncManager.stopSyncWorker() syncManager.stopSyncWorker()
openClearLoginView() openClearLoginView()
} }
studentWithSemesters!!.student.isCurrent -> { studentWithSemesters?.student?.isCurrent == true -> {
Timber.i("Logout result: Logout student and switch to another") Timber.i("Logout result: Logout student and switch to another")
recreateMainView() recreateMainView()
} }
else -> Timber.i("Logout result: Logout student") else -> {
Timber.i("Logout result: Logout student")
recreateMainView()
}
} }
} }
Status.ERROR -> { Status.ERROR -> {
@ -165,7 +168,11 @@ class AccountDetailsPresenter @Inject constructor(
} }
} }
}.afterLoading { }.afterLoading {
view?.popView() if (studentWithSemesters?.student?.isCurrent == true) {
view?.popViewToMain()
} else {
view?.popViewToAccounts()
}
}.launch("logout") }.launch("logout")
} }

View File

@ -15,7 +15,9 @@ interface AccountDetailsView : BaseView {
fun showLogoutConfirmDialog() fun showLogoutConfirmDialog()
fun popView() fun popViewToMain()
fun popViewToAccounts()
fun recreateMainView() fun recreateMainView()