Display Note to self in conversation instead of your own Session ID (#929)

* fix: display title bar in conversation as "Note to self" if it's the local user's session ID

* docs: remove ID blinding comment as it's your own user and probably won't ever me a conversation with your blinded ID

* fix: compile issue for missing recipient local var

* refactor: use same logic for recipient modified listener
This commit is contained in:
Harris 2022-09-13 15:06:20 +10:00 committed by GitHub
parent 919bb01d58
commit aa43ab2a2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -436,10 +436,14 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
private fun setUpToolBar() {
setSupportActionBar(binding?.toolbar)
val actionBar = supportActionBar ?: return
val recipient = viewModel.recipient ?: return
actionBar.title = ""
actionBar.setDisplayHomeAsUpEnabled(true)
actionBar.setHomeButtonEnabled(true)
binding!!.toolbarContent.conversationTitleView.text = viewModel.recipient?.toShortString()
binding!!.toolbarContent.conversationTitleView.text = when {
recipient.isLocalNumber -> getString(R.string.note_to_self)
else -> recipient.toShortString()
}
@DimenRes val sizeID: Int = if (viewModel.recipient?.isClosedGroupRecipient == true) {
R.dimen.medium_profile_picture_size
} else {
@ -629,18 +633,19 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
// region Animation & Updating
override fun onModified(recipient: Recipient) {
runOnUiThread {
val recipient = viewModel.recipient
if (recipient != null && recipient.isContactRecipient) {
binding?.blockedBanner?.isVisible = recipient.isBlocked
val threadRecipient = viewModel.recipient ?: return@runOnUiThread
if (threadRecipient.isContactRecipient) {
binding?.blockedBanner?.isVisible = threadRecipient.isBlocked
}
setUpMessageRequestsBar()
invalidateOptionsMenu()
updateSubtitle()
showOrHideInputIfNeeded()
if (recipient != null) {
binding?.toolbarContent?.profilePictureView?.root?.update(recipient)
binding?.toolbarContent?.profilePictureView?.root?.update(threadRecipient)
binding!!.toolbarContent.conversationTitleView.text = when {
threadRecipient.isLocalNumber -> getString(R.string.note_to_self)
else -> threadRecipient.toShortString()
}
binding?.toolbarContent?.conversationTitleView?.text = recipient?.toShortString()
}
}