-
Notifications
You must be signed in to change notification settings - Fork 187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sign in with QR code #2793
Sign in with QR code #2793
Conversation
- Force portrait orientation on the login flow. - Create `NumberedList` UI components. - Improve camera permission dialog. - Improve how the QR code preview is rendered. - Freeze the last frame of the preview when a QR code is read. - Update `FlowStepPage` contents to fit the new designs. - Update strings in UI.
This needs `jme/qr-login-for-testing-with-clients` branch in the rust-sdk project
…lient and other SDK services
Rename `QrCodeLoginPresenter` to `QrCodeLoginManager`, since it's not really a presenter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work!
Have not tested yet, but I'll.
Some small remarks/questions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Button is close to the CameraView?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll try to fix it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
6ff42bc, I thought it was going to be harder to fix.
@@ -75,6 +77,7 @@ class NotLoggedInFlowNode @AssistedInject constructor( | |||
@Parcelize | |||
data class LoginFlow( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should not be an enum? I don't think we can have both to true, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
@SingleIn(QrCodeLoginScope::class) | ||
@MergeSubcomponent(QrCodeLoginScope::class) | ||
interface QrCodeLoginComponent : NodeFactoriesBindings { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really need a separate component and scope for this? This is just to keep the StateFlow<QrCodeLoginStep>
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem here is QrCodeLoginManager
had to be shared by several components (QrCodeLofingFlowNode
, QrCodeScanPresenter
) and for that I needed a singleton if I'm not mistaken. But having a singleton can be troublesome if you aren't super careful with cleaning up its state once you're done working with it, so I created a new component to hold it that will be created when the QR code flow starts and discarded once it's finished.
This should ensure the object is shared but can't be leaked in any way, although it's more complex than I intended it to be.
import io.element.android.libraries.architecture.inputs | ||
import io.element.android.libraries.di.AppScope | ||
|
||
@ContributesNode(AppScope::class) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use QrCodeLoginScope
?
import io.element.android.libraries.core.meta.BuildMeta | ||
import io.element.android.libraries.di.AppScope | ||
|
||
@ContributesNode(AppScope::class) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use QrCodeLoginScope
?
import io.element.android.anvilannotations.ContributesNode | ||
import io.element.android.libraries.di.AppScope | ||
|
||
@ContributesNode(AppScope::class) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use QrCodeLoginScope
?
@@ -42,6 +43,7 @@ class StaticFeatureFlagProvider @Inject constructor() : | |||
FeatureFlags.MarkAsUnread -> true | |||
FeatureFlags.RoomDirectorySearch -> false | |||
FeatureFlags.ShowBlockedUsersDetails -> false | |||
FeatureFlags.QrCodeLogin -> OnBoardingConfig.CAN_LOGIN_WITH_QR_CODE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer the value to be directly here...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're probably going to remove the feature flag soon-ish and go back to the build config constant, so I made this compromise because I didn't want to remove the constant just to add it back later or have 1 value that actually does something (FF here) and another that does nothing at the same time.
68efc1f
to
6b5e558
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it's fine since the feature is still disabled (CAN_LOGIN_WITH_QR_CODE = false
)
|
I've tested the latest build against synapse-oidc.lab.element.dev with no issues found. |
Type of change
Content
:libraries:matrix
modules to map data from/to the Rust SDK and perform a QR code login.OnboardingConfig
to:appconfig
.Zxing
library withZxing-CPP
which was re-built in native code and is faster and more accurate (Zxing, or at least the version we had to use was outdated and didn't work well with some generated QRs).Motivation and context
Closes #2632.
Screenshots / GIFs
Lots in the PR.
Tests
Tested devices
Checklist