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

View file

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

View file

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

View file

@ -58,7 +58,8 @@ interface MatrixClient : Closeable {
/** /**
* Logout the user. * 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 logout(): String?
suspend fun loadUserDisplayName(): Result<String> suspend fun loadUserDisplayName(): Result<String>