mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-02-27 13:13:43 +00:00
Only show ACI SN's.
This commit is contained in:
@@ -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?) {
|
||||
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)
|
||||
|
||||
binding.verifyButton.setOnClickListener { updateVerifyButton(!currentVerifiedState, true) }
|
||||
@@ -116,7 +112,6 @@ class VerifyDisplayFragment : Fragment(), OnScrollChangedListener {
|
||||
return@observe
|
||||
}
|
||||
val multipleCards = fingerprints.size > 1
|
||||
binding.safetyNumberChangeBanner.visible = multipleCards
|
||||
binding.dotIndicators.visible = multipleCards
|
||||
|
||||
if (fingerprints.isEmpty()) {
|
||||
@@ -145,14 +140,6 @@ class VerifyDisplayFragment : Fragment(), OnScrollChangedListener {
|
||||
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() {
|
||||
super.onResume()
|
||||
setRecipientText(viewModel.recipient.get())
|
||||
|
||||
@@ -37,7 +37,6 @@ class VerifySafetyNumberViewModel(
|
||||
}
|
||||
|
||||
val recipient: LiveRecipient = Recipient.live(recipientId)
|
||||
var showedSafetyNumberEducationDialog = SignalStore.uiHints().hasSeenSafetyNumberUpdateNux()
|
||||
|
||||
private val fingerprintListLiveData = MutableLiveData<List<SafetyNumberFingerprint>>()
|
||||
|
||||
@@ -53,14 +52,6 @@ class VerifySafetyNumberViewModel(
|
||||
val generator = NumericFingerprintGenerator(5200)
|
||||
|
||||
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) {
|
||||
val localIdentifier = SignalStore.account().requireAci().toByteArray()
|
||||
@@ -71,9 +62,6 @@ class VerifySafetyNumberViewModel(
|
||||
|
||||
if (aciFingerprint != null) {
|
||||
fingerprintList.add(aciFingerprint)
|
||||
if (e164Fingerprint != null) {
|
||||
fingerprintList.add(e164Fingerprint)
|
||||
}
|
||||
}
|
||||
|
||||
fingerprintListLiveData.postValue(fingerprintList)
|
||||
|
||||
Reference in New Issue
Block a user