Add send approval message (#1157)

pull/1173/head
Andrew 1 year ago committed by GitHub
parent 83b6002a27
commit 99cb10f5be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -22,6 +22,7 @@ import androidx.activity.viewModels
import androidx.annotation.DimenRes import androidx.annotation.DimenRes
import androidx.appcompat.app.AlertDialog import androidx.appcompat.app.AlertDialog
import androidx.core.view.drawToBitmap import androidx.core.view.drawToBitmap
import androidx.core.view.isGone
import androidx.core.view.isVisible import androidx.core.view.isVisible
import androidx.lifecycle.Observer import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.ViewModelProvider
@ -344,6 +345,7 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
updateSubtitle() updateSubtitle()
setUpBlockedBanner() setUpBlockedBanner()
binding!!.searchBottomBar.setEventListener(this) binding!!.searchBottomBar.setEventListener(this)
updateSendAfterApprovalText()
showOrHideInputIfNeeded() showOrHideInputIfNeeded()
setUpMessageRequestsBar() setUpMessageRequestsBar()
@ -653,7 +655,9 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
setUpMessageRequestsBar() setUpMessageRequestsBar()
invalidateOptionsMenu() invalidateOptionsMenu()
updateSubtitle() updateSubtitle()
updateSendAfterApprovalText()
showOrHideInputIfNeeded() showOrHideInputIfNeeded()
binding?.toolbarContent?.profilePictureView?.root?.update(threadRecipient) binding?.toolbarContent?.profilePictureView?.root?.update(threadRecipient)
binding?.toolbarContent?.conversationTitleView?.text = when { binding?.toolbarContent?.conversationTitleView?.text = when {
threadRecipient.isLocalNumber -> getString(R.string.note_to_self) threadRecipient.isLocalNumber -> getString(R.string.note_to_self)
@ -662,6 +666,10 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
} }
} }
private fun updateSendAfterApprovalText() {
binding?.textSendAfterApproval?.isGone = viewModel.recipient?.hasApprovedMe() ?: true
}
private fun showOrHideInputIfNeeded() { private fun showOrHideInputIfNeeded() {
val recipient = viewModel.recipient val recipient = viewModel.recipient
if (recipient != null && recipient.isClosedGroupRecipient) { if (recipient != null && recipient.isClosedGroupRecipient) {

@ -35,7 +35,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="36dp" android:layout_height="36dp"
android:visibility="gone" android:visibility="gone"
android:layout_above="@+id/messageRequestBar" android:layout_above="@+id/textSendAfterApproval"
/> />
<org.thoughtcrime.securesms.conversation.v2.input_bar.InputBar <org.thoughtcrime.securesms.conversation.v2.input_bar.InputBar
@ -118,6 +118,18 @@
</LinearLayout> </LinearLayout>
<TextView
android:id="@+id/textSendAfterApproval"
android:text="@string/ConversationActivity_send_after_approval"
android:visibility="gone"
android:textAlignment="center"
android:textColor="@color/classic_light_2"
android:padding="22dp"
android:textSize="12sp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@id/messageRequestBar"/>
<RelativeLayout <RelativeLayout
android:id="@+id/scrollToBottomButton" android:id="@+id/scrollToBottomButton"
android:visibility="gone" android:visibility="gone"

@ -227,6 +227,7 @@
<string name="ConversationActivity_search_position">%1$d of %2$d</string> <string name="ConversationActivity_search_position">%1$d of %2$d</string>
<string name="ConversationActivity_call_title">Call Permissions Required</string> <string name="ConversationActivity_call_title">Call Permissions Required</string>
<string name="ConversationActivity_call_prompt">You can enable the \'Voice and video calls\' permission in the Privacy Settings.</string> <string name="ConversationActivity_call_prompt">You can enable the \'Voice and video calls\' permission in the Privacy Settings.</string>
<string name="ConversationActivity_send_after_approval">You will be able to send voice messages and attachments once the recipient has approved this message request</string>
<!-- ConversationFragment --> <!-- ConversationFragment -->
<plurals name="ConversationFragment_delete_selected_messages"> <plurals name="ConversationFragment_delete_selected_messages">
<item quantity="one">Delete selected message?</item> <item quantity="one">Delete selected message?</item>

Loading…
Cancel
Save