This commit is contained in:
Valere 2020-04-02 16:51:40 +02:00
parent bf5ba99653
commit 2f237cf17b
15 changed files with 4 additions and 29 deletions

View file

@ -35,7 +35,6 @@ import im.vector.matrix.android.internal.di.UserId
import im.vector.matrix.android.internal.task.Task import im.vector.matrix.android.internal.task.Task
import timber.log.Timber import timber.log.Timber
import java.util.ArrayList import java.util.ArrayList
import java.util.UUID
import javax.inject.Inject import javax.inject.Inject
internal interface RoomVerificationUpdateTask : Task<RoomVerificationUpdateTask.Params, Unit> { internal interface RoomVerificationUpdateTask : Task<RoomVerificationUpdateTask.Params, Unit> {

View file

@ -55,7 +55,6 @@ class BottomSheetActionButton @JvmOverloads constructor(
@BindView(R.id.itemVerificationClickableZone) @BindView(R.id.itemVerificationClickableZone)
lateinit var clickableView: View lateinit var clickableView: View
var title: String? = null var title: String? = null
set(value) { set(value) {
field = value field = value

View file

@ -83,7 +83,7 @@ class BootstrapAccountPasswordFragment @Inject constructor(
} }
.disposeOnDestroyView() .disposeOnDestroyView()
withState(sharedViewModel) {state -> withState(sharedViewModel) { state ->
(state.step as? BootstrapStep.AccountPassword)?.failure?.let { (state.step as? BootstrapStep.AccountPassword)?.failure?.let {
bootstrapAccountPasswordTil.error = it bootstrapAccountPasswordTil.error = it
} }
@ -111,6 +111,5 @@ class BootstrapAccountPasswordFragment @Inject constructor(
bootstrapAccountPasswordEditText.showPassword(isPasswordVisible, updateCursor = false) bootstrapAccountPasswordEditText.showPassword(isPasswordVisible, updateCursor = false)
ssss_view_show_password.setImageResource(if (isPasswordVisible) R.drawable.ic_eye_closed_black else R.drawable.ic_eye_black) ssss_view_show_password.setImageResource(if (isPasswordVisible) R.drawable.ic_eye_closed_black else R.drawable.ic_eye_black)
} }
} }
} }

View file

@ -29,7 +29,6 @@ sealed class BootstrapActions : VectorViewModelAction {
object GoToCompleted : BootstrapActions() object GoToCompleted : BootstrapActions()
object GoToEnterAccountPassword : BootstrapActions() object GoToEnterAccountPassword : BootstrapActions()
data class DoInitialize(val passphrase: String, val auth: UserPasswordAuth? = null) : BootstrapActions() data class DoInitialize(val passphrase: String, val auth: UserPasswordAuth? = null) : BootstrapActions()
object TogglePasswordVisibility : BootstrapActions() object TogglePasswordVisibility : BootstrapActions()
data class UpdateCandidatePassphrase(val pass: String) : BootstrapActions() data class UpdateCandidatePassphrase(val pass: String) : BootstrapActions()

View file

@ -28,10 +28,8 @@ import androidx.core.content.ContextCompat
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import com.airbnb.mvrx.fragmentViewModel import com.airbnb.mvrx.fragmentViewModel
import com.airbnb.mvrx.withState import com.airbnb.mvrx.withState
import im.vector.matrix.android.internal.crypto.model.rest.UserPasswordAuth
import im.vector.riotx.R import im.vector.riotx.R
import im.vector.riotx.core.di.ScreenComponent import im.vector.riotx.core.di.ScreenComponent
import im.vector.riotx.core.dialogs.PromptPasswordDialog
import im.vector.riotx.core.extensions.commitTransaction import im.vector.riotx.core.extensions.commitTransaction
import im.vector.riotx.core.platform.VectorBaseBottomSheetDialogFragment import im.vector.riotx.core.platform.VectorBaseBottomSheetDialogFragment
import kotlinx.android.synthetic.main.bottom_sheet_bootstrap.* import kotlinx.android.synthetic.main.bottom_sheet_bootstrap.*

View file

@ -58,6 +58,5 @@ class BootstrapConclusionFragment @Inject constructor(
.toSpannable() .toSpannable()
.colorizeMatchingText(getString(R.string.recovery_passphrase), colorProvider.getColorFromAttribute(android.R.attr.textColorLink)) .colorizeMatchingText(getString(R.string.recovery_passphrase), colorProvider.getColorFromAttribute(android.R.attr.textColorLink))
.colorizeMatchingText(getString(R.string.message_key), colorProvider.getColorFromAttribute(android.R.attr.textColorLink)) .colorizeMatchingText(getString(R.string.message_key), colorProvider.getColorFromAttribute(android.R.attr.textColorLink))
} }
} }

View file

@ -120,6 +120,5 @@ class BootstrapConfirmPassphraseFragment @Inject constructor(
ssss_passphrase_enter_edittext.showPassword(isPasswordVisible, updateCursor = false) ssss_passphrase_enter_edittext.showPassword(isPasswordVisible, updateCursor = false)
ssss_view_show_password.setImageResource(if (isPasswordVisible) R.drawable.ic_eye_closed_black else R.drawable.ic_eye_black) ssss_view_show_password.setImageResource(if (isPasswordVisible) R.drawable.ic_eye_closed_black else R.drawable.ic_eye_black)
} }
} }
} }

View file

@ -82,7 +82,6 @@ class BootstrapCrossSigningTask @Inject constructor(
} }
suspend fun execute(params: Params): BootstrapResult { suspend fun execute(params: Params): BootstrapResult {
params.progressListener?.onProgress(WaitingViewData(stringProvider.getString(R.string.bootstrap_crosssigning_progress_initializing), isIndeterminate = true)) params.progressListener?.onProgress(WaitingViewData(stringProvider.getString(R.string.bootstrap_crosssigning_progress_initializing), isIndeterminate = true))
val crossSigningService = session.cryptoService().crossSigningService() val crossSigningService = session.cryptoService().crossSigningService()
@ -98,7 +97,6 @@ class BootstrapCrossSigningTask @Inject constructor(
val ssssService = session.sharedSecretStorageService val ssssService = session.sharedSecretStorageService
params.progressListener?.onProgress(WaitingViewData(stringProvider.getString(R.string.bootstrap_crosssigning_progress_pbkdf2), isIndeterminate = true)) params.progressListener?.onProgress(WaitingViewData(stringProvider.getString(R.string.bootstrap_crosssigning_progress_pbkdf2), isIndeterminate = true))
try { try {
keyInfo = awaitCallback { keyInfo = awaitCallback {
@ -115,7 +113,6 @@ class BootstrapCrossSigningTask @Inject constructor(
return BootstrapResult.FailedToCreateSSSSKey(failure) return BootstrapResult.FailedToCreateSSSSKey(failure)
} }
params.progressListener?.onProgress(WaitingViewData(stringProvider.getString(R.string.bootstrap_crosssigning_progress_default_key), isIndeterminate = true)) params.progressListener?.onProgress(WaitingViewData(stringProvider.getString(R.string.bootstrap_crosssigning_progress_default_key), isIndeterminate = true))
try { try {
awaitCallback<Unit> { awaitCallback<Unit> {
@ -132,7 +129,6 @@ class BootstrapCrossSigningTask @Inject constructor(
val uskPrivateKey = xKeys.user ?: return BootstrapResult.MissingPrivateKey val uskPrivateKey = xKeys.user ?: return BootstrapResult.MissingPrivateKey
try { try {
params.progressListener?.onProgress(WaitingViewData(stringProvider.getString(R.string.bootstrap_crosssigning_progress_save_msk), isIndeterminate = true)) params.progressListener?.onProgress(WaitingViewData(stringProvider.getString(R.string.bootstrap_crosssigning_progress_save_msk), isIndeterminate = true))
awaitCallback<Unit> { awaitCallback<Unit> {
ssssService.storeSecret(MASTER_KEY_SSSS_NAME, mskPrivateKey, listOf(SharedSecretStorageService.KeyRef(keyInfo.keyId, keyInfo.keySpec)), it) ssssService.storeSecret(MASTER_KEY_SSSS_NAME, mskPrivateKey, listOf(SharedSecretStorageService.KeyRef(keyInfo.keyId, keyInfo.keySpec)), it)

View file

@ -130,6 +130,5 @@ class BootstrapEnterPassphraseFragment @Inject constructor(
} }
} }
} }
} }
} }

View file

@ -95,7 +95,6 @@ class BootstrapSaveRecoveryKeyFragment @Inject constructor(
requireActivity().toast(R.string.error_no_external_application_found) requireActivity().toast(R.string.error_no_external_application_found)
sharedViewModel.handle(BootstrapActions.SaveReqFailed) sharedViewModel.handle(BootstrapActions.SaveReqFailed)
} }
} }
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
@ -127,9 +126,7 @@ class BootstrapSaveRecoveryKeyFragment @Inject constructor(
startSharePlainTextIntent(this, startSharePlainTextIntent(this,
context?.getString(R.string.keys_backup_setup_step3_share_intent_chooser_title), context?.getString(R.string.keys_backup_setup_step3_share_intent_chooser_title),
recoveryKey, recoveryKey,
context?.getString(R.string.recovery_key) context?.getString(R.string.recovery_key), REQUEST_CODE_COPY)
, REQUEST_CODE_COPY)
} }
override fun invalidate() = withState(sharedViewModel) { state -> override fun invalidate() = withState(sharedViewModel) { state ->

View file

@ -214,12 +214,10 @@ class BootstrapSharedViewModel @AssistedInject constructor(
copy(recoverySaveFileProcess = Fail(it)) copy(recoverySaveFileProcess = Fail(it))
} }
}) })
} }
} }
private fun startInitializeFlow(auth: UserPasswordAuth?) { private fun startInitializeFlow(auth: UserPasswordAuth?) {
setState { setState {
copy(step = BootstrapStep.Initializing) copy(step = BootstrapStep.Initializing)
} }
@ -234,7 +232,6 @@ class BootstrapSharedViewModel @AssistedInject constructor(
} }
} }
withState { state -> withState { state ->
viewModelScope.launch { viewModelScope.launch {
bootstrapTask.invoke(this, Params( bootstrapTask.invoke(this, Params(
@ -277,7 +274,6 @@ class BootstrapSharedViewModel @AssistedInject constructor(
if (it is BootstrapResult.GenericError if (it is BootstrapResult.GenericError
&& it.failure is im.vector.matrix.android.api.failure.Failure.OtherServerError && it.failure is im.vector.matrix.android.api.failure.Failure.OtherServerError
&& it.failure.httpCode == 401) { && it.failure.httpCode == 401) {
} else { } else {
_viewEvents.post(BootstrapViewEvents.ModalError(it.error ?: stringProvider.getString(R.string.matrix_error))) _viewEvents.post(BootstrapViewEvents.ModalError(it.error ?: stringProvider.getString(R.string.matrix_error)))
setState { setState {
@ -300,7 +296,6 @@ class BootstrapSharedViewModel @AssistedInject constructor(
private fun queryBack() = withState { state -> private fun queryBack() = withState { state ->
when (state.step) { when (state.step) {
is BootstrapStep.SetupPassphrase -> { is BootstrapStep.SetupPassphrase -> {
} }
is BootstrapStep.ConfirmPassphrase -> { is BootstrapStep.ConfirmPassphrase -> {
setState { setState {
@ -311,7 +306,6 @@ class BootstrapSharedViewModel @AssistedInject constructor(
) )
} }
} }
} }
} }

View file

@ -34,4 +34,3 @@ sealed class BootstrapViewEvents : VectorViewEvents {
// val transactionId: String? // val transactionId: String?
// ) : DevicesViewEvents() // ) : DevicesViewEvents()
} }

View file

@ -351,11 +351,11 @@ class VerificationBottomSheet : VectorBaseBottomSheetDialogFragment() {
} }
} }
//fun View.getParentCoordinatorLayout(): CoordinatorLayout? { // fun View.getParentCoordinatorLayout(): CoordinatorLayout? {
// var current = this as? View // var current = this as? View
// while (current != null) { // while (current != null) {
// if (current is CoordinatorLayout) return current // if (current is CoordinatorLayout) return current
// current = current.parent as? View // current = current.parent as? View
// } // }
// return null // return null
//} // }

View file

@ -42,7 +42,6 @@ import im.vector.riotx.core.platform.VectorBaseActivity
import im.vector.riotx.core.pushers.PushersManager import im.vector.riotx.core.pushers.PushersManager
import im.vector.riotx.features.crypto.recover.BootstrapBottomSheet import im.vector.riotx.features.crypto.recover.BootstrapBottomSheet
import im.vector.riotx.features.disclaimer.showDisclaimerDialog import im.vector.riotx.features.disclaimer.showDisclaimerDialog
import im.vector.riotx.features.login.LoginAction
import im.vector.riotx.features.notifications.NotificationDrawerManager import im.vector.riotx.features.notifications.NotificationDrawerManager
import im.vector.riotx.features.popup.PopupAlertManager import im.vector.riotx.features.popup.PopupAlertManager
import im.vector.riotx.features.popup.VerificationVectorAlert import im.vector.riotx.features.popup.VerificationVectorAlert

View file

@ -23,7 +23,6 @@ import im.vector.matrix.android.api.session.events.model.RelationType
import im.vector.matrix.android.api.session.events.model.toModel import im.vector.matrix.android.api.session.events.model.toModel
import im.vector.matrix.android.api.session.room.model.message.MessageRelationContent import im.vector.matrix.android.api.session.room.model.message.MessageRelationContent
import im.vector.matrix.android.api.session.room.model.message.MessageVerificationCancelContent import im.vector.matrix.android.api.session.room.model.message.MessageVerificationCancelContent
import im.vector.matrix.android.api.session.room.model.message.MessageVerificationRequestContent
import im.vector.matrix.android.api.session.room.timeline.TimelineEvent import im.vector.matrix.android.api.session.room.timeline.TimelineEvent
import im.vector.matrix.android.internal.session.room.VerificationState import im.vector.matrix.android.internal.session.room.VerificationState
import im.vector.riotx.core.epoxy.VectorEpoxyModel import im.vector.riotx.core.epoxy.VectorEpoxyModel