Navigate to the instructions screen.

This commit is contained in:
Onuray Sahin 2022-10-06 12:16:24 +03:00
parent 9859dab3cc
commit 5f6c8eebcf
7 changed files with 55 additions and 4 deletions

View File

@ -2168,6 +2168,7 @@
<string name="login_signin_matrix_id_password_notice">If you dont know your password, go back to reset it.</string>
<string name="login_signin_matrix_id_error_invalid_matrix_id">This is not a valid user identifier. Expected format: \'@user:homeserver.org\'</string>
<string name="autodiscover_well_known_error">Unable to find a valid homeserver. Please check your identifier</string>
<string name="login_signin_with_qr_code">Sign in with QR code</string>
<string name="seen_by">Seen by</string>

View File

@ -18,12 +18,31 @@ package im.vector.app.features.login.qr
import android.content.Context
import android.content.Intent
import android.os.Bundle
import android.view.View
import dagger.hilt.android.AndroidEntryPoint
import im.vector.app.core.extensions.addFragment
import im.vector.app.core.platform.SimpleFragmentActivity
@AndroidEntryPoint
class QrCodeLoginActivity : SimpleFragmentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
views.toolbar.visibility = View.GONE
val qrCodeLoginArgs: QrCodeLoginArgs? = intent?.extras?.getParcelable(EXTRA_QR_CODE_LOGIN_ARGS)
if (isFirstCreation()) {
if (qrCodeLoginArgs?.loginType == QrCodeLoginType.LOGIN) {
addFragment(
views.container,
QrCodeLoginInstructionsFragment::class.java,
qrCodeLoginArgs
)
}
}
}
companion object {
private const val EXTRA_QR_CODE_LOGIN_ARGS = "EXTRA_QR_CODE_LOGIN_ARGS"

View File

@ -70,6 +70,8 @@ import im.vector.app.features.location.live.map.LiveLocationMapViewActivity
import im.vector.app.features.location.live.map.LiveLocationMapViewArgs
import im.vector.app.features.login.LoginActivity
import im.vector.app.features.login.LoginConfig
import im.vector.app.features.login.qr.QrCodeLoginActivity
import im.vector.app.features.login.qr.QrCodeLoginArgs
import im.vector.app.features.matrixto.MatrixToBottomSheet
import im.vector.app.features.matrixto.OriginOfMatrixTo
import im.vector.app.features.media.AttachmentData
@ -604,6 +606,14 @@ class DefaultNavigator @Inject constructor(
activityResultLauncher.launch(screenCaptureIntent)
}
override fun openLoginWithQrCode(context: Context, qrCodeLoginArgs: QrCodeLoginArgs) {
QrCodeLoginActivity
.getIntent(context, qrCodeLoginArgs)
.also {
context.startActivity(it)
}
}
private fun Intent.start(context: Context) {
context.startActivity(this)
}

View File

@ -31,6 +31,7 @@ import im.vector.app.features.home.room.threads.arguments.ThreadTimelineArgs
import im.vector.app.features.location.LocationData
import im.vector.app.features.location.LocationSharingMode
import im.vector.app.features.login.LoginConfig
import im.vector.app.features.login.qr.QrCodeLoginArgs
import im.vector.app.features.matrixto.OriginOfMatrixTo
import im.vector.app.features.media.AttachmentData
import im.vector.app.features.pin.PinMode
@ -201,4 +202,9 @@ interface Navigator {
screenCaptureIntent: Intent,
activityResultLauncher: ActivityResultLauncher<Intent>
)
fun openLoginWithQrCode(
context: Context,
qrCodeLoginArgs: QrCodeLoginArgs,
)
}

View File

@ -40,6 +40,8 @@ import im.vector.app.features.login.LoginMode
import im.vector.app.features.login.SSORedirectRouterActivity
import im.vector.app.features.login.SocialLoginButtonsView
import im.vector.app.features.login.SsoState
import im.vector.app.features.login.qr.QrCodeLoginArgs
import im.vector.app.features.login.qr.QrCodeLoginType
import im.vector.app.features.login.render
import im.vector.app.features.onboarding.OnboardingAction
import im.vector.app.features.onboarding.OnboardingViewEvents
@ -70,6 +72,7 @@ class FtueAuthCombinedLoginFragment :
viewModel.handle(OnboardingAction.UserNameEnteredAction.Login(views.loginInput.content()))
}
views.loginForgotPassword.debouncedClicks { viewModel.handle(OnboardingAction.PostViewEvent(OnboardingViewEvents.OnForgetPasswordClicked)) }
views.loginWithQrCode.debouncedClicks { navigator.openLoginWithQrCode(requireActivity(), QrCodeLoginArgs(loginType = QrCodeLoginType.LOGIN)) }
}
private fun setupSubmitButton() {

View File

@ -194,9 +194,9 @@
android:text="@string/ftue_auth_forgot_password"
android:textAllCaps="true"
android:textColor="?colorSecondary"
app:layout_constraintHorizontal_bias="1"
app:layout_constraintBottom_toTopOf="@id/actionSpacing"
app:layout_constraintEnd_toEndOf="@id/loginGutterEnd"
app:layout_constraintHorizontal_bias="1"
app:layout_constraintStart_toStartOf="@id/loginGutterStart"
app:layout_constraintTop_toBottomOf="@id/loginPasswordInput" />
@ -220,6 +220,17 @@
app:layout_constraintStart_toStartOf="@id/loginGutterStart"
app:layout_constraintTop_toBottomOf="@id/actionSpacing" />
<Button
android:id="@+id/loginWithQrCode"
style="@style/Widget.Vector.Button.Outlined.Login"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/login_signin_with_qr_code"
app:layout_constraintEnd_toEndOf="@id/loginGutterEnd"
app:layout_constraintStart_toStartOf="@id/loginGutterStart"
app:layout_constraintTop_toBottomOf="@id/loginSubmit" />
<androidx.constraintlayout.widget.Group
android:id="@+id/ssoGroup"
android:layout_width="wrap_content"
@ -227,7 +238,7 @@
android:visibility="gone"
app:constraint_referenced_ids="ssoButtonsHeader,ssoButtons"
app:layout_constraintBottom_toTopOf="@id/ssoButtonsHeader"
app:layout_constraintTop_toBottomOf="@id/loginSubmit"
app:layout_constraintTop_toBottomOf="@id/loginWithQrCode"
tools:visibility="visible" />
<TextView
@ -242,7 +253,7 @@
app:layout_constraintBottom_toTopOf="@id/ssoButtons"
app:layout_constraintEnd_toEndOf="@id/loginGutterEnd"
app:layout_constraintStart_toStartOf="@id/loginGutterStart"
app:layout_constraintTop_toBottomOf="@id/loginSubmit" />
app:layout_constraintTop_toBottomOf="@id/loginWithQrCode" />
<im.vector.app.features.login.SocialLoginButtonsView
android:id="@+id/ssoButtons"

View File

@ -33,7 +33,7 @@
<Button
android:id="@+id/qrCodeLoginInstructionsShowQrCodeButton"
style="@style/Widget.Vector.Button.Outlined"
style="@style/Widget.Vector.Button.Outlined.Login"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="40dp"
@ -71,6 +71,7 @@
<Button
android:id="@+id/qrCodeLoginInstructionsScanQrCodeButton"
style="@style/Widget.Vector.Button.Login"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"