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.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.core.view.isVisible
|
|
||||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
|
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 kotlinx.android.synthetic.main.fragment_delete_message_bottom_sheet.*
|
||||||
import network.loki.messenger.R
|
import network.loki.messenger.R
|
||||||
|
import org.session.libsession.messaging.contacts.Contact
|
||||||
import org.session.libsession.utilities.recipients.Recipient
|
import org.session.libsession.utilities.recipients.Recipient
|
||||||
|
import org.thoughtcrime.securesms.database.SessionContactDatabase
|
||||||
import org.thoughtcrime.securesms.util.UiModeUtilities
|
import org.thoughtcrime.securesms.util.UiModeUtilities
|
||||||
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
@AndroidEntryPoint
|
||||||
class DeleteOptionsBottomSheet : BottomSheetDialogFragment(), View.OnClickListener {
|
class DeleteOptionsBottomSheet : BottomSheetDialogFragment(), View.OnClickListener {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
lateinit var contactDatabase: SessionContactDatabase
|
||||||
|
|
||||||
lateinit var recipient: Recipient
|
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 onDeleteForMeTapped: (() -> Unit?)? = null
|
||||||
var onDeleteForEveryoneTapped: (() -> Unit)? = null
|
var onDeleteForEveryoneTapped: (() -> Unit)? = null
|
||||||
var onCancelTapped: (() -> 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)
|
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?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
if (!this::recipient.isInitialized) { return dismiss() }
|
if (!this::recipient.isInitialized) {
|
||||||
if (!recipient.isGroupRecipient) {
|
return dismiss()
|
||||||
deleteForEveryoneTextView.text = resources.getString(R.string.delete_message_for_me_and_recipient, recipient.name)
|
}
|
||||||
|
if (!recipient.isGroupRecipient && !contact.isNullOrEmpty()) {
|
||||||
|
deleteForEveryoneTextView.text =
|
||||||
|
resources.getString(R.string.delete_message_for_me_and_recipient, contact)
|
||||||
}
|
}
|
||||||
deleteForMeTextView.setOnClickListener(this)
|
deleteForMeTextView.setOnClickListener(this)
|
||||||
deleteForEveryoneTextView.setOnClickListener(this)
|
deleteForEveryoneTextView.setOnClickListener(this)
|
||||||
|
Loading…
Reference in New Issue
Block a user