Upgrade SDK version to 25.02.26 (#4305)
* Upgrade SDK version to 25.02.26 * Remove OIDC URL result from logout, the SDK no longer provides it * Handle room creation and destruction in a better way * Remove `onSuccessLogout`
This commit is contained in:
parent
3c30bec1c2
commit
274d9dc7c1
40 changed files with 46 additions and 230 deletions
|
|
@ -20,7 +20,6 @@ import dagger.assisted.AssistedInject
|
|||
import io.element.android.anvilannotations.ContributesNode
|
||||
import io.element.android.appconfig.LearnMoreConfig
|
||||
import io.element.android.compound.theme.ElementTheme
|
||||
import io.element.android.features.logout.api.util.onSuccessLogout
|
||||
import io.element.android.features.verifysession.api.VerifySessionEntryPoint
|
||||
import io.element.android.libraries.androidutils.browser.openUrlInChromeCustomTab
|
||||
import io.element.android.libraries.architecture.inputs
|
||||
|
|
@ -56,7 +55,6 @@ class VerifySelfSessionNode @AssistedInject constructor(
|
|||
onEnterRecoveryKey = callback::onEnterRecoveryKey,
|
||||
onResetKey = callback::onResetKey,
|
||||
onFinish = callback::onDone,
|
||||
onSuccessLogout = { onSuccessLogout(activity, isDark, it) },
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ class VerifySelfSessionPresenter @AssistedInject constructor(
|
|||
val skipVerification by sessionPreferencesStore.isSessionVerificationSkipped().collectAsState(initial = false)
|
||||
val sessionVerifiedStatus by sessionVerificationService.sessionVerifiedStatus.collectAsState()
|
||||
val signOutAction = remember {
|
||||
mutableStateOf<AsyncAction<String?>>(AsyncAction.Uninitialized)
|
||||
mutableStateOf<AsyncAction<Unit>>(AsyncAction.Uninitialized)
|
||||
}
|
||||
val step by remember {
|
||||
derivedStateOf {
|
||||
|
|
@ -195,7 +195,7 @@ class VerifySelfSessionPresenter @AssistedInject constructor(
|
|||
.launchIn(this)
|
||||
}
|
||||
|
||||
private fun CoroutineScope.signOut(signOutAction: MutableState<AsyncAction<String?>>) = launch {
|
||||
private fun CoroutineScope.signOut(signOutAction: MutableState<AsyncAction<Unit>>) = launch {
|
||||
suspend {
|
||||
logoutUseCase.logout(ignoreSdkError = true)
|
||||
}.runCatchingUpdatingState(signOutAction)
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import io.element.android.libraries.matrix.api.verification.SessionVerificationD
|
|||
@Immutable
|
||||
data class VerifySelfSessionState(
|
||||
val step: Step,
|
||||
val signOutAction: AsyncAction<String?>,
|
||||
val signOutAction: AsyncAction<Unit>,
|
||||
val displaySkipButton: Boolean,
|
||||
val eventSink: (VerifySelfSessionViewEvents) -> Unit,
|
||||
) {
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ open class VerifySelfSessionStateProvider : PreviewParameterProvider<VerifySelfS
|
|||
|
||||
internal fun aVerifySelfSessionState(
|
||||
step: Step = Step.Initial(canEnterRecoveryKey = false),
|
||||
signOutAction: AsyncAction<String?> = AsyncAction.Uninitialized,
|
||||
signOutAction: AsyncAction<Unit> = AsyncAction.Uninitialized,
|
||||
displaySkipButton: Boolean = false,
|
||||
eventSink: (VerifySelfSessionViewEvents) -> Unit = {},
|
||||
) = VerifySelfSessionState(
|
||||
|
|
|
|||
|
|
@ -58,7 +58,6 @@ fun VerifySelfSessionView(
|
|||
onEnterRecoveryKey: () -> Unit,
|
||||
onResetKey: () -> Unit,
|
||||
onFinish: () -> Unit,
|
||||
onSuccessLogout: (String?) -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
val step = state.step
|
||||
|
|
@ -144,12 +143,7 @@ fun VerifySelfSessionView(
|
|||
AsyncAction.Loading -> {
|
||||
ProgressDialog(text = stringResource(id = R.string.screen_signout_in_progress_dialog_content))
|
||||
}
|
||||
is AsyncAction.Success -> {
|
||||
val latestOnSuccessLogout by rememberUpdatedState(onSuccessLogout)
|
||||
LaunchedEffect(state) {
|
||||
latestOnSuccessLogout(state.signOutAction.data)
|
||||
}
|
||||
}
|
||||
is AsyncAction.Success,
|
||||
is AsyncAction.Confirming,
|
||||
is AsyncAction.Failure,
|
||||
AsyncAction.Uninitialized -> Unit
|
||||
|
|
@ -372,6 +366,5 @@ internal fun VerifySelfSessionViewPreview(@PreviewParameter(VerifySelfSessionSta
|
|||
onEnterRecoveryKey = {},
|
||||
onResetKey = {},
|
||||
onFinish = {},
|
||||
onSuccessLogout = {},
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -314,7 +314,7 @@ class VerifySelfSessionPresenterTest {
|
|||
emitVerifiedStatus(SessionVerifiedStatus.Verified)
|
||||
emitVerificationFlowState(VerificationFlowState.DidFinish)
|
||||
}
|
||||
val signOutLambda = lambdaRecorder<Boolean, String?> { "aUrl" }
|
||||
val signOutLambda = lambdaRecorder<Boolean, Unit> {}
|
||||
val presenter = createVerifySelfSessionPresenter(
|
||||
service,
|
||||
logoutUseCase = FakeLogoutUseCase(signOutLambda)
|
||||
|
|
@ -326,7 +326,6 @@ class VerifySelfSessionPresenterTest {
|
|||
assertThat(awaitItem().signOutAction.isLoading()).isTrue()
|
||||
val finalItem = awaitItem()
|
||||
assertThat(finalItem.signOutAction.isSuccess()).isTrue()
|
||||
assertThat(finalItem.signOutAction.dataOrNull()).isEqualTo("aUrl")
|
||||
signOutLambda.assertions().isCalledOnce().with(value(true))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ import androidx.compose.ui.test.junit4.createAndroidComposeRule
|
|||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import io.element.android.features.verifysession.impl.R
|
||||
import io.element.android.features.verifysession.impl.ui.aEmojisSessionVerificationData
|
||||
import io.element.android.libraries.architecture.AsyncAction
|
||||
import io.element.android.libraries.architecture.AsyncData
|
||||
import io.element.android.libraries.ui.strings.CommonStrings
|
||||
import io.element.android.tests.testutils.EnsureNeverCalled
|
||||
|
|
@ -21,7 +20,6 @@ import io.element.android.tests.testutils.EnsureNeverCalledWithParam
|
|||
import io.element.android.tests.testutils.EventsRecorder
|
||||
import io.element.android.tests.testutils.clickOn
|
||||
import io.element.android.tests.testutils.ensureCalledOnce
|
||||
import io.element.android.tests.testutils.ensureCalledOnceWithParam
|
||||
import io.element.android.tests.testutils.pressBackKey
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
|
|
@ -224,27 +222,12 @@ class VerifySelfSessionViewTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `on success logout - onFinished callback is called immediately`() {
|
||||
val aUrl = "aUrl"
|
||||
ensureCalledOnceWithParam<String?>(aUrl) { callback ->
|
||||
rule.setVerifySelfSessionView(
|
||||
aVerifySelfSessionState(
|
||||
signOutAction = AsyncAction.Success(aUrl),
|
||||
eventSink = EnsureNeverCalledWithParam(),
|
||||
),
|
||||
onSuccessLogout = callback,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun <R : TestRule> AndroidComposeTestRule<R, ComponentActivity>.setVerifySelfSessionView(
|
||||
state: VerifySelfSessionState,
|
||||
onLearnMoreClick: () -> Unit = EnsureNeverCalled(),
|
||||
onEnterRecoveryKey: () -> Unit = EnsureNeverCalled(),
|
||||
onFinished: () -> Unit = EnsureNeverCalled(),
|
||||
onResetKey: () -> Unit = EnsureNeverCalled(),
|
||||
onSuccessLogout: (String?) -> Unit = EnsureNeverCalledWithParam(),
|
||||
) {
|
||||
setContent {
|
||||
VerifySelfSessionView(
|
||||
|
|
@ -253,7 +236,6 @@ class VerifySelfSessionViewTest {
|
|||
onEnterRecoveryKey = onEnterRecoveryKey,
|
||||
onFinish = onFinished,
|
||||
onResetKey = onResetKey,
|
||||
onSuccessLogout = onSuccessLogout,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue