mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-02-16 20:10:04 +03:00
Some cleanup
This commit is contained in:
parent
a4e163885d
commit
18950a6b46
6 changed files with 19 additions and 29 deletions
|
@ -18,19 +18,16 @@ package im.vector.app.features.crypto.quads
|
|||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.core.view.isVisible
|
||||
import com.airbnb.mvrx.activityViewModel
|
||||
import com.airbnb.mvrx.withState
|
||||
import im.vector.app.R
|
||||
import im.vector.app.core.extensions.setTextOrHide
|
||||
import im.vector.app.core.platform.VectorBaseFragment
|
||||
import im.vector.app.core.resources.StringProvider
|
||||
import im.vector.app.features.roommemberprofile.devices.DeviceListBottomSheet
|
||||
import kotlinx.android.synthetic.main.fragment_ssss_reset_all.*
|
||||
import javax.inject.Inject
|
||||
|
||||
class SharedSecuredStorageResetAllFragment @Inject constructor(
|
||||
private val stringProvider: StringProvider
|
||||
) : VectorBaseFragment() {
|
||||
class SharedSecuredStorageResetAllFragment @Inject constructor() : VectorBaseFragment() {
|
||||
|
||||
override fun getLayoutResId() = R.layout.fragment_ssss_reset_all
|
||||
|
||||
|
@ -53,17 +50,12 @@ class SharedSecuredStorageResetAllFragment @Inject constructor(
|
|||
}
|
||||
}
|
||||
|
||||
sharedViewModel.subscribe(this) {
|
||||
if (it.activeDeviceCount == 0) {
|
||||
ssss_reset_other_devices.isVisible = false
|
||||
} else {
|
||||
ssss_reset_other_devices.isVisible = true
|
||||
ssss_reset_other_devices.text = stringProvider.getQuantityString(
|
||||
R.plurals.secure_backup_reset_devices_you_can_verify,
|
||||
it.activeDeviceCount,
|
||||
it.activeDeviceCount
|
||||
)
|
||||
}
|
||||
sharedViewModel.subscribe(this) { state ->
|
||||
ssss_reset_other_devices.setTextOrHide(
|
||||
state.activeDeviceCount
|
||||
.takeIf { it > 0 }
|
||||
?.let { resources.getQuantityString(R.plurals.secure_backup_reset_devices_you_can_verify, it, it) }
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,10 +45,7 @@ class BootstrapBottomSheet : VectorBaseBottomSheetDialogFragment() {
|
|||
|
||||
@Parcelize
|
||||
data class Args(
|
||||
// val initCrossSigningOnly: Boolean,
|
||||
val setUpMode: SetupMode = SetupMode.NORMAL
|
||||
// val forceReset4S: Boolean,
|
||||
// val resetAllUnknownSecrets: Boolean
|
||||
) : Parcelable
|
||||
|
||||
override val showExpanded = true
|
||||
|
|
|
@ -69,11 +69,9 @@ interface BootstrapProgressListener {
|
|||
|
||||
data class Params(
|
||||
val userPasswordAuth: UserPasswordAuth? = null,
|
||||
// val initOnlyCrossSigning: Boolean = false,
|
||||
val progressListener: BootstrapProgressListener? = null,
|
||||
val passphrase: String?,
|
||||
val keySpec: SsssKeySpec? = null,
|
||||
// val resetAllIfNeeded: Boolean = false,
|
||||
val setupMode: SetupMode
|
||||
)
|
||||
|
||||
|
|
|
@ -188,7 +188,7 @@ class VerificationBottomSheet : VectorBaseBottomSheetDialogFragment() {
|
|||
}
|
||||
}
|
||||
|
||||
if (state.quadsHasBeenReseted) {
|
||||
if (state.quadSHasBeenReset) {
|
||||
showFragment(VerificationConclusionFragment::class, Bundle().apply {
|
||||
putParcelable(MvRx.KEY_ARG, VerificationConclusionFragment.Args(
|
||||
isSuccessFull = true,
|
||||
|
|
|
@ -76,7 +76,7 @@ data class VerificationBottomSheetViewState(
|
|||
val userWantsToCancel: Boolean = false,
|
||||
val userThinkItsNotHim: Boolean = false,
|
||||
val quadSContainsSecrets: Boolean = true,
|
||||
val quadsHasBeenReseted: Boolean = false
|
||||
val quadSHasBeenReset: Boolean = false
|
||||
) : MvRxState
|
||||
|
||||
class VerificationBottomSheetViewModel @AssistedInject constructor(
|
||||
|
@ -354,7 +354,7 @@ class VerificationBottomSheetViewModel @AssistedInject constructor(
|
|||
VerificationAction.SecuredStorageHasBeenReseted -> {
|
||||
if (session.cryptoService().crossSigningService().allPrivateKeysKnown()) {
|
||||
setState {
|
||||
copy(quadsHasBeenReseted = true)
|
||||
copy(quadSHasBeenReset = true)
|
||||
}
|
||||
}
|
||||
Unit
|
||||
|
|
|
@ -44,14 +44,18 @@
|
|||
<TextView
|
||||
android:id="@+id/ssss_reset_other_devices"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:drawableStart="@drawable/ic_smartphone"
|
||||
android:drawablePadding="8dp"
|
||||
android:gravity="center_vertical"
|
||||
android:textSize="17sp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintTop_toBottomOf="@id/ssss_reset_all_description"
|
||||
tools:text="Show 2 devices you can verify with now" />
|
||||
tools:text="Show 2 devices you can verify with now"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/ssss_reset_text3"
|
||||
|
@ -65,7 +69,6 @@
|
|||
android:textStyle="bold"
|
||||
android:tint="?riot_primary_text_color"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
||||
app:layout_constraintTop_toBottomOf="@id/ssss_reset_other_devices" />
|
||||
|
||||
<TextView
|
||||
|
@ -83,7 +86,7 @@
|
|||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/ssss_reset_button_cancel"
|
||||
style="@style/Widget.MaterialComponents.Button.TextButton.Icon"
|
||||
style="@style/Widget.MaterialComponents.Button.TextButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/cancel"
|
||||
|
|
Loading…
Add table
Reference in a new issue