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

fork-5.53.8
Alex Hart 2022-07-13 12:34:15 -03:00
rodzic 2d29298ec4
commit 71a54ae278
4 zmienionych plików z 15 dodań i 21 usunięć

Wyświetl plik

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

Wyświetl plik

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

Wyświetl plik

@ -38,14 +38,16 @@ class SafetyNumberBottomSheetViewModel(
val state: Flowable<SafetyNumberBottomSheetState> = store.stateFlowable.observeOn(AndroidSchedulers.mainThread()) val state: Flowable<SafetyNumberBottomSheetState> = store.stateFlowable.observeOn(AndroidSchedulers.mainThread())
val hasLargeNumberOfUntrustedRecipients
get() = store.state.hasLargeNumberOfUntrustedRecipients
private val disposables = CompositeDisposable() private val disposables = CompositeDisposable()
init { init {
if (!store.state.hasLargeNumberOfUntrustedRecipients) { val bucketFlowable: Flowable<Map<SafetyNumberBucket, List<SafetyNumberRecipient>>> = destinationStore.stateFlowable.switchMap { repository.getBuckets(args.untrustedRecipients, it) }
loadRecipients() 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() { override fun onCleared() {
disposables.clear() disposables.clear()
} }

Wyświetl plik

@ -4948,6 +4948,8 @@
<string name="SafetyNumberBottomSheetFragment__safety_number_checkup">Safety number checkup</string> <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 --> <!-- 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> <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 --> <!-- 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> <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 --> <!-- Menu action to launch safety number verification screen -->