refactor: disable edit text for non contacts

This commit is contained in:
0x330a 2023-05-11 17:43:55 +10:00
parent ad09888c80
commit 5a2dac38c6
No known key found for this signature in database
GPG Key ID: 267811D6E6A2698C
5 changed files with 9 additions and 9 deletions

View File

@ -60,6 +60,7 @@ class UserDetailsBottomSheet: BottomSheetDialogFragment() {
profilePictureView.root.update(recipient)
nameTextViewContainer.visibility = View.VISIBLE
nameTextViewContainer.setOnClickListener {
if (recipient.isOpenGroupInboxRecipient) return@setOnClickListener
nameTextViewContainer.visibility = View.INVISIBLE
nameEditTextContainer.visibility = View.VISIBLE
nicknameEditText.text = null
@ -86,6 +87,8 @@ class UserDetailsBottomSheet: BottomSheetDialogFragment() {
}
nameTextView.text = recipient.name ?: publicKey // Uses the Contact API internally
nameEditIcon.isVisible = threadRecipient.isContactRecipient
publicKeyTextView.isVisible = !threadRecipient.isOpenGroupRecipient && !threadRecipient.isOpenGroupInboxRecipient
messageButton.isVisible = !threadRecipient.isOpenGroupRecipient || IdPrefix.fromValue(publicKey) == IdPrefix.BLINDED
publicKeyTextView.text = publicKey

View File

@ -117,7 +117,7 @@ class MessageRequestsActivity : PassphraseRequiredActionBarActivity(), Conversat
val dialog = AlertDialog.Builder(this)
dialog.setMessage(resources.getString(R.string.message_requests_clear_all_message))
dialog.setPositiveButton(R.string.yes) { _, _ ->
viewModel.clearAllMessageRequests()
viewModel.clearAllMessageRequests(true)
LoaderManager.getInstance(this).restartLoader(0, null, this)
lifecycleScope.launch(Dispatchers.IO) {
ConfigurationMessageUtilities.forceSyncConfigurationNowIfNeeded(this@MessageRequestsActivity)

View File

@ -18,13 +18,11 @@ import org.session.libsession.messaging.jobs.JobQueue
import org.session.libsession.messaging.messages.Destination
import org.session.libsession.messaging.messages.control.ConfigurationMessage
import org.session.libsession.messaging.sending_receiving.MessageSender
import org.session.libsession.messaging.utilities.SessionId
import org.session.libsession.utilities.Address
import org.session.libsession.utilities.GroupUtil
import org.session.libsession.utilities.TextSecurePreferences
import org.session.libsession.utilities.WindowDebouncer
import org.session.libsignal.utilities.Hex
import org.session.libsignal.utilities.Log
import org.session.libsignal.utilities.toHexString
import org.thoughtcrime.securesms.dependencies.DatabaseComponent
import java.util.Timer
@ -199,9 +197,8 @@ object ConfigurationMessageUtilities {
convoConfig.getOrConstructLegacyGroup(groupPublicKey)
}
recipient.isContactRecipient -> {
val sessionId = SessionId(recipient.address.serialize())
if (recipient.isLocalNumber) null // this is handled by the user profile NTS data
if (recipient.isOpenGroupInboxRecipient) null // specifically exclude
else if (recipient.isOpenGroupInboxRecipient) null // specifically exclude
else convoConfig.getOrConstructOneToOne(recipient.address.serialize())
}
else -> null

View File

@ -52,6 +52,7 @@
android:text="Spiderman" />
<ImageView
android:id="@+id/nameEditIcon"
android:layout_width="20dp"
android:layout_height="22dp"
android:contentDescription="@string/AccessibilityId_edit_user_nickname"

View File

@ -5,11 +5,10 @@ import android.os.Parcel
import android.os.Parcelable
import android.util.Pair
import androidx.annotation.VisibleForTesting
import org.session.libsession.utilities.DelimiterUtil
import org.session.libsession.utilities.GroupUtil
import org.session.libsignal.utilities.guava.Optional
import org.session.libsignal.utilities.Util
import java.util.*
import org.session.libsignal.utilities.guava.Optional
import java.util.Collections
import java.util.LinkedList
import java.util.concurrent.atomic.AtomicReference
import java.util.regex.Matcher
import java.util.regex.Pattern