Skip to content

Commit 3391e7c

Browse files
bmartyElementBot
andauthored
Update "Learn more" link (#4686)
* Update target link for "Learn more". * Rename VerifySelfSession* to OutgoingVerification* * Optimize import * Refactor to avoid long line * Update screenshots --------- Co-authored-by: ElementBot <[email protected]>
1 parent 8f484c3 commit 3391e7c

File tree

48 files changed

+194
-196
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+194
-196
lines changed

appconfig/src/main/kotlin/io/element/android/appconfig/LearnMoreConfig.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ package io.element.android.appconfig
99

1010
object LearnMoreConfig {
1111
const val ENCRYPTION_URL: String = "https://element.io/help#encryption"
12+
const val DEVICE_VERIFICATION_URL: String = "https://element.io/help#encryption-device-verification"
1213
const val SECURE_BACKUP_URL: String = "https://element.io/help#encryption5"
1314
const val IDENTITY_CHANGE_URL: String = "https://element.io/help#encryption18"
1415
}

features/ftue/impl/build.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import extension.setupAnvil
2-
import org.gradle.kotlin.dsl.test
32

43
/*
54
* Copyright 2023, 2024 New Vector Ltd.

features/ftue/impl/src/main/kotlin/io/element/android/features/ftue/impl/sessionverification/FtueSessionVerificationFlowNode.kt

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import io.element.android.anvilannotations.ContributesNode
2626
import io.element.android.appconfig.LearnMoreConfig
2727
import io.element.android.features.ftue.impl.sessionverification.choosemode.ChooseSelfVerificationModeNode
2828
import io.element.android.features.securebackup.api.SecureBackupEntryPoint
29-
import io.element.android.features.verifysession.api.VerifySessionEntryPoint
29+
import io.element.android.features.verifysession.api.OutgoingVerificationEntryPoint
3030
import io.element.android.libraries.architecture.BackstackView
3131
import io.element.android.libraries.architecture.BaseFlowNode
3232
import io.element.android.libraries.architecture.createNode
@@ -40,7 +40,7 @@ import kotlinx.parcelize.Parcelize
4040
class FtueSessionVerificationFlowNode @AssistedInject constructor(
4141
@Assisted buildContext: BuildContext,
4242
@Assisted plugins: List<Plugin>,
43-
private val verifySessionEntryPoint: VerifySessionEntryPoint,
43+
private val outgoingVerificationEntryPoint: OutgoingVerificationEntryPoint,
4444
private val secureBackupEntryPoint: SecureBackupEntryPoint,
4545
) : BaseFlowNode<FtueSessionVerificationFlowNode.NavTarget>(
4646
backstack = BackStack(
@@ -94,19 +94,19 @@ class FtueSessionVerificationFlowNode @AssistedInject constructor(
9494
}
9595

9696
override fun onLearnMoreAboutEncryption() {
97-
learnMoreUrl.value = LearnMoreConfig.ENCRYPTION_URL
97+
learnMoreUrl.value = LearnMoreConfig.DEVICE_VERIFICATION_URL
9898
}
9999
}
100100

101101
createNode<ChooseSelfVerificationModeNode>(buildContext, plugins = listOf(callback))
102102
}
103103
is NavTarget.UseAnotherDevice -> {
104-
verifySessionEntryPoint.nodeBuilder(this, buildContext)
105-
.params(VerifySessionEntryPoint.Params(
104+
outgoingVerificationEntryPoint.nodeBuilder(this, buildContext)
105+
.params(OutgoingVerificationEntryPoint.Params(
106106
showDeviceVerifiedScreen = true,
107107
verificationRequest = VerificationRequest.Outgoing.CurrentSession,
108108
))
109-
.callback(object : VerifySessionEntryPoint.Callback {
109+
.callback(object : OutgoingVerificationEntryPoint.Callback {
110110
override fun onDone() {
111111
plugins<Callback>().forEach { it.onDone() }
112112
}
@@ -116,7 +116,8 @@ class FtueSessionVerificationFlowNode @AssistedInject constructor(
116116
}
117117

118118
override fun onLearnMoreAboutEncryption() {
119-
learnMoreUrl.value = LearnMoreConfig.ENCRYPTION_URL
119+
// Note that this callback is never called. The "Learn more" link is not displayed
120+
// for the self session interactive verification.
120121
}
121122
})
122123
.build()

features/preferences/impl/src/test/kotlin/io/element/android/features/preferences/impl/developer/DeveloperSettingsPresenterTest.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import io.element.android.libraries.preferences.test.InMemoryAppPreferencesStore
2525
import io.element.android.tests.testutils.WarmUpRule
2626
import io.element.android.tests.testutils.test
2727
import kotlinx.coroutines.ExperimentalCoroutinesApi
28-
import kotlinx.coroutines.flow.first
2928
import kotlinx.coroutines.test.runTest
3029
import org.junit.Rule
3130
import org.junit.Test

features/roomdetails/impl/src/main/kotlin/io/element/android/features/roomdetails/impl/RoomDetailsFlowNode.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ import io.element.android.features.roomdetails.impl.notificationsettings.RoomNot
3838
import io.element.android.features.roomdetails.impl.rolesandpermissions.RolesAndPermissionsFlowNode
3939
import io.element.android.features.roomdetails.impl.securityandprivacy.SecurityAndPrivacyFlowNode
4040
import io.element.android.features.userprofile.shared.UserProfileNodeHelper
41-
import io.element.android.features.verifysession.api.VerifySessionEntryPoint
41+
import io.element.android.features.verifysession.api.OutgoingVerificationEntryPoint
4242
import io.element.android.libraries.architecture.BackstackWithOverlayBox
4343
import io.element.android.libraries.architecture.BaseFlowNode
4444
import io.element.android.libraries.architecture.createNode
@@ -71,7 +71,7 @@ class RoomDetailsFlowNode @AssistedInject constructor(
7171
private val knockRequestsListEntryPoint: KnockRequestsListEntryPoint,
7272
private val mediaViewerEntryPoint: MediaViewerEntryPoint,
7373
private val mediaGalleryEntryPoint: MediaGalleryEntryPoint,
74-
private val verifySessionEntryPoint: VerifySessionEntryPoint,
74+
private val outgoingVerificationEntryPoint: OutgoingVerificationEntryPoint,
7575
private val reportRoomEntryPoint: ReportRoomEntryPoint,
7676
) : BaseFlowNode<RoomDetailsFlowNode.NavTarget>(
7777
backstack = BackStack(
@@ -328,13 +328,13 @@ class RoomDetailsFlowNode @AssistedInject constructor(
328328
createNode<SecurityAndPrivacyFlowNode>(buildContext)
329329
}
330330
is NavTarget.VerifyUser -> {
331-
val params = VerifySessionEntryPoint.Params(
331+
val params = OutgoingVerificationEntryPoint.Params(
332332
showDeviceVerifiedScreen = true,
333333
verificationRequest = VerificationRequest.Outgoing.User(userId = navTarget.userId,)
334334
)
335-
verifySessionEntryPoint.nodeBuilder(this, buildContext)
335+
outgoingVerificationEntryPoint.nodeBuilder(this, buildContext)
336336
.params(params)
337-
.callback(object : VerifySessionEntryPoint.Callback {
337+
.callback(object : OutgoingVerificationEntryPoint.Callback {
338338
override fun onDone() {
339339
backstack.pop()
340340
}

features/userprofile/impl/src/main/kotlin/io/element/android/features/userprofile/impl/UserProfileFlowNode.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import io.element.android.features.call.api.ElementCallEntryPoint
2525
import io.element.android.features.userprofile.api.UserProfileEntryPoint
2626
import io.element.android.features.userprofile.impl.root.UserProfileNode
2727
import io.element.android.features.userprofile.shared.UserProfileNodeHelper
28-
import io.element.android.features.verifysession.api.VerifySessionEntryPoint
28+
import io.element.android.features.verifysession.api.OutgoingVerificationEntryPoint
2929
import io.element.android.libraries.architecture.BackstackView
3030
import io.element.android.libraries.architecture.BaseFlowNode
3131
import io.element.android.libraries.architecture.createNode
@@ -46,7 +46,7 @@ class UserProfileFlowNode @AssistedInject constructor(
4646
private val elementCallEntryPoint: ElementCallEntryPoint,
4747
private val sessionIdHolder: CurrentSessionIdHolder,
4848
private val mediaViewerEntryPoint: MediaViewerEntryPoint,
49-
private val verifySessionEntryPoint: VerifySessionEntryPoint,
49+
private val outgoingVerificationEntryPoint: OutgoingVerificationEntryPoint,
5050
) : BaseFlowNode<UserProfileFlowNode.NavTarget>(
5151
backstack = BackStack(
5252
initialElement = NavTarget.Root,
@@ -110,11 +110,11 @@ class UserProfileFlowNode @AssistedInject constructor(
110110
.build()
111111
}
112112
is NavTarget.VerifyUser -> {
113-
val params = VerifySessionEntryPoint.Params(
113+
val params = OutgoingVerificationEntryPoint.Params(
114114
showDeviceVerifiedScreen = false,
115115
verificationRequest = VerificationRequest.Outgoing.User(userId = navTarget.userId)
116116
)
117-
verifySessionEntryPoint.nodeBuilder(this, buildContext)
117+
outgoingVerificationEntryPoint.nodeBuilder(this, buildContext)
118118
.params(params)
119119
.build()
120120
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import io.element.android.libraries.architecture.FeatureEntryPoint
1414
import io.element.android.libraries.architecture.NodeInputs
1515
import io.element.android.libraries.matrix.api.verification.VerificationRequest
1616

17-
interface VerifySessionEntryPoint : FeatureEntryPoint {
17+
interface OutgoingVerificationEntryPoint : FeatureEntryPoint {
1818
data class Params(
1919
val showDeviceVerifiedScreen: Boolean,
2020
val verificationRequest: VerificationRequest.Outgoing,
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,29 +11,29 @@ import com.bumble.appyx.core.modality.BuildContext
1111
import com.bumble.appyx.core.node.Node
1212
import com.bumble.appyx.core.plugin.Plugin
1313
import com.squareup.anvil.annotations.ContributesBinding
14-
import io.element.android.features.verifysession.api.VerifySessionEntryPoint
14+
import io.element.android.features.verifysession.api.OutgoingVerificationEntryPoint
1515
import io.element.android.libraries.architecture.createNode
1616
import io.element.android.libraries.di.AppScope
1717
import javax.inject.Inject
1818

1919
@ContributesBinding(AppScope::class)
20-
class DefaultVerifySessionEntryPoint @Inject constructor() : VerifySessionEntryPoint {
21-
override fun nodeBuilder(parentNode: Node, buildContext: BuildContext): VerifySessionEntryPoint.NodeBuilder {
20+
class DefaultOutgoingVerificationEntryPoint @Inject constructor() : OutgoingVerificationEntryPoint {
21+
override fun nodeBuilder(parentNode: Node, buildContext: BuildContext): OutgoingVerificationEntryPoint.NodeBuilder {
2222
val plugins = ArrayList<Plugin>()
2323

24-
return object : VerifySessionEntryPoint.NodeBuilder {
25-
override fun callback(callback: VerifySessionEntryPoint.Callback): VerifySessionEntryPoint.NodeBuilder {
24+
return object : OutgoingVerificationEntryPoint.NodeBuilder {
25+
override fun callback(callback: OutgoingVerificationEntryPoint.Callback): OutgoingVerificationEntryPoint.NodeBuilder {
2626
plugins += callback
2727
return this
2828
}
2929

30-
override fun params(params: VerifySessionEntryPoint.Params): VerifySessionEntryPoint.NodeBuilder {
30+
override fun params(params: OutgoingVerificationEntryPoint.Params): OutgoingVerificationEntryPoint.NodeBuilder {
3131
plugins += params
3232
return this
3333
}
3434

3535
override fun build(): Node {
36-
return parentNode.createNode<VerifySelfSessionNode>(buildContext, plugins)
36+
return parentNode.createNode<OutgoingVerificationNode>(buildContext, plugins)
3737
}
3838
}
3939
}
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,19 @@ import com.bumble.appyx.core.plugin.plugins
1616
import dagger.assisted.Assisted
1717
import dagger.assisted.AssistedInject
1818
import io.element.android.anvilannotations.ContributesNode
19-
import io.element.android.features.verifysession.api.VerifySessionEntryPoint
19+
import io.element.android.features.verifysession.api.OutgoingVerificationEntryPoint
2020
import io.element.android.libraries.architecture.inputs
2121
import io.element.android.libraries.di.SessionScope
2222

2323
@ContributesNode(SessionScope::class)
24-
class VerifySelfSessionNode @AssistedInject constructor(
24+
class OutgoingVerificationNode @AssistedInject constructor(
2525
@Assisted buildContext: BuildContext,
2626
@Assisted plugins: List<Plugin>,
27-
presenterFactory: VerifySelfSessionPresenter.Factory,
27+
presenterFactory: OutgoingVerificationPresenter.Factory,
2828
) : Node(buildContext, plugins = plugins) {
29-
private val callback = plugins<VerifySessionEntryPoint.Callback>().first()
29+
private val callback = plugins<OutgoingVerificationEntryPoint.Callback>().first()
3030

31-
private val inputs = inputs<VerifySessionEntryPoint.Params>()
31+
private val inputs = inputs<OutgoingVerificationEntryPoint.Params>()
3232

3333
private val presenter = presenterFactory.create(
3434
showDeviceVerifiedScreen = inputs.showDeviceVerifiedScreen,
@@ -38,7 +38,7 @@ class VerifySelfSessionNode @AssistedInject constructor(
3838
@Composable
3939
override fun View(modifier: Modifier) {
4040
val state = presenter.present()
41-
VerifySelfSessionView(
41+
OutgoingVerificationView(
4242
state = state,
4343
modifier = modifier,
4444
onLearnMoreClick = callback::onLearnMoreAboutEncryption,
Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -31,30 +31,30 @@ import kotlinx.coroutines.ExperimentalCoroutinesApi
3131
import kotlinx.coroutines.flow.launchIn
3232
import kotlinx.coroutines.flow.onEach
3333
import timber.log.Timber
34-
import io.element.android.features.verifysession.impl.outgoing.VerifySelfSessionStateMachine.Event as StateMachineEvent
35-
import io.element.android.features.verifysession.impl.outgoing.VerifySelfSessionStateMachine.State as StateMachineState
34+
import io.element.android.features.verifysession.impl.outgoing.OutgoingVerificationStateMachine.Event as StateMachineEvent
35+
import io.element.android.features.verifysession.impl.outgoing.OutgoingVerificationStateMachine.State as StateMachineState
3636

37-
class VerifySelfSessionPresenter @AssistedInject constructor(
37+
class OutgoingVerificationPresenter @AssistedInject constructor(
3838
@Assisted private val showDeviceVerifiedScreen: Boolean,
3939
@Assisted private val verificationRequest: VerificationRequest.Outgoing,
4040
private val sessionVerificationService: SessionVerificationService,
4141
private val encryptionService: EncryptionService,
42-
) : Presenter<VerifySelfSessionState> {
42+
) : Presenter<OutgoingVerificationState> {
4343
@AssistedFactory
4444
interface Factory {
4545
fun create(
4646
verificationRequest: VerificationRequest.Outgoing,
4747
showDeviceVerifiedScreen: Boolean,
48-
): VerifySelfSessionPresenter
48+
): OutgoingVerificationPresenter
4949
}
5050

51-
private val stateMachine = VerifySelfSessionStateMachine(
51+
private val stateMachine = OutgoingVerificationStateMachine(
5252
sessionVerificationService = sessionVerificationService,
5353
encryptionService = encryptionService,
5454
)
5555

5656
@Composable
57-
override fun present(): VerifySelfSessionState {
57+
override fun present(): OutgoingVerificationState {
5858
val stateAndDispatch = stateMachine.rememberStateAndDispatch()
5959

6060
val sessionVerifiedStatus by sessionVerificationService.sessionVerifiedStatus.collectAsState()
@@ -63,17 +63,17 @@ class VerifySelfSessionPresenter @AssistedInject constructor(
6363
when (verificationRequest) {
6464
is VerificationRequest.Outgoing.CurrentSession -> {
6565
when (sessionVerifiedStatus) {
66-
SessionVerifiedStatus.Unknown -> VerifySelfSessionState.Step.Loading
66+
SessionVerifiedStatus.Unknown -> OutgoingVerificationState.Step.Loading
6767
SessionVerifiedStatus.NotVerified -> {
6868
stateAndDispatch.state.value.toVerificationStep()
6969
}
7070
SessionVerifiedStatus.Verified -> {
7171
if (stateAndDispatch.state.value != StateMachineState.Initial || showDeviceVerifiedScreen) {
7272
// The user has verified the session, we need to show the success screen
73-
VerifySelfSessionState.Step.Completed
73+
OutgoingVerificationState.Step.Completed
7474
} else {
7575
// Automatic verification, which can happen on freshly created account, in this case, skip the screen
76-
VerifySelfSessionState.Step.Exit
76+
OutgoingVerificationState.Step.Exit
7777
}
7878
}
7979
}
@@ -91,58 +91,60 @@ class VerifySelfSessionPresenter @AssistedInject constructor(
9191
observeVerificationService()
9292
}
9393

94-
fun handleEvents(event: VerifySelfSessionViewEvents) {
94+
fun handleEvents(event: OutgoingVerificationViewEvents) {
9595
Timber.d("Verification user action: ${event::class.simpleName}")
9696
when (event) {
9797
// Just relay the event to the state machine
98-
VerifySelfSessionViewEvents.RequestVerification -> stateAndDispatch.dispatchAction(StateMachineEvent.RequestVerification(verificationRequest))
99-
VerifySelfSessionViewEvents.StartSasVerification -> stateAndDispatch.dispatchAction(StateMachineEvent.StartSasVerification)
100-
VerifySelfSessionViewEvents.ConfirmVerification -> stateAndDispatch.dispatchAction(StateMachineEvent.AcceptChallenge)
101-
VerifySelfSessionViewEvents.DeclineVerification -> stateAndDispatch.dispatchAction(StateMachineEvent.DeclineChallenge)
102-
VerifySelfSessionViewEvents.Cancel -> stateAndDispatch.dispatchAction(StateMachineEvent.Cancel)
103-
VerifySelfSessionViewEvents.Reset -> stateAndDispatch.dispatchAction(StateMachineEvent.Reset)
98+
OutgoingVerificationViewEvents.RequestVerification -> StateMachineEvent.RequestVerification(verificationRequest)
99+
OutgoingVerificationViewEvents.StartSasVerification -> StateMachineEvent.StartSasVerification
100+
OutgoingVerificationViewEvents.ConfirmVerification -> StateMachineEvent.AcceptChallenge
101+
OutgoingVerificationViewEvents.DeclineVerification -> StateMachineEvent.DeclineChallenge
102+
OutgoingVerificationViewEvents.Cancel -> StateMachineEvent.Cancel
103+
OutgoingVerificationViewEvents.Reset -> StateMachineEvent.Reset
104+
}.let { stateMachineEvent ->
105+
stateAndDispatch.dispatchAction(stateMachineEvent)
104106
}
105107
}
106-
return VerifySelfSessionState(
108+
return OutgoingVerificationState(
107109
step = step,
108110
request = verificationRequest,
109111
eventSink = ::handleEvents,
110112
)
111113
}
112114

113-
private fun StateMachineState?.toVerificationStep(): VerifySelfSessionState.Step =
115+
private fun StateMachineState?.toVerificationStep(): OutgoingVerificationState.Step =
114116
when (val machineState = this) {
115117
StateMachineState.Initial, null -> {
116-
VerifySelfSessionState.Step.Initial
118+
OutgoingVerificationState.Step.Initial
117119
}
118120
is StateMachineState.RequestingVerification,
119121
is StateMachineState.StartingSasVerification,
120122
StateMachineState.SasVerificationStarted -> {
121-
VerifySelfSessionState.Step.AwaitingOtherDeviceResponse
123+
OutgoingVerificationState.Step.AwaitingOtherDeviceResponse
122124
}
123125

124126
StateMachineState.VerificationRequestAccepted -> {
125-
VerifySelfSessionState.Step.Ready
127+
OutgoingVerificationState.Step.Ready
126128
}
127129

128130
is StateMachineState.Canceled -> {
129-
VerifySelfSessionState.Step.Canceled
131+
OutgoingVerificationState.Step.Canceled
130132
}
131133

132134
is StateMachineState.Verifying -> {
133135
val async = when (machineState) {
134136
is StateMachineState.Verifying.Replying -> AsyncData.Loading()
135137
else -> AsyncData.Uninitialized
136138
}
137-
VerifySelfSessionState.Step.Verifying(machineState.data, async)
139+
OutgoingVerificationState.Step.Verifying(machineState.data, async)
138140
}
139141

140142
StateMachineState.Completed -> {
141-
VerifySelfSessionState.Step.Completed
143+
OutgoingVerificationState.Step.Completed
142144
}
143145

144146
StateMachineState.Exit -> {
145-
VerifySelfSessionState.Step.Exit
147+
OutgoingVerificationState.Step.Exit
146148
}
147149
}
148150

0 commit comments

Comments
 (0)