mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-27 12:05:22 +00:00
fix: contacts without stored profile information display similar to closed groups for unsend
This commit is contained in:
parent
0b062074b1
commit
00d6ce76b5
@ -4,23 +4,39 @@ import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.core.view.isVisible
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
|
||||
import kotlinx.android.synthetic.main.fragment_conversation_bottom_sheet.*
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import kotlinx.android.synthetic.main.fragment_delete_message_bottom_sheet.*
|
||||
import network.loki.messenger.R
|
||||
import org.session.libsession.messaging.contacts.Contact
|
||||
import org.session.libsession.utilities.recipients.Recipient
|
||||
import org.thoughtcrime.securesms.database.SessionContactDatabase
|
||||
import org.thoughtcrime.securesms.util.UiModeUtilities
|
||||
import javax.inject.Inject
|
||||
|
||||
@AndroidEntryPoint
|
||||
class DeleteOptionsBottomSheet : BottomSheetDialogFragment(), View.OnClickListener {
|
||||
|
||||
@Inject
|
||||
lateinit var contactDatabase: SessionContactDatabase
|
||||
|
||||
lateinit var recipient: Recipient
|
||||
val contact by lazy {
|
||||
val senderId = recipient.address.serialize()
|
||||
// this dialog won't show for open group contacts
|
||||
contactDatabase.getContactWithSessionID(senderId)
|
||||
?.displayName(Contact.ContactContext.REGULAR)
|
||||
}
|
||||
|
||||
var onDeleteForMeTapped: (() -> Unit?)? = null
|
||||
var onDeleteForEveryoneTapped: (() -> Unit)? = null
|
||||
var onCancelTapped: (() -> Unit)? = null
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View? {
|
||||
return inflater.inflate(R.layout.fragment_delete_message_bottom_sheet, container, false)
|
||||
}
|
||||
|
||||
@ -34,9 +50,12 @@ class DeleteOptionsBottomSheet: BottomSheetDialogFragment(), View.OnClickListene
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
if (!this::recipient.isInitialized) { return dismiss() }
|
||||
if (!recipient.isGroupRecipient) {
|
||||
deleteForEveryoneTextView.text = resources.getString(R.string.delete_message_for_me_and_recipient, recipient.name)
|
||||
if (!this::recipient.isInitialized) {
|
||||
return dismiss()
|
||||
}
|
||||
if (!recipient.isGroupRecipient && !contact.isNullOrEmpty()) {
|
||||
deleteForEveryoneTextView.text =
|
||||
resources.getString(R.string.delete_message_for_me_and_recipient, contact)
|
||||
}
|
||||
deleteForMeTextView.setOnClickListener(this)
|
||||
deleteForEveryoneTextView.setOnClickListener(this)
|
||||
|
Loading…
Reference in New Issue
Block a user