Only show ACI SN's.
This commit is contained in:
parent
772bafbe43
commit
dcb870c432
6 changed files with 5 additions and 255 deletions
|
@ -1,79 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright 2023 Signal Messenger, LLC
|
|
||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.thoughtcrime.securesms.verify
|
|
||||||
|
|
||||||
import android.animation.Animator
|
|
||||||
import android.app.Dialog
|
|
||||||
import android.os.Bundle
|
|
||||||
import android.view.LayoutInflater
|
|
||||||
import android.view.View
|
|
||||||
import android.view.ViewGroup
|
|
||||||
import androidx.fragment.app.FragmentManager
|
|
||||||
import com.airbnb.lottie.LottieDrawable
|
|
||||||
import com.google.android.material.bottomsheet.BottomSheetBehavior
|
|
||||||
import com.google.android.material.bottomsheet.BottomSheetDialog
|
|
||||||
import org.thoughtcrime.securesms.R
|
|
||||||
import org.thoughtcrime.securesms.animation.AnimationCompleteListener
|
|
||||||
import org.thoughtcrime.securesms.components.FixedRoundedCornerBottomSheetDialogFragment
|
|
||||||
import org.thoughtcrime.securesms.components.ViewBinderDelegate
|
|
||||||
import org.thoughtcrime.securesms.databinding.SafetyNumberPnpEducationBottomSheetBinding
|
|
||||||
import org.thoughtcrime.securesms.keyvalue.SignalStore
|
|
||||||
import org.thoughtcrime.securesms.util.BottomSheetUtil
|
|
||||||
import org.thoughtcrime.securesms.util.CommunicationActions
|
|
||||||
import org.thoughtcrime.securesms.util.visible
|
|
||||||
|
|
||||||
class PnpSafetyNumberEducationDialogFragment : FixedRoundedCornerBottomSheetDialogFragment() {
|
|
||||||
private val binding by ViewBinderDelegate(SafetyNumberPnpEducationBottomSheetBinding::bind)
|
|
||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
|
|
||||||
return inflater.inflate(R.layout.safety_number_pnp_education_bottom_sheet, container, false)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
|
||||||
val dialog = super.onCreateDialog(savedInstanceState) as BottomSheetDialog
|
|
||||||
dialog.behavior.skipCollapsed = true
|
|
||||||
dialog.setOnShowListener {
|
|
||||||
dialog.behavior.state = BottomSheetBehavior.STATE_EXPANDED
|
|
||||||
}
|
|
||||||
return dialog
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
|
||||||
super.onViewCreated(view, savedInstanceState)
|
|
||||||
|
|
||||||
binding.lottie.visible = true
|
|
||||||
binding.lottie.playAnimation()
|
|
||||||
binding.lottie.addAnimatorListener(object : AnimationCompleteListener() {
|
|
||||||
override fun onAnimationEnd(animation: Animator) {
|
|
||||||
binding.lottie.removeAnimatorListener(this)
|
|
||||||
binding.lottie.setMinAndMaxFrame(60, 360)
|
|
||||||
binding.lottie.repeatMode = LottieDrawable.RESTART
|
|
||||||
binding.lottie.repeatCount = LottieDrawable.INFINITE
|
|
||||||
binding.lottie.frame = 60
|
|
||||||
binding.lottie.playAnimation()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
binding.okay.setOnClickListener {
|
|
||||||
SignalStore.uiHints().markHasSeenSafetyNumberUpdateNux()
|
|
||||||
dismiss()
|
|
||||||
}
|
|
||||||
|
|
||||||
binding.help.setOnClickListener {
|
|
||||||
CommunicationActions.openBrowserLink(requireContext(), "https://support.signal.org/hc/en-us/articles/360007060632")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
@JvmStatic
|
|
||||||
fun show(fragmentManager: FragmentManager) {
|
|
||||||
val fragment = PnpSafetyNumberEducationDialogFragment()
|
|
||||||
if (fragmentManager.findFragmentByTag(BottomSheetUtil.STANDARD_BOTTOM_SHEET_FRAGMENT_TAG) == null) {
|
|
||||||
fragment.show(fragmentManager, BottomSheetUtil.STANDARD_BOTTOM_SHEET_FRAGMENT_TAG)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -82,10 +82,6 @@ class VerifyDisplayFragment : Fragment(), OnScrollChangedListener {
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
initializeViewModel()
|
initializeViewModel()
|
||||||
|
|
||||||
binding.safetyNumberUpdatingBannerText.text = getString(R.string.verify_display_fragment__safety_numbers_are_updating_banner_no_learn_more)
|
|
||||||
binding.safetyNumberUpdatingBannerText.setLink("https://signal.org/redirect/safety-numbers")
|
|
||||||
binding.safetyNumberUpdatingBannerText.setLinkColor(ContextCompat.getColor(requireContext(), R.color.signal_colorPrimary))
|
|
||||||
|
|
||||||
updateVerifyButton(requireArguments().getBoolean(VERIFIED_STATE, false), false)
|
updateVerifyButton(requireArguments().getBoolean(VERIFIED_STATE, false), false)
|
||||||
|
|
||||||
binding.verifyButton.setOnClickListener { updateVerifyButton(!currentVerifiedState, true) }
|
binding.verifyButton.setOnClickListener { updateVerifyButton(!currentVerifiedState, true) }
|
||||||
|
@ -116,7 +112,6 @@ class VerifyDisplayFragment : Fragment(), OnScrollChangedListener {
|
||||||
return@observe
|
return@observe
|
||||||
}
|
}
|
||||||
val multipleCards = fingerprints.size > 1
|
val multipleCards = fingerprints.size > 1
|
||||||
binding.safetyNumberChangeBanner.visible = multipleCards
|
|
||||||
binding.dotIndicators.visible = multipleCards
|
binding.dotIndicators.visible = multipleCards
|
||||||
|
|
||||||
if (fingerprints.isEmpty()) {
|
if (fingerprints.isEmpty()) {
|
||||||
|
@ -145,14 +140,6 @@ class VerifyDisplayFragment : Fragment(), OnScrollChangedListener {
|
||||||
viewModel = ViewModelProvider(this, VerifySafetyNumberViewModel.Factory(recipientId, localIdentity, remoteIdentity)).get(VerifySafetyNumberViewModel::class.java)
|
viewModel = ViewModelProvider(this, VerifySafetyNumberViewModel.Factory(recipientId, localIdentity, remoteIdentity)).get(VerifySafetyNumberViewModel::class.java)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onStart() {
|
|
||||||
super.onStart()
|
|
||||||
if (!viewModel.showedSafetyNumberEducationDialog) {
|
|
||||||
PnpSafetyNumberEducationDialogFragment.show(childFragmentManager)
|
|
||||||
viewModel.showedSafetyNumberEducationDialog = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
setRecipientText(viewModel.recipient.get())
|
setRecipientText(viewModel.recipient.get())
|
||||||
|
|
|
@ -37,7 +37,6 @@ class VerifySafetyNumberViewModel(
|
||||||
}
|
}
|
||||||
|
|
||||||
val recipient: LiveRecipient = Recipient.live(recipientId)
|
val recipient: LiveRecipient = Recipient.live(recipientId)
|
||||||
var showedSafetyNumberEducationDialog = SignalStore.uiHints().hasSeenSafetyNumberUpdateNux()
|
|
||||||
|
|
||||||
private val fingerprintListLiveData = MutableLiveData<List<SafetyNumberFingerprint>>()
|
private val fingerprintListLiveData = MutableLiveData<List<SafetyNumberFingerprint>>()
|
||||||
|
|
||||||
|
@ -53,14 +52,6 @@ class VerifySafetyNumberViewModel(
|
||||||
val generator = NumericFingerprintGenerator(5200)
|
val generator = NumericFingerprintGenerator(5200)
|
||||||
|
|
||||||
var aciFingerprint: SafetyNumberFingerprint? = null
|
var aciFingerprint: SafetyNumberFingerprint? = null
|
||||||
var e164Fingerprint: SafetyNumberFingerprint? = null
|
|
||||||
|
|
||||||
if (resolved.e164.isPresent) {
|
|
||||||
val localIdentifier = Recipient.self().requireE164().toByteArray()
|
|
||||||
val remoteIdentifier = resolved.requireE164().toByteArray()
|
|
||||||
val version = 1
|
|
||||||
e164Fingerprint = SafetyNumberFingerprint(version, localIdentifier, localIdentity, remoteIdentifier, remoteIdentity, generator.createFor(version, localIdentifier, localIdentity, remoteIdentifier, remoteIdentity))
|
|
||||||
}
|
|
||||||
|
|
||||||
if (resolved.aci.isPresent) {
|
if (resolved.aci.isPresent) {
|
||||||
val localIdentifier = SignalStore.account().requireAci().toByteArray()
|
val localIdentifier = SignalStore.account().requireAci().toByteArray()
|
||||||
|
@ -71,9 +62,6 @@ class VerifySafetyNumberViewModel(
|
||||||
|
|
||||||
if (aciFingerprint != null) {
|
if (aciFingerprint != null) {
|
||||||
fingerprintList.add(aciFingerprint)
|
fingerprintList.add(aciFingerprint)
|
||||||
if (e164Fingerprint != null) {
|
|
||||||
fingerprintList.add(e164Fingerprint)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fingerprintListLiveData.postValue(fingerprintList)
|
fingerprintListLiveData.postValue(fingerprintList)
|
||||||
|
|
|
@ -1,99 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?><!--
|
|
||||||
~ Copyright 2023 Signal Messenger, LLC
|
|
||||||
~ SPDX-License-Identifier: AGPL-3.0-only
|
|
||||||
-->
|
|
||||||
|
|
||||||
<androidx.appcompat.widget.LinearLayoutCompat
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:layout_width="48dp"
|
|
||||||
android:layout_height="2dp"
|
|
||||||
android:layout_gravity="center_horizontal"
|
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:layout_marginBottom="10dp"
|
|
||||||
android:background="@color/signal_icon_tint_tab_unselected"/>
|
|
||||||
|
|
||||||
<androidx.core.widget.NestedScrollView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
android:layout_weight="1">
|
|
||||||
|
|
||||||
<androidx.appcompat.widget.LinearLayoutCompat
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
style="@style/Signal.Text.Headline"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center_horizontal"
|
|
||||||
android:gravity="center"
|
|
||||||
android:layout_marginTop="33dp"
|
|
||||||
android:text="@string/PnpSafetyNumberEducationDialog__title"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
style="@style/Signal.Text.BodyMedium"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center_horizontal"
|
|
||||||
android:gravity="start"
|
|
||||||
android:layout_marginTop="12dp"
|
|
||||||
android:layout_marginHorizontal="24dp"
|
|
||||||
android:layout_marginBottom="24dp"
|
|
||||||
android:text="@string/PnpSafetyNumberEducationDialog__body"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<com.airbnb.lottie.LottieAnimationView
|
|
||||||
android:id="@+id/lottie"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:padding="1dp"
|
|
||||||
android:layout_marginHorizontal="24dp"
|
|
||||||
android:layout_marginBottom="35dp"
|
|
||||||
android:background="@drawable/rounded_outline_12"
|
|
||||||
app:lottie_rawRes="@raw/safety_number_onboarding"/>
|
|
||||||
|
|
||||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
|
||||||
|
|
||||||
</androidx.core.widget.NestedScrollView>
|
|
||||||
|
|
||||||
<androidx.appcompat.widget.LinearLayoutCompat
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:layout_marginHorizontal="24dp"
|
|
||||||
android:layout_marginTop="12dp"
|
|
||||||
android:layout_marginBottom="24dp"
|
|
||||||
android:gravity="center_vertical">
|
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
|
||||||
android:id="@+id/help"
|
|
||||||
style="@style/Signal.Widget.Button.Medium.Secondary"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:text="@string/PnpSafetyNumberEducationDialog__help"/>
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="0dp"/>
|
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
|
||||||
android:id="@+id/okay"
|
|
||||||
style="@style/Signal.Widget.Button.Medium.Tonal"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:text="@string/PnpSafetyNumberEducationDialog__confirm"/>
|
|
||||||
|
|
||||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
|
||||||
|
|
||||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
|
|
@ -21,50 +21,13 @@
|
||||||
app:titleTextAppearance="@style/Signal.Text.TitleLarge"
|
app:titleTextAppearance="@style/Signal.Text.TitleLarge"
|
||||||
tools:title="@string/AndroidManifest__verify_safety_number" />
|
tools:title="@string/AndroidManifest__verify_safety_number" />
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/safety_number_image"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:src="@drawable/safety_numbers_updating_image"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/toolbar"
|
|
||||||
android:layout_marginStart="24dp"
|
|
||||||
android:layout_marginTop="8dp"
|
|
||||||
android:layout_marginEnd="16dp"/>
|
|
||||||
|
|
||||||
<org.thoughtcrime.securesms.util.views.LearnMoreTextView
|
|
||||||
android:id="@+id/safety_number_updating_banner_text"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
app:layout_constraintTop_toTopOf="@id/safety_number_image"
|
|
||||||
app:layout_constraintBottom_toBottomOf="@id/safety_number_image"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toEndOf="@id/safety_number_image"
|
|
||||||
android:layout_marginStart="16dp"
|
|
||||||
android:layout_marginEnd="30dp"
|
|
||||||
tools:text="Safety numbers are being updated."/>
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:id="@+id/divider"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="1.5dp"
|
|
||||||
android:layout_marginTop="24dp"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/safety_number_image"
|
|
||||||
android:background="@color/signal_colorSurfaceVariant"/>
|
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.Group
|
|
||||||
android:id="@+id/safety_number_change_banner"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:visibility="visible"
|
|
||||||
app:constraint_referenced_ids="divider,safety_number_updating_banner_text,safety_number_image"/>
|
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.Barrier
|
<androidx.constraintlayout.widget.Barrier
|
||||||
android:id="@+id/header_barrier"
|
android:id="@+id/header_barrier"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:barrierDirection="bottom"
|
app:barrierDirection="bottom"
|
||||||
app:constraint_referenced_ids="divider,toolbar"/>
|
app:constraint_referenced_ids="toolbar"/>
|
||||||
|
|
||||||
<ScrollView
|
<ScrollView
|
||||||
android:id="@+id/scroll_view"
|
android:id="@+id/scroll_view"
|
||||||
|
@ -83,7 +46,7 @@
|
||||||
|
|
||||||
<androidx.viewpager2.widget.ViewPager2
|
<androidx.viewpager2.widget.ViewPager2
|
||||||
android:id="@+id/verify_view_pager"
|
android:id="@+id/verify_view_pager"
|
||||||
android:layout_marginTop="40dp"
|
android:layout_marginTop="48dp"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"/>
|
android:layout_height="wrap_content"/>
|
||||||
|
|
||||||
|
@ -91,6 +54,7 @@
|
||||||
android:id="@+id/dot_indicators"
|
android:id="@+id/dot_indicators"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:visibility="gone"
|
||||||
app:tabBackground="@drawable/safety_dot_indicator"
|
app:tabBackground="@drawable/safety_dot_indicator"
|
||||||
app:tabGravity="center"
|
app:tabGravity="center"
|
||||||
app:tabPaddingEnd="10dp"
|
app:tabPaddingEnd="10dp"
|
||||||
|
@ -104,7 +68,7 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="32dp"
|
android:layout_marginStart="32dp"
|
||||||
android:layout_marginEnd="32dp"
|
android:layout_marginEnd="32dp"
|
||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="24dp"
|
||||||
android:layout_marginBottom="20dp"
|
android:layout_marginBottom="20dp"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:lineSpacingExtra="3sp"
|
android:lineSpacingExtra="3sp"
|
||||||
|
|
|
@ -2716,24 +2716,13 @@
|
||||||
|
|
||||||
<!-- verify_display_fragment -->
|
<!-- verify_display_fragment -->
|
||||||
<!-- Explanation of how to verify the safety numbers. %s is replaced with the name of the other recipient -->
|
<!-- Explanation of how to verify the safety numbers. %s is replaced with the name of the other recipient -->
|
||||||
<string name="verify_display_fragment__pnp_verify_safety_numbers_explanation_with_s">To verify end-to-end encryption with %s, match the color card above with their device and compare the numbers. If these don’t match, swipe and try the other pair of safety numbers. Only one pair needs to match.</string>
|
<string name="verify_display_fragment__pnp_verify_safety_numbers_explanation_with_s">To verify end-to-end encryption with %1$s, compare the numbers above with their device. You can also scan the code on their device.</string>
|
||||||
<string name="verify_display_fragment__tap_to_scan">Tap to scan</string>
|
<string name="verify_display_fragment__tap_to_scan">Tap to scan</string>
|
||||||
<string name="verify_display_fragment__successful_match">Successful match</string>
|
<string name="verify_display_fragment__successful_match">Successful match</string>
|
||||||
<string name="verify_display_fragment__failed_to_verify_safety_number">Failed to verify safety number</string>
|
<string name="verify_display_fragment__failed_to_verify_safety_number">Failed to verify safety number</string>
|
||||||
<string name="verify_display_fragment__loading">Loading…</string>
|
<string name="verify_display_fragment__loading">Loading…</string>
|
||||||
<string name="verify_display_fragment__mark_as_verified">Mark as verified</string>
|
<string name="verify_display_fragment__mark_as_verified">Mark as verified</string>
|
||||||
<string name="verify_display_fragment__clear_verification">Clear verification</string>
|
<string name="verify_display_fragment__clear_verification">Clear verification</string>
|
||||||
<!-- Banner at top of safety numbers screen explaining that we\'re updating how safety numbers work. -->
|
|
||||||
<string name="verify_display_fragment__safety_numbers_are_updating_banner_no_learn_more">Safety numbers are being updated.</string>
|
|
||||||
|
|
||||||
<!-- Title for dialog explaining for how safety numbers are transitioning to support usernames -->
|
|
||||||
<string name="PnpSafetyNumberEducationDialog__title">Changes to safety numbers</string>
|
|
||||||
<!-- Message for dialog explaining for how safety numbers are transitioning to support usernames -->
|
|
||||||
<string name="PnpSafetyNumberEducationDialog__body">Safety numbers are being updated over a transition period to enable upcoming privacy features in Signal.\n\nTo verify safety numbers, match the color card with your contact’s device. If these don’t match, swipe and try the other pair of safety numbers. Only one pair needs to match.</string>
|
|
||||||
<!-- Button for more information about the safety number changes. Takes user to support article -->
|
|
||||||
<string name="PnpSafetyNumberEducationDialog__help">Need help?</string>
|
|
||||||
<!-- Confirmation button for educating users about new safety number changes -->
|
|
||||||
<string name="PnpSafetyNumberEducationDialog__confirm">Got it</string>
|
|
||||||
|
|
||||||
<!-- verity_scan_fragment -->
|
<!-- verity_scan_fragment -->
|
||||||
<string name="verify_scan_fragment__scan_the_qr_code_on_your_contact">Scan the QR Code on your contact\'s device.</string>
|
<string name="verify_scan_fragment__scan_the_qr_code_on_your_contact">Scan the QR Code on your contact\'s device.</string>
|
||||||
|
|
Loading…
Add table
Reference in a new issue