From eb18b23528de732d4a37c872172fa01b2794ee52 Mon Sep 17 00:00:00 2001 From: Valere Date: Wed, 12 May 2021 10:07:51 +0200 Subject: [PATCH 1/8] Add option to send beta feedback --- tools/check/forbidden_strings_in_code.txt | 2 +- .../vector/app/features/home/HomeActivity.kt | 8 +- .../features/home/HomeActivitySharedAction.kt | 1 + .../features/rageshake/BugReportActivity.kt | 109 +++++++++++++----- .../app/features/rageshake/BugReporter.kt | 33 +++--- .../features/spaces/SpaceBetaHeaderItem.kt | 17 ++- .../app/features/spaces/SpaceListFragment.kt | 4 + .../spaces/SpaceSettingsMenuBottomSheet.kt | 7 ++ .../features/spaces/SpaceSummaryController.kt | 10 +- vector/src/main/res/drawable/ic_feedback.xml | 14 +++ .../main/res/layout/activity_bug_report.xml | 9 ++ .../layout/bottom_sheet_space_settings.xml | 14 ++- .../res/layout/item_space_beta_header.xml | 13 +++ vector/src/main/res/values/strings.xml | 8 ++ 14 files changed, 195 insertions(+), 54 deletions(-) create mode 100644 vector/src/main/res/drawable/ic_feedback.xml diff --git a/tools/check/forbidden_strings_in_code.txt b/tools/check/forbidden_strings_in_code.txt index 8f9cc852a7..b55487e8c0 100644 --- a/tools/check/forbidden_strings_in_code.txt +++ b/tools/check/forbidden_strings_in_code.txt @@ -161,7 +161,7 @@ Formatter\.formatShortFileSize===1 # android\.text\.TextUtils ### This is not a rule, but a warning: the number of "enum class" has changed. For Json classes, it is mandatory that they have `@JsonClass(generateAdapter = false)`. If the enum is not used as a Json class, change the value in file forbidden_strings_in_code.txt -enum class===99 +enum class===100 ### Do not import temporary legacy classes import org.matrix.android.sdk.internal.legacy.riot===3 diff --git a/vector/src/main/java/im/vector/app/features/home/HomeActivity.kt b/vector/src/main/java/im/vector/app/features/home/HomeActivity.kt index 1de1ff1c3e..766955f354 100644 --- a/vector/src/main/java/im/vector/app/features/home/HomeActivity.kt +++ b/vector/src/main/java/im/vector/app/features/home/HomeActivity.kt @@ -55,6 +55,7 @@ import im.vector.app.features.permalink.PermalinkHandler import im.vector.app.features.popup.DefaultVectorAlert import im.vector.app.features.popup.PopupAlertManager import im.vector.app.features.popup.VerificationVectorAlert +import im.vector.app.features.rageshake.ReportType import im.vector.app.features.rageshake.VectorUncaughtExceptionHandler import im.vector.app.features.settings.VectorPreferences import im.vector.app.features.settings.VectorSettingsActivity @@ -216,6 +217,9 @@ class HomeActivity : SpaceInviteBottomSheet.newInstance(sharedAction.spaceId) .show(supportFragmentManager, "SPACE_INVITE") } + HomeActivitySharedAction.SendSpaceFeedBack -> { + bugReporter.openBugReportScreen(this, ReportType.SPACE_BETA_FEEDBACK) + } }.exhaustive } .disposeOnDestroy() @@ -449,11 +453,11 @@ class HomeActivity : override fun onOptionsItemSelected(item: MenuItem): Boolean { when (item.itemId) { R.id.menu_home_suggestion -> { - bugReporter.openBugReportScreen(this, true) + bugReporter.openBugReportScreen(this, ReportType.SUGGESTION) return true } R.id.menu_home_report_bug -> { - bugReporter.openBugReportScreen(this, false) + bugReporter.openBugReportScreen(this, ReportType.BUG_REPORT) return true } R.id.menu_home_init_sync_legacy -> { diff --git a/vector/src/main/java/im/vector/app/features/home/HomeActivitySharedAction.kt b/vector/src/main/java/im/vector/app/features/home/HomeActivitySharedAction.kt index d79f24fc4c..6047a1e55e 100644 --- a/vector/src/main/java/im/vector/app/features/home/HomeActivitySharedAction.kt +++ b/vector/src/main/java/im/vector/app/features/home/HomeActivitySharedAction.kt @@ -29,4 +29,5 @@ sealed class HomeActivitySharedAction : VectorSharedAction { data class OpenSpacePreview(val spaceId: String) : HomeActivitySharedAction() data class OpenSpaceInvite(val spaceId: String) : HomeActivitySharedAction() data class ShowSpaceSettings(val spaceId: String) : HomeActivitySharedAction() + object SendSpaceFeedBack : HomeActivitySharedAction() } 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 024d84f27b..4017a30519 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 @@ -16,6 +16,8 @@ package im.vector.app.features.rageshake +import android.content.Context +import android.content.Intent import android.view.Menu import android.view.MenuItem import android.widget.Toast @@ -27,10 +29,17 @@ import im.vector.app.R import im.vector.app.core.di.ScreenComponent import im.vector.app.core.platform.VectorBaseActivity import im.vector.app.databinding.ActivityBugReportBinding +import org.matrix.android.sdk.api.extensions.tryOrNull import timber.log.Timber import javax.inject.Inject +enum class ReportType { + BUG_REPORT, + SUGGESTION, + SPACE_BETA_FEEDBACK +} + /** * Form to send a bug report */ @@ -46,7 +55,7 @@ class BugReportActivity : VectorBaseActivity() { private val viewModel: BugReportViewModel by viewModel() - private var forSuggestion: Boolean = false + private var reportType: ReportType = ReportType.BUG_REPORT override fun initUiAndData() { configureToolbar(views.bugReportToolbar) @@ -60,32 +69,50 @@ class BugReportActivity : VectorBaseActivity() { views.bugReportButtonIncludeScreenshot.isEnabled = false } - forSuggestion = intent.getBooleanExtra("FOR_SUGGESTION", false) + reportType = intent.getStringExtra(REPORT_TYPE_EXTRA)?.let { + tryOrNull { ReportType.valueOf(it) } + } ?: ReportType.BUG_REPORT // Default screen is for bug report, so modify it for suggestion - if (forSuggestion) { - supportActionBar?.setTitle(R.string.send_suggestion) + when (reportType) { + ReportType.BUG_REPORT -> { + supportActionBar?.setTitle(R.string.title_activity_bug_report) + views.bugReportButtonContactMe.isVisible = false + } + ReportType.SUGGESTION -> { + supportActionBar?.setTitle(R.string.send_suggestion) - views.bugReportFirstText.setText(R.string.send_suggestion_content) - views.bugReportTextInputLayout.hint = getString(R.string.send_suggestion_report_placeholder) + views.bugReportFirstText.setText(R.string.send_suggestion_content) + views.bugReportTextInputLayout.hint = getString(R.string.send_suggestion_report_placeholder) + views.bugReportButtonContactMe.isVisible = true - views.bugReportLogsDescription.isVisible = false + hideBugReportOptions() + } + ReportType.SPACE_BETA_FEEDBACK -> { + supportActionBar?.setTitle(R.string.send_feedback_space_title) - views.bugReportButtonIncludeLogs.isChecked = false - views.bugReportButtonIncludeLogs.isVisible = false + views.bugReportFirstText.setText(R.string.send_feedback_space_info) + views.bugReportTextInputLayout.hint = getString(R.string.feedback) + views.bugReportButtonContactMe.isVisible = true - views.bugReportButtonIncludeCrashLogs.isChecked = false - views.bugReportButtonIncludeCrashLogs.isVisible = false - - views.bugReportButtonIncludeKeyShareHistory.isChecked = false - views.bugReportButtonIncludeKeyShareHistory.isVisible = false - - // Keep the screenshot - } else { - supportActionBar?.setTitle(R.string.title_activity_bug_report) + hideBugReportOptions() + } } } + private fun hideBugReportOptions() { + views.bugReportLogsDescription.isVisible = false + + views.bugReportButtonIncludeLogs.isChecked = false + views.bugReportButtonIncludeLogs.isVisible = false + + views.bugReportButtonIncludeCrashLogs.isChecked = false + views.bugReportButtonIncludeCrashLogs.isVisible = false + + views.bugReportButtonIncludeKeyShareHistory.isChecked = false + views.bugReportButtonIncludeKeyShareHistory.isVisible = false + } + private fun setupViews() { views.bugReportEditText.doOnTextChanged { _, _, _, _ -> textChanged() } views.bugReportButtonIncludeScreenshot.setOnCheckedChangeListener { _, _ -> onSendScreenshotChanged() } @@ -134,23 +161,31 @@ class BugReportActivity : VectorBaseActivity() { views.bugReportProgressView.progress = 0 bugReporter.sendBugReport(this, - forSuggestion, + reportType, views.bugReportButtonIncludeLogs.isChecked, views.bugReportButtonIncludeCrashLogs.isChecked, views.bugReportButtonIncludeKeyShareHistory.isChecked, views.bugReportButtonIncludeScreenshot.isChecked, views.bugReportEditText.text.toString(), state.serverVersion, + views.bugReportButtonContactMe.isChecked, object : BugReporter.IMXBugReportListener { override fun onUploadFailed(reason: String?) { try { if (!reason.isNullOrEmpty()) { - if (forSuggestion) { - Toast.makeText(this@BugReportActivity, - getString(R.string.send_suggestion_failed, reason), Toast.LENGTH_LONG).show() - } else { - Toast.makeText(this@BugReportActivity, - getString(R.string.send_bug_report_failed, reason), Toast.LENGTH_LONG).show() + when (reportType) { + ReportType.BUG_REPORT -> { + Toast.makeText(this@BugReportActivity, + getString(R.string.send_bug_report_failed, reason), Toast.LENGTH_LONG).show() + } + ReportType.SUGGESTION -> { + Toast.makeText(this@BugReportActivity, + getString(R.string.send_suggestion_failed, reason), Toast.LENGTH_LONG).show() + } + ReportType.SPACE_BETA_FEEDBACK -> { + Toast.makeText(this@BugReportActivity, + getString(R.string.space_feedback_failed, reason), Toast.LENGTH_LONG).show() + } } } } catch (e: Exception) { @@ -178,10 +213,16 @@ class BugReportActivity : VectorBaseActivity() { override fun onUploadSucceed() { try { - if (forSuggestion) { - Toast.makeText(this@BugReportActivity, R.string.send_suggestion_sent, Toast.LENGTH_LONG).show() - } else { - Toast.makeText(this@BugReportActivity, R.string.send_bug_report_sent, Toast.LENGTH_LONG).show() + when (reportType) { + ReportType.BUG_REPORT -> { + Toast.makeText(this@BugReportActivity, R.string.send_bug_report_sent, Toast.LENGTH_LONG).show() + } + ReportType.SUGGESTION -> { + Toast.makeText(this@BugReportActivity, R.string.send_suggestion_sent, Toast.LENGTH_LONG).show() + } + ReportType.SPACE_BETA_FEEDBACK -> { + Toast.makeText(this@BugReportActivity, R.string.space_feedback_sent, Toast.LENGTH_LONG).show() + } } } catch (e: Exception) { Timber.e(e, "## onUploadSucceed() : failed to dismiss the toast") @@ -214,4 +255,14 @@ class BugReportActivity : VectorBaseActivity() { super.onBackPressed() } + + companion object { + private const val REPORT_TYPE_EXTRA = "REPORT_TYPE_EXTRA" + + fun intent(context: Context, reportType: ReportType): Intent { + return Intent(context, BugReportActivity::class.java).apply { + putExtra(REPORT_TYPE_EXTRA, reportType.name) + } + } + } } 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 15fd18039b..6ef8bbca55 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 @@ -149,7 +149,7 @@ class BugReporter @Inject constructor( * Send a bug report. * * @param context the application context - * @param forSuggestion true to send a suggestion + * @param reportType The report type (bug, suggestion, feedback) * @param withDevicesLogs true to include the device log * @param withCrashLogs true to include the crash logs * @param withKeyRequestHistory true to include the crash logs @@ -159,13 +159,14 @@ class BugReporter @Inject constructor( */ @SuppressLint("StaticFieldLeak") fun sendBugReport(context: Context, - forSuggestion: Boolean, + reportType: ReportType, withDevicesLogs: Boolean, withCrashLogs: Boolean, withKeyRequestHistory: Boolean, withScreenshot: Boolean, theBugDescription: String, serverVersion: String, + canContact: Boolean = false, listener: IMXBugReportListener?) { // enumerate files to delete val mBugReportFiles: MutableList = ArrayList() @@ -246,13 +247,11 @@ class BugReporter @Inject constructor( } if (!mIsCancelled) { - val text = "[Element] " + - if (forSuggestion) { - "[Suggestion] " - } else { - "" - } + - bugDescription + val text = when (reportType) { + ReportType.BUG_REPORT -> "[Element] $bugDescription" + ReportType.SUGGESTION -> "[Element] [Suggestion] $bugDescription" + ReportType.SPACE_BETA_FEEDBACK -> "[Element] [spaces-feedback] $bugDescription" + } // build the multi part request val builder = BugReporterMultipartBody.Builder() @@ -260,6 +259,7 @@ class BugReporter @Inject constructor( .addFormDataPart("app", "riot-android") .addFormDataPart("user_agent", Matrix.getInstance(context).getUserAgent()) .addFormDataPart("user_id", userId) + .addFormDataPart("can_contact", canContact.toString()) .addFormDataPart("device_id", deviceId) .addFormDataPart("version", versionProvider.getVersion(longFormat = true, useBuildNumber = false)) .addFormDataPart("branch_name", context.getString(R.string.git_branch_name)) @@ -321,9 +321,12 @@ class BugReporter @Inject constructor( // Special for RiotX builder.addFormDataPart("label", "[Element]") - // Suggestion - if (forSuggestion) { - builder.addFormDataPart("label", "[Suggestion]") + when (reportType) { + ReportType.BUG_REPORT -> { + /* nop */ + } + ReportType.SUGGESTION -> builder.addFormDataPart("label", "[Suggestion]") + ReportType.SPACE_BETA_FEEDBACK -> builder.addFormDataPart("label", "spaces-feedback") } if (getCrashFile(context).exists()) { @@ -447,16 +450,14 @@ class BugReporter @Inject constructor( /** * Send a bug report either with email or with Vector. */ - fun openBugReportScreen(activity: FragmentActivity, forSuggestion: Boolean = false) { + fun openBugReportScreen(activity: FragmentActivity, reportType: ReportType = ReportType.BUG_REPORT) { screenshot = takeScreenshot(activity) activeSessionHolder.getSafeActiveSession()?.let { it.logDbUsageInfo() it.cryptoService().logDbUsageInfo() } - val intent = Intent(activity, BugReportActivity::class.java) - intent.putExtra("FOR_SUGGESTION", forSuggestion) - activity.startActivity(intent) + activity.startActivity(BugReportActivity.intent(activity, reportType)) } // ============================================================================================================== diff --git a/vector/src/main/java/im/vector/app/features/spaces/SpaceBetaHeaderItem.kt b/vector/src/main/java/im/vector/app/features/spaces/SpaceBetaHeaderItem.kt index 8014dfad3d..1fbaee4b22 100644 --- a/vector/src/main/java/im/vector/app/features/spaces/SpaceBetaHeaderItem.kt +++ b/vector/src/main/java/im/vector/app/features/spaces/SpaceBetaHeaderItem.kt @@ -16,13 +16,28 @@ package im.vector.app.features.spaces +import android.view.View +import com.airbnb.epoxy.EpoxyAttribute import com.airbnb.epoxy.EpoxyModelClass import im.vector.app.R import im.vector.app.core.epoxy.VectorEpoxyHolder import im.vector.app.core.epoxy.VectorEpoxyModel +import im.vector.app.core.utils.DebouncedClickListener @EpoxyModelClass(layout = R.layout.item_space_beta_header) abstract class SpaceBetaHeaderItem : VectorEpoxyModel() { - class Holder : VectorEpoxyHolder() + @EpoxyAttribute(EpoxyAttribute.Option.DoNotHash) + var clickAction: View.OnClickListener? = null + + override fun bind(holder: Holder) { + super.bind(holder) + holder.feedBackAction.setOnClickListener(DebouncedClickListener({ + clickAction?.onClick(it) + })) + } + + class Holder : VectorEpoxyHolder() { + val feedBackAction by bind(R.id.spaceBetaFeedbackAction) + } } diff --git a/vector/src/main/java/im/vector/app/features/spaces/SpaceListFragment.kt b/vector/src/main/java/im/vector/app/features/spaces/SpaceListFragment.kt index f1627cc6b6..f50ba90221 100644 --- a/vector/src/main/java/im/vector/app/features/spaces/SpaceListFragment.kt +++ b/vector/src/main/java/im/vector/app/features/spaces/SpaceListFragment.kt @@ -101,4 +101,8 @@ class SpaceListFragment @Inject constructor( override fun onGroupSelected(groupSummary: GroupSummary?) { viewModel.handle(SpaceListAction.SelectLegacyGroup(groupSummary)) } + + override fun sendFeedBack() { + sharedActionViewModel.post(HomeActivitySharedAction.SendSpaceFeedBack) + } } diff --git a/vector/src/main/java/im/vector/app/features/spaces/SpaceSettingsMenuBottomSheet.kt b/vector/src/main/java/im/vector/app/features/spaces/SpaceSettingsMenuBottomSheet.kt index c39a9a93fa..1586b16ff6 100644 --- a/vector/src/main/java/im/vector/app/features/spaces/SpaceSettingsMenuBottomSheet.kt +++ b/vector/src/main/java/im/vector/app/features/spaces/SpaceSettingsMenuBottomSheet.kt @@ -33,6 +33,8 @@ import im.vector.app.databinding.BottomSheetSpaceSettingsBinding import im.vector.app.features.home.AvatarRenderer import im.vector.app.features.navigation.Navigator import im.vector.app.features.powerlevel.PowerLevelsObservableFactory +import im.vector.app.features.rageshake.BugReporter +import im.vector.app.features.rageshake.ReportType import im.vector.app.features.roomprofile.RoomProfileActivity import im.vector.app.features.settings.VectorPreferences import im.vector.app.features.spaces.manage.ManageType @@ -58,6 +60,7 @@ class SpaceSettingsMenuBottomSheet : VectorBaseBottomSheetDialogFragment + + + diff --git a/vector/src/main/res/layout/activity_bug_report.xml b/vector/src/main/res/layout/activity_bug_report.xml index 78a0139e1d..f21d2cda48 100644 --- a/vector/src/main/res/layout/activity_bug_report.xml +++ b/vector/src/main/res/layout/activity_bug_report.xml @@ -133,6 +133,15 @@ android:checked="false" android:text="@string/send_bug_report_include_key_share_history" /> + + + + + app:titleTextColor="?attr/riotx_text_primary" /> + + diff --git a/vector/src/main/res/values/strings.xml b/vector/src/main/res/values/strings.xml index cdd33b9a92..6c46600f43 100644 --- a/vector/src/main/res/values/strings.xml +++ b/vector/src/main/res/values/strings.xml @@ -2167,6 +2167,14 @@ Thanks, the suggestion has been successfully sent The suggestion failed to be sent (%s) + Spaces feedback + Feedback + You’re using a beta version of spaces. Your feedback will help inform the next versions. Your platform and username will be noted to help us use your feedback as much as we can. To leave the beta, visit your settings. + You may contact me if you have any follow up questions + Thanks, your feedback has been successfully sent + The feedback failed to be sent (%s) + Give Feedback + Show hidden events in timeline "Show complete history in encrypted rooms" From aefcb4841b7eaae76c0514c4c6cbea842b050b0d Mon Sep 17 00:00:00 2001 From: Valere Date: Wed, 12 May 2021 10:22:57 +0200 Subject: [PATCH 2/8] Cleaning --- .../features/rageshake/BugReportActivity.kt | 6 ----- .../app/features/rageshake/BugReporter.kt | 1 - .../app/features/rageshake/ReportType.kt | 23 +++++++++++++++++++ 3 files changed, 23 insertions(+), 7 deletions(-) create mode 100644 vector/src/main/java/im/vector/app/features/rageshake/ReportType.kt 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 4017a30519..2b7c3db490 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 @@ -34,12 +34,6 @@ import org.matrix.android.sdk.api.extensions.tryOrNull import timber.log.Timber import javax.inject.Inject -enum class ReportType { - BUG_REPORT, - SUGGESTION, - SPACE_BETA_FEEDBACK -} - /** * Form to send a bug report */ 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 6ef8bbca55..5202d78f1a 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 @@ -18,7 +18,6 @@ package im.vector.app.features.rageshake import android.annotation.SuppressLint import android.content.Context -import android.content.Intent import android.graphics.Bitmap import android.graphics.Canvas import android.os.Build 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 new file mode 100644 index 0000000000..44682efb40 --- /dev/null +++ b/vector/src/main/java/im/vector/app/features/rageshake/ReportType.kt @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2021 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package im.vector.app.features.rageshake + +enum class ReportType { + BUG_REPORT, + SUGGESTION, + SPACE_BETA_FEEDBACK +} From df3d3b63c88d5df7316cb2dd30d8a9ad6af49b73 Mon Sep 17 00:00:00 2001 From: Valere Date: Wed, 12 May 2021 11:04:54 +0200 Subject: [PATCH 3/8] Code review --- .../app/features/rageshake/BugReportActivity.kt | 15 +++++---------- vector/src/main/res/values/strings.xml | 8 +++----- 2 files changed, 8 insertions(+), 15 deletions(-) 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 2b7c3db490..d6d80673b0 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 @@ -71,7 +71,7 @@ class BugReportActivity : VectorBaseActivity() { when (reportType) { ReportType.BUG_REPORT -> { supportActionBar?.setTitle(R.string.title_activity_bug_report) - views.bugReportButtonContactMe.isVisible = false + views.bugReportButtonContactMe.isVisible = true } ReportType.SUGGESTION -> { supportActionBar?.setTitle(R.string.send_suggestion) @@ -172,13 +172,10 @@ class BugReportActivity : VectorBaseActivity() { Toast.makeText(this@BugReportActivity, getString(R.string.send_bug_report_failed, reason), Toast.LENGTH_LONG).show() } - ReportType.SUGGESTION -> { - Toast.makeText(this@BugReportActivity, - getString(R.string.send_suggestion_failed, reason), Toast.LENGTH_LONG).show() - } + ReportType.SUGGESTION, ReportType.SPACE_BETA_FEEDBACK -> { Toast.makeText(this@BugReportActivity, - getString(R.string.space_feedback_failed, reason), Toast.LENGTH_LONG).show() + getString(R.string.feedback_failed, reason), Toast.LENGTH_LONG).show() } } } @@ -211,11 +208,9 @@ class BugReportActivity : VectorBaseActivity() { ReportType.BUG_REPORT -> { Toast.makeText(this@BugReportActivity, R.string.send_bug_report_sent, Toast.LENGTH_LONG).show() } - ReportType.SUGGESTION -> { - Toast.makeText(this@BugReportActivity, R.string.send_suggestion_sent, Toast.LENGTH_LONG).show() - } + ReportType.SUGGESTION, ReportType.SPACE_BETA_FEEDBACK -> { - Toast.makeText(this@BugReportActivity, R.string.space_feedback_sent, Toast.LENGTH_LONG).show() + Toast.makeText(this@BugReportActivity, R.string.feedback_sent, Toast.LENGTH_LONG).show() } } } catch (e: Exception) { diff --git a/vector/src/main/res/values/strings.xml b/vector/src/main/res/values/strings.xml index 6c46600f43..48e53419d9 100644 --- a/vector/src/main/res/values/strings.xml +++ b/vector/src/main/res/values/strings.xml @@ -2164,15 +2164,13 @@ Make a suggestion Please write your suggestion below. Describe your suggestion here - Thanks, the suggestion has been successfully sent - The suggestion failed to be sent (%s) Spaces feedback Feedback - You’re using a beta version of spaces. Your feedback will help inform the next versions. Your platform and username will be noted to help us use your feedback as much as we can. To leave the beta, visit your settings. + You’re using a beta version of spaces. Your feedback will help inform the next versions. Your platform and username will be noted to help us use your feedback as much as we can. You may contact me if you have any follow up questions - Thanks, your feedback has been successfully sent - The feedback failed to be sent (%s) + Thanks, your feedback has been successfully sent + The feedback failed to be sent (%s) Give Feedback Show hidden events in timeline From 391e952fbde009d5469aafd85e4c6a3ea916dcd2 Mon Sep 17 00:00:00 2001 From: Valere Date: Wed, 12 May 2021 12:23:14 +0200 Subject: [PATCH 4/8] Review + design update --- .../app/core/ui/list/GenericItemHeader.kt | 11 +++++++ .../features/rageshake/BugReportActivity.kt | 9 ++++-- .../features/spaces/SpaceSummaryController.kt | 8 ++--- vector/src/main/res/drawable/ic_feedback.xml | 4 +-- .../res/layout/item_space_beta_header.xml | 29 ++++++++----------- vector/src/main/res/values/strings.xml | 4 ++- 6 files changed, 38 insertions(+), 27 deletions(-) diff --git a/vector/src/main/java/im/vector/app/core/ui/list/GenericItemHeader.kt b/vector/src/main/java/im/vector/app/core/ui/list/GenericItemHeader.kt index d0c65aff95..bc5446e836 100644 --- a/vector/src/main/java/im/vector/app/core/ui/list/GenericItemHeader.kt +++ b/vector/src/main/java/im/vector/app/core/ui/list/GenericItemHeader.kt @@ -16,12 +16,14 @@ package im.vector.app.core.ui.list import android.widget.TextView +import androidx.annotation.ColorInt import com.airbnb.epoxy.EpoxyAttribute import com.airbnb.epoxy.EpoxyModelClass import im.vector.app.R import im.vector.app.core.epoxy.VectorEpoxyHolder import im.vector.app.core.epoxy.VectorEpoxyModel import im.vector.app.core.extensions.setTextOrHide +import im.vector.app.features.themes.ThemeUtils /** * A generic list item header left aligned with notice color. @@ -32,9 +34,18 @@ abstract class GenericItemHeader : VectorEpoxyModel() @EpoxyAttribute var text: String? = null + @EpoxyAttribute + @ColorInt + var textColor: Int? = null + override fun bind(holder: Holder) { super.bind(holder) holder.text.setTextOrHide(text) + if (textColor != null) { + holder.text.setTextColor(textColor!!) + } else { + holder.text.setTextColor(ThemeUtils.getColor(holder.view.context, R.attr.vctr_notice_text_color)) + } } class Holder : VectorEpoxyHolder() { 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 d6d80673b0..27adefd50f 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 @@ -172,7 +172,10 @@ class BugReportActivity : VectorBaseActivity() { Toast.makeText(this@BugReportActivity, getString(R.string.send_bug_report_failed, reason), Toast.LENGTH_LONG).show() } - ReportType.SUGGESTION, + ReportType.SUGGESTION -> { + Toast.makeText(this@BugReportActivity, + getString(R.string.send_suggestion_failed, reason), Toast.LENGTH_LONG).show() + } ReportType.SPACE_BETA_FEEDBACK -> { Toast.makeText(this@BugReportActivity, getString(R.string.feedback_failed, reason), Toast.LENGTH_LONG).show() @@ -208,7 +211,9 @@ class BugReportActivity : VectorBaseActivity() { ReportType.BUG_REPORT -> { Toast.makeText(this@BugReportActivity, R.string.send_bug_report_sent, Toast.LENGTH_LONG).show() } - ReportType.SUGGESTION, + ReportType.SUGGESTION -> { + Toast.makeText(this@BugReportActivity, R.string.send_suggestion_sent, Toast.LENGTH_LONG).show() + } ReportType.SPACE_BETA_FEEDBACK -> { Toast.makeText(this@BugReportActivity, R.string.feedback_sent, Toast.LENGTH_LONG).show() } diff --git a/vector/src/main/java/im/vector/app/features/spaces/SpaceSummaryController.kt b/vector/src/main/java/im/vector/app/features/spaces/SpaceSummaryController.kt index 0d5d26ceb3..8f48c3c2f1 100644 --- a/vector/src/main/java/im/vector/app/features/spaces/SpaceSummaryController.kt +++ b/vector/src/main/java/im/vector/app/features/spaces/SpaceSummaryController.kt @@ -20,6 +20,7 @@ import android.view.View import com.airbnb.epoxy.EpoxyController import im.vector.app.R import im.vector.app.RoomGroupingMethod +import im.vector.app.core.resources.ColorProvider import im.vector.app.core.resources.StringProvider import im.vector.app.core.ui.list.genericFooterItem import im.vector.app.core.ui.list.genericItemHeader @@ -39,6 +40,7 @@ import javax.inject.Inject class SpaceSummaryController @Inject constructor( private val avatarRenderer: AvatarRenderer, + private val colorProvider: ColorProvider, private val stringProvider: StringProvider) : EpoxyController() { var callback: Callback? = null @@ -73,6 +75,7 @@ class SpaceSummaryController @Inject constructor( genericItemHeader { id("legacy_groups") text(stringProvider.getString(R.string.groups_header)) + textColor(colorProvider.getColorFromAttribute(R.attr.riotx_text_primary)) } // add home for communities @@ -105,11 +108,6 @@ class SpaceSummaryController @Inject constructor( rootSpaces: List?, expandedStates: Map, homeCount: RoomAggregateNotificationCount) { - genericItemHeader { - id("spaces") - text(stringProvider.getString(R.string.spaces_header)) - } - spaceBetaHeaderItem { id("beta_header") clickAction(View.OnClickListener { diff --git a/vector/src/main/res/drawable/ic_feedback.xml b/vector/src/main/res/drawable/ic_feedback.xml index b9f5584177..e774a8ab5c 100644 --- a/vector/src/main/res/drawable/ic_feedback.xml +++ b/vector/src/main/res/drawable/ic_feedback.xml @@ -5,10 +5,10 @@ android:viewportHeight="16"> diff --git a/vector/src/main/res/layout/item_space_beta_header.xml b/vector/src/main/res/layout/item_space_beta_header.xml index 1827c691d4..9df9e26386 100644 --- a/vector/src/main/res/layout/item_space_beta_header.xml +++ b/vector/src/main/res/layout/item_space_beta_header.xml @@ -1,14 +1,14 @@ + android:paddingStart="16dp" + android:paddingEnd="16dp"> + android:layout_height="wrap_content"> - - + android:textStyle="bold" + app:drawableEndCompat="@drawable/ic_beta_pill" /> @@ -44,14 +39,14 @@ android:id="@+id/spaceBetaFeedbackAction" android:layout_width="match_parent" android:layout_height="wrap_content" + android:layout_marginBottom="4dp" + android:drawablePadding="8dp" android:paddingTop="4dp" android:paddingBottom="4dp" - android:layout_marginBottom="4dp" android:text="@string/give_feedback" - android:drawableStart="@drawable/ic_feedback" - android:drawablePadding="8dp" android:textColor="@color/vector_info_color" - android:textSize="15sp" /> + android:textSize="15sp" + app:drawableStartCompat="@drawable/ic_feedback" /> diff --git a/vector/src/main/res/values/strings.xml b/vector/src/main/res/values/strings.xml index 48e53419d9..3cac228c6b 100644 --- a/vector/src/main/res/values/strings.xml +++ b/vector/src/main/res/values/strings.xml @@ -2164,6 +2164,8 @@ Make a suggestion Please write your suggestion below. Describe your suggestion here + Thanks, the suggestion has been successfully sent + The suggestion failed to be sent (%s) Spaces feedback Feedback @@ -3353,7 +3355,7 @@ Add existing rooms and space Welcome to Spaces! - Spaces are ways to group rooms and people for work, fun or just yourself. + Spaces are a new way to group rooms and people. You are invited From 0d5b66f92b92a7bd7b92d2a7f5917c3f0bb00e1c Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Wed, 12 May 2021 13:53:03 +0200 Subject: [PATCH 5/8] Flatten View hierarchy --- .../res/layout/item_space_beta_header.xml | 76 ++++++++----------- 1 file changed, 32 insertions(+), 44 deletions(-) diff --git a/vector/src/main/res/layout/item_space_beta_header.xml b/vector/src/main/res/layout/item_space_beta_header.xml index 9df9e26386..47891814a4 100644 --- a/vector/src/main/res/layout/item_space_beta_header.xml +++ b/vector/src/main/res/layout/item_space_beta_header.xml @@ -1,55 +1,43 @@ - - + android:layout_height="wrap_content" + android:layout_marginTop="8dp" + android:text="@string/spaces_header" + android:textColor="?riotx_text_primary" + android:textSize="15sp" + android:textStyle="bold" + app:drawableEndCompat="@drawable/ic_beta_pill" /> - + - + - - - - - - - - - \ No newline at end of file + From 5d052cda79cd2b68ca501725d45f50b63754de8a Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Wed, 12 May 2021 13:55:47 +0200 Subject: [PATCH 6/8] Increase clickable area (no layout rendering change) --- vector/src/main/res/layout/item_space_beta_header.xml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/vector/src/main/res/layout/item_space_beta_header.xml b/vector/src/main/res/layout/item_space_beta_header.xml index 47891814a4..4ae5f8e9a2 100644 --- a/vector/src/main/res/layout/item_space_beta_header.xml +++ b/vector/src/main/res/layout/item_space_beta_header.xml @@ -22,19 +22,19 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="8dp" - android:layout_marginBottom="4dp" android:text="@string/spaces_beta_welcome_to_spaces_desc" android:textColor="?riotx_text_secondary" android:textSize="15sp" /> Date: Wed, 12 May 2021 14:06:59 +0200 Subject: [PATCH 7/8] Fix lint issue --- vector/src/main/res/layout/bottom_sheet_space_settings.xml | 1 + .../src/main/res/layout/fragment_matrix_to_room_space_card.xml | 2 +- vector/src/main/res/values/strings.xml | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/vector/src/main/res/layout/bottom_sheet_space_settings.xml b/vector/src/main/res/layout/bottom_sheet_space_settings.xml index fc29be1899..9f17267334 100644 --- a/vector/src/main/res/layout/bottom_sheet_space_settings.xml +++ b/vector/src/main/res/layout/bottom_sheet_space_settings.xml @@ -49,6 +49,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginEnd="8dp" + android:contentDescription="@string/a11y_beta" android:src="@drawable/ic_beta_pill" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent" /> diff --git a/vector/src/main/res/layout/fragment_matrix_to_room_space_card.xml b/vector/src/main/res/layout/fragment_matrix_to_room_space_card.xml index 85ec04ba50..3b12a05c92 100644 --- a/vector/src/main/res/layout/fragment_matrix_to_room_space_card.xml +++ b/vector/src/main/res/layout/fragment_matrix_to_room_space_card.xml @@ -33,7 +33,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="@dimen/layout_vertical_margin_big" - android:importantForAccessibility="no" + android:contentDescription="@string/a11y_beta" android:src="@drawable/ic_beta_pill" android:visibility="gone" app:layout_constraintEnd_toEndOf="parent" diff --git a/vector/src/main/res/values/strings.xml b/vector/src/main/res/values/strings.xml index 3cac228c6b..da195f78cb 100644 --- a/vector/src/main/res/values/strings.xml +++ b/vector/src/main/res/values/strings.xml @@ -2294,6 +2294,7 @@ Show password Hide password Jump to bottom + This feature is undergoing beta testing From 72e343ad5ad66a48e4b994ea5b84e7db7158d195 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Wed, 12 May 2021 14:26:20 +0200 Subject: [PATCH 8/8] Better wording --- 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 da195f78cb..aa85a52ec3 100644 --- a/vector/src/main/res/values/strings.xml +++ b/vector/src/main/res/values/strings.xml @@ -2294,7 +2294,7 @@ Show password Hide password Jump to bottom - This feature is undergoing beta testing + This feature is in beta