Add a Waiting for user state

This commit is contained in:
Benoit Marty 2020-10-08 21:55:16 +02:00 committed by Benoit Marty
parent ab9bbe9a48
commit 3714e4e787
5 changed files with 15 additions and 3 deletions

View File

@ -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
}
})
}

View File

@ -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(

View File

@ -77,6 +77,16 @@ class NotificationTroubleshootRecyclerViewAdapter(val tests: ArrayList<Troublesh
statusIconImage.visibility = View.VISIBLE
statusIconImage.setImageResource(R.drawable.unit_test)
}
TroubleshootTest.TestStatus.WAITING_FOR_USER -> {
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

View File

@ -25,6 +25,7 @@ abstract class TroubleshootTest(@StringRes val titleResId: Int) {
enum class TestStatus {
NOT_STARTED,
RUNNING,
WAITING_FOR_USER,
FAILED,
SUCCESS
}

View File

@ -750,7 +750,7 @@
<string name="settings_troubleshoot_test_token_registration_failed">Failed to register FCM token to HomeServer:\n%1$s</string>
<string name="settings_troubleshoot_test_push_loop_title">Test Push</string>
<string name="settings_troubleshoot_test_push_loop_success">The application is receiving PUSH, please click on the test notification you just receive.</string>
<string name="settings_troubleshoot_test_push_loop_success">The application is receiving PUSH, please click on the test notification you just received.</string>
<string name="settings_troubleshoot_test_push_loop_notification_clicked">The notification has been clicked!</string>
<string name="settings_troubleshoot_test_push_loop_failed">Failed to receive push. Solution could be to reinstall the application.</string>
<string name="settings_troubleshoot_test_push_notification_content">You are receiving PUSH! Click me!</string>