Handle remarks from PR #1127

This commit is contained in:
Benoit Marty
2023-08-23 17:23:12 +02:00
parent 6941bc69f6
commit 7278fae142
4 changed files with 12 additions and 9 deletions

View File

@@ -68,9 +68,9 @@ class ConfirmAccountProviderPresenter @AssistedInject constructor(
}
LaunchedEffect(Unit) {
launch {
defaultOidcActionFlow.collect {
onOidcAction(it, loginFlowAction)
defaultOidcActionFlow.collect { oidcAction ->
if (oidcAction != null) {
onOidcAction(oidcAction, loginFlowAction)
}
}
}
@@ -113,10 +113,9 @@ class ConfirmAccountProviderPresenter @AssistedInject constructor(
}
private suspend fun onOidcAction(
oidcAction: OidcAction?,
oidcAction: OidcAction,
loginFlowAction: MutableState<Async<LoginFlow>>,
) {
oidcAction ?: return
loginFlowAction.value = Async.Loading()
when (oidcAction) {
OidcAction.GoBack -> {

View File

@@ -34,7 +34,7 @@ import io.element.android.libraries.designsystem.preview.ElementPreviewLight
@Composable
fun LogoutPreferenceView(
state: LogoutPreferenceState,
onSuccessLogout: (String?) -> Unit = {}
onSuccessLogout: (logoutUrlResult: String?) -> Unit
) {
val eventSink = state.eventSink
if (state.logoutAction is Async.Success) {
@@ -96,5 +96,8 @@ internal fun LogoutPreferenceViewDarkPreview() = ElementPreviewDark { ContentToP
@Composable
private fun ContentToPreview() {
LogoutPreferenceView(aLogoutPreferenceState())
LogoutPreferenceView(
aLogoutPreferenceState(),
onSuccessLogout = {}
)
}

View File

@@ -57,7 +57,7 @@ fun PreferencesRootView(
onOpenRageShake: () -> Unit,
onOpenAbout: () -> Unit,
onOpenDeveloperSettings: () -> Unit,
onSuccessLogout: (String?) -> Unit,
onSuccessLogout: (logoutUrlResult: String?) -> Unit,
modifier: Modifier = Modifier,
) {
val snackbarHostState = rememberSnackbarHostState(snackbarMessage = state.snackbarMessage)

View File

@@ -58,7 +58,8 @@ interface MatrixClient : Closeable {
/**
* Logout the user.
* Returns an optional URL. When the URL is there, it should be presented to the user after logout for RP initiated logout on their account page.
* Returns an optional URL. When the URL is there, it should be presented to the user after logout for
* Relying Party (RP) initiated logout on their account page.
*/
suspend fun logout(): String?
suspend fun loadUserDisplayName(): Result<String>