Add beta feedback for threads
This commit is contained in:
parent
a9b87de7a3
commit
58cc3931b9
|
@ -0,0 +1,9 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle" >
|
||||||
|
<gradient
|
||||||
|
android:angle="-90"
|
||||||
|
android:startColor="#00000000"
|
||||||
|
android:endColor="#1A000000"
|
||||||
|
/>
|
||||||
|
</shape>
|
|
@ -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.ThreadListController
|
||||||
import im.vector.app.features.home.room.threads.list.viewmodel.ThreadListViewModel
|
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.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.threads.model.ThreadSummary
|
||||||
import org.matrix.android.sdk.api.session.room.timeline.TimelineEvent
|
import org.matrix.android.sdk.api.session.room.timeline.TimelineEvent
|
||||||
import org.matrix.android.sdk.api.util.MatrixItem
|
import org.matrix.android.sdk.api.util.MatrixItem
|
||||||
|
@ -46,6 +48,7 @@ import javax.inject.Inject
|
||||||
|
|
||||||
class ThreadListFragment @Inject constructor(
|
class ThreadListFragment @Inject constructor(
|
||||||
private val avatarRenderer: AvatarRenderer,
|
private val avatarRenderer: AvatarRenderer,
|
||||||
|
private val bugReporter: BugReporter,
|
||||||
private val threadListController: ThreadListController,
|
private val threadListController: ThreadListController,
|
||||||
val threadListViewModelFactory: ThreadListViewModel.Factory
|
val threadListViewModelFactory: ThreadListViewModel.Factory
|
||||||
) : VectorBaseFragment<FragmentThreadListBinding>(),
|
) : VectorBaseFragment<FragmentThreadListBinding>(),
|
||||||
|
@ -80,6 +83,7 @@ class ThreadListFragment @Inject constructor(
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
initToolbar()
|
initToolbar()
|
||||||
initTextConstants()
|
initTextConstants()
|
||||||
|
initBetaFeedback()
|
||||||
views.threadListRecyclerView.configureWith(threadListController, TimelineItemAnimator(), hasFixedSize = false)
|
views.threadListRecyclerView.configureWith(threadListController, TimelineItemAnimator(), hasFixedSize = false)
|
||||||
threadListController.listener = this
|
threadListController.listener = this
|
||||||
}
|
}
|
||||||
|
@ -101,6 +105,13 @@ class ThreadListFragment @Inject constructor(
|
||||||
resources.getString(R.string.reply_in_thread))
|
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 ->
|
override fun invalidate() = withState(threadListViewModel) { state ->
|
||||||
renderEmptyStateIfNeeded(state)
|
renderEmptyStateIfNeeded(state)
|
||||||
threadListController.update(state)
|
threadListController.update(state)
|
||||||
|
|
|
@ -85,6 +85,15 @@ class BugReportActivity : VectorBaseActivity<ActivityBugReportBinding>() {
|
||||||
|
|
||||||
hideBugReportOptions()
|
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 -> {
|
else -> {
|
||||||
// other types not supported here
|
// other types not supported here
|
||||||
}
|
}
|
||||||
|
|
|
@ -255,11 +255,12 @@ class BugReporter @Inject constructor(
|
||||||
|
|
||||||
if (!mIsCancelled) {
|
if (!mIsCancelled) {
|
||||||
val text = when (reportType) {
|
val text = when (reportType) {
|
||||||
ReportType.BUG_REPORT -> "[Element] $bugDescription"
|
ReportType.BUG_REPORT -> "[Element] $bugDescription"
|
||||||
ReportType.SUGGESTION -> "[Element] [Suggestion] $bugDescription"
|
ReportType.SUGGESTION -> "[Element] [Suggestion] $bugDescription"
|
||||||
ReportType.SPACE_BETA_FEEDBACK -> "[Element] [spaces-feedback] $bugDescription"
|
ReportType.SPACE_BETA_FEEDBACK -> "[Element] [spaces-feedback] $bugDescription"
|
||||||
ReportType.AUTO_UISI_SENDER,
|
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
|
// build the multi part request
|
||||||
|
@ -350,6 +351,7 @@ class BugReporter @Inject constructor(
|
||||||
builder.addFormDataPart("label", "android")
|
builder.addFormDataPart("label", "android")
|
||||||
builder.addFormDataPart("label", "uisi-sender")
|
builder.addFormDataPart("label", "uisi-sender")
|
||||||
}
|
}
|
||||||
|
ReportType.THREADS_BETA_FEEDBACK -> builder.addFormDataPart("label", "threads-feedback")
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getCrashFile().exists()) {
|
if (getCrashFile().exists()) {
|
||||||
|
|
|
@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -20,6 +20,7 @@ enum class ReportType {
|
||||||
BUG_REPORT,
|
BUG_REPORT,
|
||||||
SUGGESTION,
|
SUGGESTION,
|
||||||
SPACE_BETA_FEEDBACK,
|
SPACE_BETA_FEEDBACK,
|
||||||
|
THREADS_BETA_FEEDBACK,
|
||||||
AUTO_UISI,
|
AUTO_UISI,
|
||||||
AUTO_UISI_SENDER,
|
AUTO_UISI_SENDER,
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:background="?android:colorBackground"
|
android:background="?android:colorBackground"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toTopOf="@id/threadsFeedBackConstraintLayout"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/threadListAppBarLayout"
|
app:layout_constraintTop_toBottomOf="@id/threadListAppBarLayout"
|
||||||
|
@ -75,13 +75,13 @@
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginBottom="20dp"
|
android:layout_marginBottom="20dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/thread_list_empty_title"
|
||||||
android:textColor="?vctr_content_primary"
|
android:textColor="?vctr_content_primary"
|
||||||
app:layout_constraintBottom_toTopOf="@id/threadListEmptySubtitleTextView"
|
app:layout_constraintBottom_toTopOf="@id/threadListEmptySubtitleTextView"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
android:gravity="center"
|
app:layout_constraintTop_toBottomOf="@id/threadListEmptyImageView" />
|
||||||
app:layout_constraintTop_toBottomOf="@id/threadListEmptyImageView"
|
|
||||||
android:text="@string/thread_list_empty_title" />
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/threadListEmptySubtitleTextView"
|
android:id="@+id/threadListEmptySubtitleTextView"
|
||||||
|
@ -90,12 +90,12 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginBottom="20dp"
|
android:layout_marginBottom="20dp"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
|
android:text="@string/thread_list_empty_subtitle"
|
||||||
android:textColor="?vctr_content_secondary"
|
android:textColor="?vctr_content_secondary"
|
||||||
app:layout_constraintBottom_toTopOf="@id/threadListEmptyNoticeTextView"
|
app:layout_constraintBottom_toTopOf="@id/threadListEmptyNoticeTextView"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/threadListEmptyTitleTextView"
|
app:layout_constraintTop_toBottomOf="@id/threadListEmptyTitleTextView" />
|
||||||
android:text="@string/thread_list_empty_subtitle" />
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/threadListEmptyNoticeTextView"
|
android:id="@+id/threadListEmptyNoticeTextView"
|
||||||
|
@ -112,4 +112,58 @@
|
||||||
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:id="@+id/threadFeedbackDivider"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="4dp"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
android:background="@drawable/bg_shadow_divider"
|
||||||
|
app:layout_constraintBottom_toTopOf="@id/threadsFeedBackConstraintLayout"
|
||||||
|
/>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:id="@+id/threadsFeedBackConstraintLayout"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:elevation="30dp"
|
||||||
|
android:padding="6dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent">
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/threadsBetaFeedbackIcon"
|
||||||
|
style="@style/Widget.Vector.TextView.Caption"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:background="@drawable/notification_badge"
|
||||||
|
android:backgroundTint="@color/palette_azure"
|
||||||
|
android:gravity="center"
|
||||||
|
android:paddingStart="10dp"
|
||||||
|
android:paddingTop="3dp"
|
||||||
|
android:paddingEnd="10dp"
|
||||||
|
android:paddingBottom="3dp"
|
||||||
|
android:text="BETA"
|
||||||
|
android:textColor="@color/palette_white"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/threadsBetaFeedbackButton"
|
||||||
|
app:layout_constraintEnd_toStartOf="@id/threadsBetaFeedbackButton"
|
||||||
|
app:layout_constraintHorizontal_chainStyle="packed"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/threadsBetaFeedbackButton" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/threadsBetaFeedbackButton"
|
||||||
|
style="@style/Widget.Vector.TextView.Body"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:padding="8dp"
|
||||||
|
android:text="@string/give_feedback_threads"
|
||||||
|
android:textColor="@color/vector_info_color"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toEndOf="@id/threadsBetaFeedbackIcon" />
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -1648,6 +1648,9 @@
|
||||||
<string name="feedback_sent">Thanks, your feedback has been successfully sent</string>
|
<string name="feedback_sent">Thanks, your feedback has been successfully sent</string>
|
||||||
<string name="feedback_failed">The feedback failed to be sent (%s)</string>
|
<string name="feedback_failed">The feedback failed to be sent (%s)</string>
|
||||||
<string name="give_feedback">Give Feedback</string>
|
<string name="give_feedback">Give Feedback</string>
|
||||||
|
<string name="give_feedback_threads">Give Feedback on threads</string>
|
||||||
|
<string name="send_feedback_threads_title">Threads Beta feedback</string>
|
||||||
|
<string name="send_feedback_threads_info">Threads are a work in progress with new, exciting upcoming features, such as improved notifications. We’d love to hear your feedback!</string>
|
||||||
|
|
||||||
<string name="settings_labs_show_hidden_events_in_timeline">Show hidden events in timeline</string>
|
<string name="settings_labs_show_hidden_events_in_timeline">Show hidden events in timeline</string>
|
||||||
<string name="settings_labs_show_complete_history_in_encrypted_room">"Show complete history in encrypted rooms"</string>
|
<string name="settings_labs_show_complete_history_in_encrypted_room">"Show complete history in encrypted rooms"</string>
|
||||||
|
|
Loading…
Reference in New Issue