1
0
mirror of https://github.com/wulkanowy/wulkanowy.git synced 2025-02-20 21:44:45 +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)
}
override fun popViewToAccounts() {
(requireActivity() as MainActivity).popView(1)
}
override fun recreateMainView() {
requireActivity().recreate()
}

View File

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

View File

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