feat: Add conversation filtering for message requests (#830)

* feat: Message requests

* Apply contact sync message

* Filter based on message requests toggle

* Add message requests screen

* Implement message requests screen

* Handle message request buttons

* Handle approval syncing

* Display message request response

* Display pending message request

* Display pending message request

* Add approval migrations

* Send message request response

* Fix conversation filters

* Add approval migration

* Handle message request response

* Update message request response proto

* Update message request response handling

* Refresh message requests

* Show message request banner on new message request

* Message request item layout tweaks

* Fix latest unapproved conversation query

* Handle sent message request responses on restore

* QA feedback tweaks

* Remove send limit on message requests

* Config message handling tweaks

* Reverse conversation upon message request approval

* Remove read receipts, delete declined conversations

* Fix contact filtering in config messages

* Fix message request order and handle deletion

* Fix message request snippet on home screen

* Refresh message request list after decline or clearing all

* Fix message request reversal

* Fix message request notifications

* Disable media buttons for message requests

* Hide message request banner after reading

* Refresh message request banner
This commit is contained in:
ceokot
2022-03-04 08:46:39 +02:00
committed by GitHub
parent 55aa266769
commit 206505abe8
56 changed files with 2427 additions and 205 deletions

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/transparent" />
<corners android:radius="@dimen/medium_button_corner_radius" />
<stroke android:width="@dimen/border_thickness" android:color="@color/destructive" />
</shape>

View File

@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="@color/destructive">
<path
android:fillColor="@android:color/white"
android:pathData="M6,19c0,1.1 0.9,2 2,2h8c1.1,0 2,-0.9 2,-2V7H6v12zM19,4h-3.5l-1,-1h-5l-1,1H5v2h14V4z"/>
</vector>

View File

@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M20,2H4C2.9,2 2,2.9 2,4V22L6,18H20C21.1,18 22,17.1 22,16V4C22,2.9 21.1,2 20,2M20,16H5.2L4,17.2V4H20V16M12.2,5.5C11.3,5.5 10.6,5.7 10.1,6C9.5,6.4 9.2,7 9.3,7.7H11.3C11.3,7.4 11.4,7.2 11.6,7.1C11.8,7 12,6.9 12.3,6.9C12.6,6.9 12.9,7 13.1,7.2C13.3,7.4 13.4,7.6 13.4,7.9C13.4,8.2 13.3,8.4 13.2,8.6C13,8.8 12.8,9 12.6,9.1C12.1,9.4 11.7,9.7 11.5,9.9C11.1,10.2 11,10.5 11,11H13C13,10.7 13.1,10.5 13.1,10.3C13.2,10.1 13.4,10 13.6,9.8C14.1,9.6 14.4,9.3 14.7,8.9C15,8.5 15.1,8.1 15.1,7.7C15.1,7 14.8,6.4 14.3,6C13.9,5.7 13.1,5.5 12.2,5.5M11,12V14H13V12H11Z" />
</vector>

View File

@@ -25,7 +25,7 @@
android:layout_width="match_parent"
android:layout_height="36dp"
android:visibility="gone"
android:layout_above="@+id/inputBar"
android:layout_above="@+id/messageRequestBar"
/>
<org.thoughtcrime.securesms.conversation.v2.input_bar.InputBar
@@ -91,9 +91,9 @@
android:visibility="gone"
android:layout_width="40dp"
android:layout_height="50dp"
android:layout_alignParentRight="true"
android:layout_above="@+id/inputBar"
android:layout_marginRight="12dp"
android:layout_alignParentEnd="true"
android:layout_above="@+id/messageRequestBar"
android:layout_marginEnd="12dp"
android:layout_marginBottom="32dp">
<RelativeLayout
@@ -168,4 +168,52 @@
</RelativeLayout>
<LinearLayout
android:id="@+id/messageRequestBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@id/inputBar"
android:layout_marginBottom="@dimen/large_spacing"
android:orientation="vertical"
android:visibility="gone"
tools:visibility="visible">
<TextView
android:id="@+id/sendAcceptsTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:layout_margin="@dimen/medium_spacing"
android:text="@string/message_requests_send_notice"
android:textColor="@color/text"
android:alpha="0.6"
android:textSize="@dimen/small_font_size" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="@dimen/medium_spacing"
android:orientation="horizontal">
<Button
android:id="@+id/acceptMessageRequestButton"
style="@style/Widget.Session.Button.Common.ProminentOutline"
android:layout_width="0dp"
android:layout_height="@dimen/medium_button_height"
android:layout_weight="1"
android:text="@string/accept" />
<Button
android:id="@+id/declineMessageRequestButton"
style="@style/Widget.Session.Button.Common.DestructiveOutline"
android:layout_width="0dp"
android:layout_height="@dimen/medium_button_height"
android:layout_marginStart="@dimen/medium_spacing"
android:layout_weight="1"
android:text="@string/decline" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>

View File

@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/contentView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipChildren="false">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:paddingBottom="172dp"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:itemCount="6"
tools:listitem="@layout/view_conversation" />
<View
android:id="@+id/gradientView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/home_activity_gradient" />
<LinearLayout
android:id="@+id/emptyStateContainer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center_horizontal"
android:orientation="vertical"
android:paddingBottom="32dp"
android:visibility="gone">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/message_request_empty_state_message"
android:textColor="@color/text"
android:textSize="@dimen/medium_font_size" />
</LinearLayout>
<Button
android:id="@+id/clearAllMessageRequestsButton"
style="@style/Widget.Session.Button.Common.DestructiveOutline"
android:layout_width="196dp"
android:layout_height="@dimen/medium_button_height"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="@dimen/medium_spacing"
android:layout_marginBottom="@dimen/massive_spacing"
android:text="@string/message_requests_clear_all" />
</RelativeLayout>
</LinearLayout>

View File

@@ -179,6 +179,22 @@
android:layout_height="1px"
android:background="?android:dividerHorizontal" />
<TextView
android:id="@+id/messageRequestsButton"
android:layout_width="match_parent"
android:layout_height="@dimen/setting_button_height"
android:background="@drawable/setting_button_background"
android:textColor="@color/text"
android:textSize="@dimen/medium_font_size"
android:textStyle="bold"
android:gravity="center"
android:text="@string/activity_settings_message_requests_button_title" />
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:background="?android:dividerHorizontal" />
<TextView
android:id="@+id/chatsButton"
android:layout_width="match_parent"

View File

@@ -24,8 +24,10 @@
android:layout_width="12dp"
android:layout_height="12dp"
android:layout_marginBottom="@dimen/small_spacing"
android:visibility="gone"
app:tint="@color/text"
tools:src="@drawable/ic_timer" />
tools:src="@drawable/ic_timer"
tools:visibility="visible"/>
<TextView
android:id="@+id/textView"

View File

@@ -0,0 +1,77 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<org.thoughtcrime.securesms.components.ProfilePictureView
android:id="@+id/profilePictureView"
android:layout_width="@dimen/medium_profile_picture_size"
android:layout_height="@dimen/medium_profile_picture_size"
android:layout_marginStart="@dimen/medium_spacing"
android:layout_marginTop="@dimen/medium_spacing"
android:layout_marginBottom="@dimen/medium_spacing" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="@dimen/medium_spacing"
android:layout_marginEnd="@dimen/medium_spacing"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="@+id/displayNameTextView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:drawablePadding="4dp"
android:layout_weight="1"
android:ellipsize="end"
android:maxLines="1"
android:textAlignment="viewStart"
android:textColor="@color/text"
android:textSize="@dimen/medium_font_size"
android:textStyle="bold"
tools:text="I'm a very long display name. What are you going to do about it?" />
<TextView
android:id="@+id/timestampTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/medium_spacing"
android:alpha="0.4"
android:ellipsize="end"
android:maxLines="1"
android:textColor="@color/text"
android:textSize="@dimen/small_font_size"
tools:text="9:41 AM" />
</LinearLayout>
<TextView
android:id="@+id/snippetTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:textColor="@color/text"
android:textSize="@dimen/medium_font_size"
tools:text="Sorry, gotta go fight crime again" />
</LinearLayout>
</FrameLayout>
</LinearLayout>

View File

@@ -0,0 +1,81 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/conversation_view_background"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingStart="@dimen/accent_line_thickness"
android:paddingEnd="@dimen/medium_spacing">
<org.thoughtcrime.securesms.components.CircleColorImageView
android:id="@+id/profilePictureView"
android:layout_width="@dimen/medium_profile_picture_size"
android:layout_height="@dimen/medium_profile_picture_size"
android:layout_marginVertical="@dimen/medium_spacing"
android:layout_marginStart="@dimen/medium_spacing"
android:padding="10dp"
android:src="@drawable/ic_outline_message_requests_24"
app:circleColor="#585858"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/conversationViewDisplayNameTextView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/medium_spacing"
android:drawablePadding="4dp"
android:ellipsize="end"
android:maxLines="1"
android:text="@string/activity_message_requests_title"
android:textAlignment="viewStart"
android:textColor="@color/text"
android:textSize="@dimen/medium_font_size"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/profilePictureView"
app:layout_constraintTop_toTopOf="parent" />
<RelativeLayout
android:id="@+id/unreadCountIndicator"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_marginStart="4dp"
android:background="@drawable/circle_tintable"
android:backgroundTint="#585858"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/conversationViewDisplayNameTextView"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/unreadCountTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:textColor="@color/white"
android:textSize="@dimen/very_small_font_size"
android:textStyle="bold"
tools:text="8" />
</RelativeLayout>
<TextView
android:id="@+id/timestampTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/medium_spacing"
android:alpha="0.4"
android:ellipsize="end"
android:maxLines="1"
android:textColor="@color/text"
android:textSize="@dimen/small_font_size"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="9:41 AM" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/menu_delete_message_request"
android:icon="@drawable/ic_delete_24"
android:title="@string/delete"/>
</menu>

View File

@@ -730,6 +730,7 @@
<string name="activity_settings_display_name_too_long_error">Please pick a shorter display name</string>
<string name="activity_settings_privacy_button_title">Privacy</string>
<string name="activity_settings_notifications_button_title">Notifications</string>
<string name="activity_settings_message_requests_button_title">Message Requests</string>
<string name="activity_settings_chats_button_title">Chats</string>
<string name="activity_settings_devices_button_title">Devices</string>
<string name="activity_settings_invite_button_title">Invite a Friend</string>
@@ -795,7 +796,7 @@
<string name="activity_select_contacts_title">Select Contacts</string>
<string name="view_reset_secure_session_done_message">Secure session reset done</string>
<string name="dialog_ui_mode_title">Theme</string>
<string name="dialog_ui_mode_option_day">Day</string>
<string name="dialog_ui_mode_option_night">Night</string>
@@ -882,8 +883,21 @@
<string name="mark_all_as_read">Mark all as read</string>
<string name="global_search_contacts_groups">Contacts and Groups</string>
<string name="global_search_messages">Messages</string>
<string name="activity_message_requests_title">Message Requests</string>
<string name="message_requests_send_notice">Sending a message to this user will automatically accept their message request and reveal your Session ID.</string>
<string name="accept">Accept</string>
<string name="decline">Decline</string>
<string name="message_requests_clear_all">Clear All</string>
<string name="message_requests_delete_message">Are you sure you want to delete this message request?</string>
<string name="message_requests_deleted">Message request deleted</string>
<string name="message_requests_clear_all_message">Are you sure you want to clear all message requests?</string>
<string name="message_requests_cleared">Message requests deleted</string>
<string name="message_requests_accepted">Your message request has been accepted.</string>
<string name="message_requests_pending">Your message request is currently pending.</string>
<string name="message_request_empty_state_message">No pending message requests</string>
<string name="NewConversationButton_SessionTooltip">Direct Message</string>
<string name="NewConversationButton_ClosedGroupTooltip">Closed Group</string>
<string name="NewConversationButton_OpenGroupTooltip">Open Group</string>
<string name="message_requests_notification">You have a new message request</string>
</resources>

View File

@@ -95,6 +95,12 @@
<item name="android:drawableTint" tools:ignore="NewApi">?android:textColorPrimary</item>
</style>
<style name="Widget.Session.Button.Common.DestructiveOutline">
<item name="android:background">@drawable/destructive_outline_button_medium_background</item>
<item name="android:textColor">@color/destructive</item>
<item name="android:drawableTint" tools:ignore="NewApi">?android:textColorPrimary</item>
</style>
<style name="Widget.Session.Button.Dialog" parent="">
<item name="android:textAllCaps">false</item>
<item name="android:textSize">@dimen/small_font_size</item>