From 3714e4e7874f0f68e9225c5ef3ca99c92ad11200 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Thu, 8 Oct 2020 21:55:16 +0200 Subject: [PATCH] Add a Waiting for user state --- .../settings/troubleshoot/TestPushFromPushGateway.kt | 2 +- .../VectorSettingsNotificationsTroubleshootFragment.kt | 3 ++- .../NotificationTroubleshootRecyclerViewAdapter.kt | 10 ++++++++++ .../features/settings/troubleshoot/TroubleshootTest.kt | 1 + vector/src/main/res/values/strings.xml | 2 +- 5 files changed, 15 insertions(+), 3 deletions(-) diff --git a/vector/src/gplay/java/im/vector/app/gplay/features/settings/troubleshoot/TestPushFromPushGateway.kt b/vector/src/gplay/java/im/vector/app/gplay/features/settings/troubleshoot/TestPushFromPushGateway.kt index bbe3f35fb5..ce94244ee6 100644 --- a/vector/src/gplay/java/im/vector/app/gplay/features/settings/troubleshoot/TestPushFromPushGateway.kt +++ b/vector/src/gplay/java/im/vector/app/gplay/features/settings/troubleshoot/TestPushFromPushGateway.kt @@ -58,7 +58,7 @@ class TestPushFromPushGateway @Inject constructor(private val context: AppCompat override fun onSuccess(data: Unit) { // Wait for user to click on the notification description = stringProvider.getString(R.string.settings_troubleshoot_test_push_loop_success) - status = TestStatus.RUNNING + status = TestStatus.WAITING_FOR_USER } }) } diff --git a/vector/src/main/java/im/vector/app/features/settings/VectorSettingsNotificationsTroubleshootFragment.kt b/vector/src/main/java/im/vector/app/features/settings/VectorSettingsNotificationsTroubleshootFragment.kt index ea9e73f160..4843c1446a 100644 --- a/vector/src/main/java/im/vector/app/features/settings/VectorSettingsNotificationsTroubleshootFragment.kt +++ b/vector/src/main/java/im/vector/app/features/settings/VectorSettingsNotificationsTroubleshootFragment.kt @@ -104,7 +104,8 @@ class VectorSettingsNotificationsTroubleshootFragment @Inject constructor( mSummaryButton.visibility = View.GONE mRunButton.visibility = View.VISIBLE } - TroubleshootTest.TestStatus.RUNNING -> { + TroubleshootTest.TestStatus.RUNNING, + TroubleshootTest.TestStatus.WAITING_FOR_USER -> { val size = troubleshootTestManager.testListSize val currentTestIndex = troubleshootTestManager.currentTestIndex mSummaryDescription.text = getString( diff --git a/vector/src/main/java/im/vector/app/features/settings/troubleshoot/NotificationTroubleshootRecyclerViewAdapter.kt b/vector/src/main/java/im/vector/app/features/settings/troubleshoot/NotificationTroubleshootRecyclerViewAdapter.kt index 1ccd7b6735..633d9d05fe 100644 --- a/vector/src/main/java/im/vector/app/features/settings/troubleshoot/NotificationTroubleshootRecyclerViewAdapter.kt +++ b/vector/src/main/java/im/vector/app/features/settings/troubleshoot/NotificationTroubleshootRecyclerViewAdapter.kt @@ -77,6 +77,16 @@ class NotificationTroubleshootRecyclerViewAdapter(val tests: ArrayList { + progressBar.visibility = View.INVISIBLE + statusIconImage.visibility = View.VISIBLE + val infoColor = ContextCompat.getColor(context, R.color.vector_info_color) + val drawable = ContextCompat.getDrawable(itemView.context, R.drawable.ic_notification_privacy_warning)?.apply { + ThemeUtils.tintDrawableWithColor(this, infoColor) + } + statusIconImage.setImageDrawable(drawable) + descriptionText.setTextColor(infoColor) + } TroubleshootTest.TestStatus.RUNNING -> { progressBar.visibility = View.VISIBLE statusIconImage.visibility = View.INVISIBLE diff --git a/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TroubleshootTest.kt b/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TroubleshootTest.kt index aedca5e356..c775c8c827 100644 --- a/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TroubleshootTest.kt +++ b/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TroubleshootTest.kt @@ -25,6 +25,7 @@ abstract class TroubleshootTest(@StringRes val titleResId: Int) { enum class TestStatus { NOT_STARTED, RUNNING, + WAITING_FOR_USER, FAILED, SUCCESS } diff --git a/vector/src/main/res/values/strings.xml b/vector/src/main/res/values/strings.xml index 004da5e15e..ef6b63aeb0 100644 --- a/vector/src/main/res/values/strings.xml +++ b/vector/src/main/res/values/strings.xml @@ -750,7 +750,7 @@ Failed to register FCM token to HomeServer:\n%1$s Test Push - The application is receiving PUSH, please click on the test notification you just receive. + The application is receiving PUSH, please click on the test notification you just received. The notification has been clicked! Failed to receive push. Solution could be to reinstall the application. You are receiving PUSH! Click me!