Skip to content
This repository has been archived by the owner on Jun 20, 2023. It is now read-only.

Feature/new error message #864

Merged
merged 4 commits into from
Jul 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ import com.google.android.gms.common.api.ApiException
import de.rki.coronawarnapp.CoronaWarnApplication
import de.rki.coronawarnapp.R
import de.rki.coronawarnapp.exception.ExceptionCategory
import de.rki.coronawarnapp.exception.reporting.ReportingConstants.STATUS_CODE_GOOGLE_API_FAIL
import de.rki.coronawarnapp.exception.reporting.ReportingConstants.STATUS_CODE_GOOGLE_UPDATE_NEEDED
import de.rki.coronawarnapp.exception.reporting.ReportingConstants.STATUS_CODE_REACHED_REQUEST_LIMIT
import java.io.PrintWriter
import java.io.StringWriter

Expand Down Expand Up @@ -38,6 +40,10 @@ fun Throwable.report(

if (this.statusCode == STATUS_CODE_GOOGLE_UPDATE_NEEDED) {
errorMessage = R.string.errors_google_update_needed
} else if (this.statusCode == STATUS_CODE_REACHED_REQUEST_LIMIT ||
this.statusCode == STATUS_CODE_GOOGLE_API_FAIL
) {
errorMessage = R.string.errors_google_api_error
}

intent.putExtra(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ object ReportingConstants {
val ERROR_REPORT_UNKNOWN_ERROR = ErrorCodes.REPORTED_EXCEPTION_UNKNOWN_PROBLEM.code

const val STATUS_CODE_GOOGLE_UPDATE_NEEDED = 17
const val STATUS_CODE_REACHED_REQUEST_LIMIT = 39508
const val STATUS_CODE_GOOGLE_API_FAIL = 10
}
2 changes: 2 additions & 0 deletions Corona-Warn-App/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -958,6 +958,8 @@
<string name="errors_external_action">"Diese Aktion ist aktuell leider nicht verfügbar. Bitte kontaktieren Sie die Hotline."</string>
<!-- XTXT: error dialog - phone still needs Google Play Services or Google Mobile Services update -->
<string name="errors_google_update_needed">"Ihre Corona-Warn-App ist korrekt installiert. Leider fehlen Ihrem Smartphone die "Benachrichtigungen zu möglicher Begegnung mit COVID-19-Infizierten" und Sie können die Corona-Warn-App nicht nutzen. Weitere Informationen finden Sie in unseren FAQ: https://www.coronawarn.app/de/faq/ \n"</string>
<!-- XTXT: error dialog - either Google API Error (10) or reached request limit per day -->
<string name="errors_google_api_error">"Ihre Corona-Warn-App läuft fehlerfrei. Leider können Sie Ihren Risikostatus im Moment nicht aktualisieren. Ihre Risiko-Ermittlung ist weiterhin aktiv und funktioniert. Weitere Informationen finden Sie in unseren FAQ: https://www.coronawarn.app/de/faq/ \n"</string>

<!-- ####################################
Generic Error Messages
Expand Down
2 changes: 2 additions & 0 deletions Corona-Warn-App/src/main/res/values-en/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -942,6 +942,8 @@
<string name="errors_external_action">"You cannot perform this action. Please contact the hotline."</string>
<!-- XTXT: error dialog - phone still needs Google Play Services or Google Mobile Services update -->
<string name="errors_google_update_needed">"Your Corona-Warn-App was installed correctly. Unfortunately, COVID-19 Exposure Notifications is currently not available on your device and you cannot use the Corona-Warn-App. Further information is available on our FAQ page: https://www.coronawarn.app/en/faq/ \n"</string>
<!-- XTXT: error dialog - either Google API Error (10) or reached request limit per day -->
<string name="errors_google_api_error">"Your Corona-Warn-App is working correctly. Unfortunately, you cannot update your risk level at the moment. Your exposure logging is still active and working correctly. Further information is available on our FAQ page: https://www.coronawarn.app/en/faq/ \n"</string>

<!-- ####################################
Generic Error Messages
Expand Down
2 changes: 2 additions & 0 deletions Corona-Warn-App/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -958,6 +958,8 @@
<string name="errors_external_action">"You cannot perform this action. Please contact the hotline."</string>
<!-- XTXT: error dialog - phone still needs Google Play Services or Google Mobile Services update -->
<string name="errors_google_update_needed">"Your Corona-Warn-App was installed correctly. Unfortunately, COVID-19 Exposure Notifications is currently not available on your device and you cannot use the Corona-Warn-App. Further information is available on our FAQ page: https://www.coronawarn.app/en/faq/ \n"</string>
<!-- XTXT: error dialog - either Google API Error (10) or reached request limit per day -->
<string name="errors_google_api_error">"Your Corona-Warn-App is working correctly. Unfortunately, you cannot update your risk level at the moment. Your exposure logging is still active and working correctly. Further information is available on our FAQ page: https://www.coronawarn.app/en/faq/ \n"</string>

<!-- ####################################
Generic Error Messages
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,7 @@ class ReportingConstantsTest {
Assert.assertEquals(ReportingConstants.ERROR_REPORT_API_EXCEPTION_CODE, "api-exception-code")
Assert.assertEquals(ReportingConstants.ERROR_REPORT_RES_ID, "res-id")
Assert.assertEquals(ReportingConstants.STATUS_CODE_GOOGLE_UPDATE_NEEDED, 17)
Assert.assertEquals(ReportingConstants.STATUS_CODE_REACHED_REQUEST_LIMIT, 39508)
Assert.assertEquals(ReportingConstants.STATUS_CODE_GOOGLE_API_FAIL, 10)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import de.rki.coronawarnapp.CoronaWarnApplication
import de.rki.coronawarnapp.R
import io.mockk.MockKAnnotations
import io.mockk.every
import io.mockk.mockk
import io.mockk.impl.annotations.MockK
import io.mockk.mockk
import io.mockk.mockkObject
import io.mockk.unmockkAll
import org.hamcrest.CoreMatchers
Expand Down Expand Up @@ -105,7 +105,6 @@ class FormatterSettingsHelperTest {
assertThat(result, `is`((context.getString(iValue))))
}


private fun formatTracingContentDescriptionBase(
bTracing: Boolean,
bBluetooth: Boolean,
Expand Down Expand Up @@ -522,63 +521,63 @@ class FormatterSettingsHelperTest {
bTracing = true,
bBluetooth = true,
bConnection = true,
sValue = R.string.settings_tracing_body_active.toString() + " " +R.string.accessibility_button.toString()
sValue = R.string.settings_tracing_body_active.toString() + " " + R.string.accessibility_button.toString()
)

// When tracing is false, bluetooth is false, connection is false
formatTracingContentDescriptionBase(
bTracing = false,
bBluetooth = false,
bConnection = false,
sValue = R.string.settings_tracing_body_inactive.toString() + " " +R.string.accessibility_button.toString()
sValue = R.string.settings_tracing_body_inactive.toString() + " " + R.string.accessibility_button.toString()
)

// When tracing is true, bluetooth is false, connection is false
formatTracingContentDescriptionBase(
bTracing = true,
bBluetooth = false,
bConnection = false,
sValue = R.string.settings_tracing_body_bluetooth_inactive.toString() + " " +R.string.accessibility_button.toString()
sValue = R.string.settings_tracing_body_bluetooth_inactive.toString() + " " + R.string.accessibility_button.toString()
)

// When tracing is true, bluetooth is true, connection is false
formatTracingContentDescriptionBase(
bTracing = true,
bBluetooth = true,
bConnection = false,
sValue = R.string.settings_tracing_body_connection_inactive.toString() + " " +R.string.accessibility_button.toString()
sValue = R.string.settings_tracing_body_connection_inactive.toString() + " " + R.string.accessibility_button.toString()
)

// When tracing is false, bluetooth is true, connection is false
formatTracingContentDescriptionBase(
bTracing = false,
bBluetooth = true,
bConnection = false,
sValue = R.string.settings_tracing_body_inactive.toString() + " " +R.string.accessibility_button.toString()
sValue = R.string.settings_tracing_body_inactive.toString() + " " + R.string.accessibility_button.toString()
)

// When tracing is false, bluetooth is true, connection is true
formatTracingContentDescriptionBase(
bTracing = false,
bBluetooth = true,
bConnection = true,
sValue = R.string.settings_tracing_body_inactive.toString() + " " +R.string.accessibility_button.toString()
sValue = R.string.settings_tracing_body_inactive.toString() + " " + R.string.accessibility_button.toString()
)

// When tracing is true, bluetooth is false, connection is true
formatTracingContentDescriptionBase(
bTracing = true,
bBluetooth = false,
bConnection = true,
sValue = R.string.settings_tracing_body_bluetooth_inactive.toString() + " " +R.string.accessibility_button.toString()
sValue = R.string.settings_tracing_body_bluetooth_inactive.toString() + " " + R.string.accessibility_button.toString()
)

// When tracing is false, bluetooth is false, connection is true
formatTracingContentDescriptionBase(
bTracing = false,
bBluetooth = false,
bConnection = true,
sValue = R.string.settings_tracing_body_inactive.toString() + " " +R.string.accessibility_button.toString()
sValue = R.string.settings_tracing_body_inactive.toString() + " " + R.string.accessibility_button.toString()
)
}

Expand Down