mirror of
https://github.com/element-hq/element-android
synced 2024-11-23 09:55:40 +03:00
OIDC redirect to the web page to delete a session (new session manager) #8616
This commit is contained in:
parent
8941e6396c
commit
880ed69f97
3 changed files with 27 additions and 4 deletions
|
@ -39,6 +39,7 @@ import im.vector.app.core.platform.VectorMenuProvider
|
|||
import im.vector.app.core.resources.ColorProvider
|
||||
import im.vector.app.core.resources.DrawableProvider
|
||||
import im.vector.app.core.resources.StringProvider
|
||||
import im.vector.app.core.utils.openUrlInChromeCustomTab
|
||||
import im.vector.app.databinding.FragmentSessionOverviewBinding
|
||||
import im.vector.app.features.auth.ReAuthActivity
|
||||
import im.vector.app.features.crypto.recover.SetupMode
|
||||
|
@ -135,10 +136,19 @@ class SessionOverviewFragment :
|
|||
activity?.let { SignOutUiWorker(it).perform() }
|
||||
}
|
||||
|
||||
private fun confirmSignoutOtherSession() {
|
||||
activity?.let {
|
||||
buildConfirmSignoutDialogUseCase.execute(it, this::signoutSession)
|
||||
.show()
|
||||
private fun confirmSignoutOtherSession() = withState(viewModel) { state ->
|
||||
if (state.externalAccountManagementUrl != null) {
|
||||
// Manage in external account manager
|
||||
openUrlInChromeCustomTab(
|
||||
requireContext(),
|
||||
null,
|
||||
state.externalAccountManagementUrl.removeSuffix("/") + "?action=session_end&device_id=${state.deviceId}"
|
||||
)
|
||||
} else {
|
||||
activity?.let {
|
||||
buildConfirmSignoutDialogUseCase.execute(it, this::signoutSession)
|
||||
.show()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -75,6 +75,18 @@ class SessionOverviewViewModel @AssistedInject constructor(
|
|||
observeNotificationsStatus(initialState.deviceId)
|
||||
refreshIpAddressVisibility()
|
||||
observePreferences()
|
||||
initExternalAccountManagementUrl()
|
||||
}
|
||||
|
||||
private fun initExternalAccountManagementUrl() {
|
||||
setState {
|
||||
copy(
|
||||
externalAccountManagementUrl = activeSessionHolder.getSafeActiveSession()
|
||||
?.homeServerCapabilitiesService()
|
||||
?.getHomeServerCapabilities()
|
||||
?.externalAccountManagementUrl
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences?, key: String?) {
|
||||
|
|
|
@ -29,6 +29,7 @@ data class SessionOverviewViewState(
|
|||
val isLoading: Boolean = false,
|
||||
val notificationsStatus: NotificationsStatus = NotificationsStatus.NOT_SUPPORTED,
|
||||
val isShowingIpAddress: Boolean = false,
|
||||
val externalAccountManagementUrl: String? = null,
|
||||
) : MavericksState {
|
||||
constructor(args: SessionOverviewArgs) : this(
|
||||
deviceId = args.deviceId
|
||||
|
|
Loading…
Reference in a new issue