From 58cc3931b91cd107ea54b426eace75ebd19ecb31 Mon Sep 17 00:00:00 2001 From: ariskotsomitopoulos Date: Mon, 28 Mar 2022 13:53:44 +0300 Subject: [PATCH 1/9] Add beta feedback for threads --- .../main/res/drawable/bg_shadow_divider.xml | 9 +++ .../threads/list/views/ThreadListFragment.kt | 11 ++++ .../features/rageshake/BugReportActivity.kt | 9 +++ .../app/features/rageshake/BugReporter.kt | 10 +-- .../app/features/rageshake/ReportType.kt | 3 +- .../main/res/layout/fragment_thread_list.xml | 66 +++++++++++++++++-- vector/src/main/res/values/strings.xml | 3 + 7 files changed, 100 insertions(+), 11 deletions(-) create mode 100644 library/ui-styles/src/main/res/drawable/bg_shadow_divider.xml diff --git a/library/ui-styles/src/main/res/drawable/bg_shadow_divider.xml b/library/ui-styles/src/main/res/drawable/bg_shadow_divider.xml new file mode 100644 index 0000000000..9d0ef632ec --- /dev/null +++ b/library/ui-styles/src/main/res/drawable/bg_shadow_divider.xml @@ -0,0 +1,9 @@ + + + + \ No newline at end of file diff --git a/vector/src/main/java/im/vector/app/features/home/room/threads/list/views/ThreadListFragment.kt b/vector/src/main/java/im/vector/app/features/home/room/threads/list/views/ThreadListFragment.kt index d5659efa49..dc16680334 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/threads/list/views/ThreadListFragment.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/threads/list/views/ThreadListFragment.kt @@ -39,6 +39,8 @@ import im.vector.app.features.home.room.threads.arguments.ThreadTimelineArgs import im.vector.app.features.home.room.threads.list.viewmodel.ThreadListController import im.vector.app.features.home.room.threads.list.viewmodel.ThreadListViewModel import im.vector.app.features.home.room.threads.list.viewmodel.ThreadListViewState +import im.vector.app.features.rageshake.BugReporter +import im.vector.app.features.rageshake.ReportType import org.matrix.android.sdk.api.session.room.threads.model.ThreadSummary import org.matrix.android.sdk.api.session.room.timeline.TimelineEvent import org.matrix.android.sdk.api.util.MatrixItem @@ -46,6 +48,7 @@ import javax.inject.Inject class ThreadListFragment @Inject constructor( private val avatarRenderer: AvatarRenderer, + private val bugReporter: BugReporter, private val threadListController: ThreadListController, val threadListViewModelFactory: ThreadListViewModel.Factory ) : VectorBaseFragment(), @@ -80,6 +83,7 @@ class ThreadListFragment @Inject constructor( super.onViewCreated(view, savedInstanceState) initToolbar() initTextConstants() + initBetaFeedback() views.threadListRecyclerView.configureWith(threadListController, TimelineItemAnimator(), hasFixedSize = false) threadListController.listener = this } @@ -101,6 +105,13 @@ class ThreadListFragment @Inject constructor( resources.getString(R.string.reply_in_thread)) } + private fun initBetaFeedback() { + views.threadsFeedBackConstraintLayout.isVisible = resources.getBoolean(R.bool.feature_threads_beta_feedback_enabled) + views.threadFeedbackDivider.isVisible = resources.getBoolean(R.bool.feature_threads_beta_feedback_enabled) + views.threadsFeedBackConstraintLayout.debouncedClicks { + bugReporter.openBugReportScreen(requireActivity(), reportType = ReportType.THREADS_BETA_FEEDBACK) + } + } override fun invalidate() = withState(threadListViewModel) { state -> renderEmptyStateIfNeeded(state) threadListController.update(state) diff --git a/vector/src/main/java/im/vector/app/features/rageshake/BugReportActivity.kt b/vector/src/main/java/im/vector/app/features/rageshake/BugReportActivity.kt index 2d4bc704a4..701d04f3c9 100755 --- a/vector/src/main/java/im/vector/app/features/rageshake/BugReportActivity.kt +++ b/vector/src/main/java/im/vector/app/features/rageshake/BugReportActivity.kt @@ -85,6 +85,15 @@ class BugReportActivity : VectorBaseActivity() { hideBugReportOptions() } + ReportType.THREADS_BETA_FEEDBACK -> { + supportActionBar?.setTitle(R.string.send_feedback_threads_title) + + views.bugReportFirstText.setText(R.string.send_feedback_threads_info) + views.bugReportTextInputLayout.hint = getString(R.string.feedback) + views.bugReportButtonContactMe.isVisible = true + + hideBugReportOptions() + } else -> { // other types not supported here } diff --git a/vector/src/main/java/im/vector/app/features/rageshake/BugReporter.kt b/vector/src/main/java/im/vector/app/features/rageshake/BugReporter.kt index 6434ba60f2..4a62d62e34 100755 --- a/vector/src/main/java/im/vector/app/features/rageshake/BugReporter.kt +++ b/vector/src/main/java/im/vector/app/features/rageshake/BugReporter.kt @@ -255,11 +255,12 @@ class BugReporter @Inject constructor( if (!mIsCancelled) { val text = when (reportType) { - ReportType.BUG_REPORT -> "[Element] $bugDescription" - ReportType.SUGGESTION -> "[Element] [Suggestion] $bugDescription" - ReportType.SPACE_BETA_FEEDBACK -> "[Element] [spaces-feedback] $bugDescription" + ReportType.BUG_REPORT -> "[Element] $bugDescription" + ReportType.SUGGESTION -> "[Element] [Suggestion] $bugDescription" + ReportType.SPACE_BETA_FEEDBACK -> "[Element] [spaces-feedback] $bugDescription" ReportType.AUTO_UISI_SENDER, - ReportType.AUTO_UISI -> bugDescription + ReportType.AUTO_UISI -> bugDescription + ReportType.THREADS_BETA_FEEDBACK -> "[Element] [threads-feedback] $bugDescription" } // build the multi part request @@ -350,6 +351,7 @@ class BugReporter @Inject constructor( builder.addFormDataPart("label", "android") builder.addFormDataPart("label", "uisi-sender") } + ReportType.THREADS_BETA_FEEDBACK -> builder.addFormDataPart("label", "threads-feedback") } if (getCrashFile().exists()) { diff --git a/vector/src/main/java/im/vector/app/features/rageshake/ReportType.kt b/vector/src/main/java/im/vector/app/features/rageshake/ReportType.kt index f9dc628914..f75420ea55 100644 --- a/vector/src/main/java/im/vector/app/features/rageshake/ReportType.kt +++ b/vector/src/main/java/im/vector/app/features/rageshake/ReportType.kt @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 New Vector Ltd + * Copyright (c) 2022 New Vector Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,7 @@ enum class ReportType { BUG_REPORT, SUGGESTION, SPACE_BETA_FEEDBACK, + THREADS_BETA_FEEDBACK, AUTO_UISI, AUTO_UISI_SENDER, } diff --git a/vector/src/main/res/layout/fragment_thread_list.xml b/vector/src/main/res/layout/fragment_thread_list.xml index 7e7c79f8c3..026432035f 100644 --- a/vector/src/main/res/layout/fragment_thread_list.xml +++ b/vector/src/main/res/layout/fragment_thread_list.xml @@ -30,7 +30,7 @@ android:layout_width="0dp" android:layout_height="0dp" android:background="?android:colorBackground" - app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintBottom_toTopOf="@id/threadsFeedBackConstraintLayout" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/threadListAppBarLayout" @@ -75,13 +75,13 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginBottom="20dp" + android:gravity="center" + android:text="@string/thread_list_empty_title" android:textColor="?vctr_content_primary" app:layout_constraintBottom_toTopOf="@id/threadListEmptySubtitleTextView" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" - android:gravity="center" - app:layout_constraintTop_toBottomOf="@id/threadListEmptyImageView" - android:text="@string/thread_list_empty_title" /> + app:layout_constraintTop_toBottomOf="@id/threadListEmptyImageView" /> + app:layout_constraintTop_toBottomOf="@id/threadListEmptyTitleTextView" /> + + + + + + + + \ No newline at end of file diff --git a/vector/src/main/res/values/strings.xml b/vector/src/main/res/values/strings.xml index 551e5961ec..d227326ceb 100644 --- a/vector/src/main/res/values/strings.xml +++ b/vector/src/main/res/values/strings.xml @@ -1648,6 +1648,9 @@ Thanks, your feedback has been successfully sent The feedback failed to be sent (%s) Give Feedback + Give Feedback on threads + Threads Beta feedback + Threads are a work in progress with new, exciting upcoming features, such as improved notifications. We’d love to hear your feedback! Show hidden events in timeline "Show complete history in encrypted rooms" From a2e2cdc2f38b099e23a0537448c74241337a089c Mon Sep 17 00:00:00 2001 From: ariskotsomitopoulos Date: Mon, 28 Mar 2022 13:54:31 +0300 Subject: [PATCH 2/9] Add feature specific configurations --- vector-config/src/main/res/values/config-features.xml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100755 vector-config/src/main/res/values/config-features.xml diff --git a/vector-config/src/main/res/values/config-features.xml b/vector-config/src/main/res/values/config-features.xml new file mode 100755 index 0000000000..0a6025b37d --- /dev/null +++ b/vector-config/src/main/res/values/config-features.xml @@ -0,0 +1,11 @@ + + + + + + false + + From 9eccb9eaa084b1a59d4922277dcef50df3f96dfe Mon Sep 17 00:00:00 2001 From: ariskotsomitopoulos Date: Mon, 28 Mar 2022 13:59:59 +0300 Subject: [PATCH 3/9] Enable threads beta feedback --- vector-config/src/main/res/values/config-features.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vector-config/src/main/res/values/config-features.xml b/vector-config/src/main/res/values/config-features.xml index 0a6025b37d..1a1a62446f 100755 --- a/vector-config/src/main/res/values/config-features.xml +++ b/vector-config/src/main/res/values/config-features.xml @@ -6,6 +6,6 @@ to the users. --> - false + true From b996e0eac0e3d136c44eab9464ef146b9f3a7cc7 Mon Sep 17 00:00:00 2001 From: ariskotsomitopoulos Date: Mon, 28 Mar 2022 14:09:45 +0300 Subject: [PATCH 4/9] Add changelog --- changelog.d/5647.feature | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/5647.feature diff --git a/changelog.d/5647.feature b/changelog.d/5647.feature new file mode 100644 index 0000000000..e4192300a1 --- /dev/null +++ b/changelog.d/5647.feature @@ -0,0 +1 @@ +Users will be able to provide feedback for threads \ No newline at end of file From 3ba2419e9b8eb7cfc809a6f2144d93cd0525b46e Mon Sep 17 00:00:00 2001 From: ariskotsomitopoulos Date: Mon, 28 Mar 2022 14:15:15 +0300 Subject: [PATCH 5/9] Replace hardcoded string --- vector/src/main/res/layout/fragment_thread_list.xml | 2 +- vector/src/main/res/values/strings.xml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/vector/src/main/res/layout/fragment_thread_list.xml b/vector/src/main/res/layout/fragment_thread_list.xml index 026432035f..c0041c0d75 100644 --- a/vector/src/main/res/layout/fragment_thread_list.xml +++ b/vector/src/main/res/layout/fragment_thread_list.xml @@ -144,7 +144,7 @@ android:paddingTop="3dp" android:paddingEnd="10dp" android:paddingBottom="3dp" - android:text="BETA" + android:text="@string/beta" android:textColor="@color/palette_white" app:layout_constraintBottom_toBottomOf="@id/threadsBetaFeedbackButton" app:layout_constraintEnd_toStartOf="@id/threadsBetaFeedbackButton" diff --git a/vector/src/main/res/values/strings.xml b/vector/src/main/res/values/strings.xml index d227326ceb..3b5f1e6aca 100644 --- a/vector/src/main/res/values/strings.xml +++ b/vector/src/main/res/values/strings.xml @@ -1651,6 +1651,7 @@ Give Feedback on threads Threads Beta feedback Threads are a work in progress with new, exciting upcoming features, such as improved notifications. We’d love to hear your feedback! + BETA Show hidden events in timeline "Show complete history in encrypted rooms" From b5f8d2c91f5252d5ee973963c0a5c8c4d28c9354 Mon Sep 17 00:00:00 2001 From: ariskotsomitopoulos Date: Tue, 5 Apr 2022 14:50:18 +0300 Subject: [PATCH 6/9] Update string resource --- vector/src/main/res/values/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vector/src/main/res/values/strings.xml b/vector/src/main/res/values/strings.xml index 3b5f1e6aca..f44b9db1fc 100644 --- a/vector/src/main/res/values/strings.xml +++ b/vector/src/main/res/values/strings.xml @@ -1648,7 +1648,7 @@ Thanks, your feedback has been successfully sent The feedback failed to be sent (%s) Give Feedback - Give Feedback on threads + Give Feedback Threads Beta feedback Threads are a work in progress with new, exciting upcoming features, such as improved notifications. We’d love to hear your feedback! BETA From aef4cce3e77687c0be1ab13d7e6a3729fa64722f Mon Sep 17 00:00:00 2001 From: ariskotsomitopoulos Date: Tue, 5 Apr 2022 14:51:38 +0300 Subject: [PATCH 7/9] Format code ordering --- .../vector/app/features/rageshake/BugReporter.kt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/vector/src/main/java/im/vector/app/features/rageshake/BugReporter.kt b/vector/src/main/java/im/vector/app/features/rageshake/BugReporter.kt index 4a62d62e34..bf007ea1b0 100755 --- a/vector/src/main/java/im/vector/app/features/rageshake/BugReporter.kt +++ b/vector/src/main/java/im/vector/app/features/rageshake/BugReporter.kt @@ -258,9 +258,9 @@ class BugReporter @Inject constructor( ReportType.BUG_REPORT -> "[Element] $bugDescription" ReportType.SUGGESTION -> "[Element] [Suggestion] $bugDescription" ReportType.SPACE_BETA_FEEDBACK -> "[Element] [spaces-feedback] $bugDescription" + ReportType.THREADS_BETA_FEEDBACK -> "[Element] [threads-feedback] $bugDescription" ReportType.AUTO_UISI_SENDER, ReportType.AUTO_UISI -> bugDescription - ReportType.THREADS_BETA_FEEDBACK -> "[Element] [threads-feedback] $bugDescription" } // build the multi part request @@ -336,22 +336,22 @@ class BugReporter @Inject constructor( builder.addFormDataPart("label", "[Element]") when (reportType) { - ReportType.BUG_REPORT -> { + ReportType.BUG_REPORT -> { /* nop */ } - ReportType.SUGGESTION -> builder.addFormDataPart("label", "[Suggestion]") - ReportType.SPACE_BETA_FEEDBACK -> builder.addFormDataPart("label", "spaces-feedback") - ReportType.AUTO_UISI -> { + ReportType.SUGGESTION -> builder.addFormDataPart("label", "[Suggestion]") + ReportType.SPACE_BETA_FEEDBACK -> builder.addFormDataPart("label", "spaces-feedback") + ReportType.THREADS_BETA_FEEDBACK -> builder.addFormDataPart("label", "threads-feedback") + ReportType.AUTO_UISI -> { builder.addFormDataPart("label", "Z-UISI") builder.addFormDataPart("label", "android") builder.addFormDataPart("label", "uisi-recipient") } - ReportType.AUTO_UISI_SENDER -> { + ReportType.AUTO_UISI_SENDER -> { builder.addFormDataPart("label", "Z-UISI") builder.addFormDataPart("label", "android") builder.addFormDataPart("label", "uisi-sender") } - ReportType.THREADS_BETA_FEEDBACK -> builder.addFormDataPart("label", "threads-feedback") } if (getCrashFile().exists()) { From 858623b5a4fa57ca6f2281dde29071dc7efd95d7 Mon Sep 17 00:00:00 2001 From: ariskotsomitopoulos Date: Tue, 5 Apr 2022 16:26:42 +0300 Subject: [PATCH 8/9] Change default threads beta visibility --- vector/src/main/res/layout/fragment_thread_list.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/vector/src/main/res/layout/fragment_thread_list.xml b/vector/src/main/res/layout/fragment_thread_list.xml index c0041c0d75..6fcda47e79 100644 --- a/vector/src/main/res/layout/fragment_thread_list.xml +++ b/vector/src/main/res/layout/fragment_thread_list.xml @@ -120,6 +120,7 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent" android:background="@drawable/bg_shadow_divider" + android:visibility="gone" app:layout_constraintBottom_toTopOf="@id/threadsFeedBackConstraintLayout" /> From a269aa504636131c16bfa3ec7b0a9f3f3305fc27 Mon Sep 17 00:00:00 2001 From: ariskotsomitopoulos Date: Tue, 5 Apr 2022 16:29:54 +0300 Subject: [PATCH 9/9] Remove unused elevation --- vector/src/main/res/layout/fragment_thread_list.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/vector/src/main/res/layout/fragment_thread_list.xml b/vector/src/main/res/layout/fragment_thread_list.xml index 6fcda47e79..51228ca6bd 100644 --- a/vector/src/main/res/layout/fragment_thread_list.xml +++ b/vector/src/main/res/layout/fragment_thread_list.xml @@ -127,7 +127,6 @@ android:id="@+id/threadsFeedBackConstraintLayout" android:layout_width="0dp" android:layout_height="wrap_content" - android:elevation="30dp" android:padding="6dp" android:visibility="gone" app:layout_constraintBottom_toBottomOf="parent"