Add proper copy for safety number bottom sheet when completed check.

This commit is contained in:
Alex Hart
2022-07-13 12:34:15 -03:00
parent 2d29298ec4
commit 71a54ae278
4 changed files with 15 additions and 21 deletions

View File

@@ -127,7 +127,7 @@ class SafetyNumberBottomSheetFragment : DSLSettingsBottomSheetFragment(layoutId
textPref(
title = DSLSettingsText.from(
when {
state.isCheckupComplete() && state.hasLargeNumberOfUntrustedRecipients -> ""
state.isCheckupComplete() && state.hasLargeNumberOfUntrustedRecipients -> getString(R.string.SafetyNumberBottomSheetFragment__all_connections_have_been_reviewed)
state.hasLargeNumberOfUntrustedRecipients -> getString(R.string.SafetyNumberBottomSheetFragment__you_have_d_connections, args.untrustedRecipients.size)
else -> getString(R.string.SafetyNumberBottomSheetFragment__the_following_people)
},
@@ -137,7 +137,7 @@ class SafetyNumberBottomSheetFragment : DSLSettingsBottomSheetFragment(layoutId
)
if (state.isEmpty()) {
space(DimensionUnit.DP.toPixels(96f).toInt())
space(DimensionUnit.DP.toPixels(48f).toInt())
noPadTextPref(
title = DSLSettingsText.from(
@@ -147,6 +147,8 @@ class SafetyNumberBottomSheetFragment : DSLSettingsBottomSheetFragment(layoutId
DSLSettingsText.ColorModifier(ContextCompat.getColor(requireContext(), R.color.signal_colorOnSurfaceVariant))
)
)
space(DimensionUnit.DP.toPixels(48f).toInt())
}
if (!state.hasLargeNumberOfUntrustedRecipients) {

View File

@@ -38,14 +38,16 @@ class SafetyNumberBottomSheetViewModel(
val state: Flowable<SafetyNumberBottomSheetState> = store.stateFlowable.observeOn(AndroidSchedulers.mainThread())
val hasLargeNumberOfUntrustedRecipients
get() = store.state.hasLargeNumberOfUntrustedRecipients
private val disposables = CompositeDisposable()
init {
if (!store.state.hasLargeNumberOfUntrustedRecipients) {
loadRecipients()
val bucketFlowable: Flowable<Map<SafetyNumberBucket, List<SafetyNumberRecipient>>> = destinationStore.stateFlowable.switchMap { repository.getBuckets(args.untrustedRecipients, it) }
disposables += store.update(bucketFlowable) { map, state ->
state.copy(
destinationToRecipientMap = map,
untrustedRecipientCount = map.size,
loadState = if (state.loadState == SafetyNumberBottomSheetState.LoadState.INIT) SafetyNumberBottomSheetState.LoadState.READY else state.loadState
)
}
}
@@ -62,17 +64,6 @@ class SafetyNumberBottomSheetViewModel(
}
}
private fun loadRecipients() {
val bucketFlowable: Flowable<Map<SafetyNumberBucket, List<SafetyNumberRecipient>>> = destinationStore.stateFlowable.switchMap { repository.getBuckets(args.untrustedRecipients, it) }
disposables += store.update(bucketFlowable) { map, state ->
state.copy(
destinationToRecipientMap = map,
untrustedRecipientCount = map.size
)
}
}
override fun onCleared() {
disposables.clear()
}