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

@ -5,7 +5,6 @@ import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import org.signal.core.util.ThreadUtil
import org.thoughtcrime.securesms.contacts.paged.ContactSearchKey
import org.thoughtcrime.securesms.database.IdentityDatabase
import org.thoughtcrime.securesms.database.SignalDatabase
@ -21,7 +20,7 @@ import org.thoughtcrime.securesms.testing.SignalActivityRule
@RunWith(AndroidJUnit4::class)
class SafetyNumberChangeDialogPreviewer {
@get:Rule val harness = SignalActivityRule(othersCount = 5)
@get:Rule val harness = SignalActivityRule(othersCount = 10)
@Test
fun testShowLongName() {
@ -62,6 +61,6 @@ class SafetyNumberChangeDialogPreviewer {
}
// Uncomment to make dialog stay on screen, otherwise will show/dismiss immediately
ThreadUtil.sleep(15000)
// ThreadUtil.sleep(15000)
}
}

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()
}

View file

@ -4948,6 +4948,8 @@
<string name="SafetyNumberBottomSheetFragment__safety_number_checkup">Safety number checkup</string>
<!-- Title of safety number changes bottom sheet when not showing individual records and user has seen review screen -->
<string name="SafetyNumberBottomSheetFragment__safety_number_checkup_complete">Safety number checkup complete</string>
<!-- Message of safety number changes bottom sheet when not showing individual records and user has seen review screen -->
<string name="SafetyNumberBottomSheetFragment__all_connections_have_been_reviewed">All connections have been reviewed, tap send to continue.</string>
<!-- Message of safety number changes bottom sheet when not showing individual records -->
<string name="SafetyNumberBottomSheetFragment__you_have_d_connections">You have %1$d connections who may have reinstalled Signal or changed devices. Before sharing your story with them review their safety numbers or consider removing them from your story.</string>
<!-- Menu action to launch safety number verification screen -->