Skip to content
Snippets Groups Projects
Unverified Commit 65cbb848 authored by Kolya Opahle's avatar Kolya Opahle Committed by GitHub
Browse files

Homescreen Notifications, even though keys were submitted (EXPOSUREAPP-3181,...

Homescreen Notifications, even though keys were submitted (EXPOSUREAPP-3181, EXPOSUREAPP-3182) (#1418)

* Added additional checks to notification of exposure/test-result to check for finished submission

Signed-off-by: default avatarKolya Opahle <k.opahle@sap.com>

* Small changes to code style

Signed-off-by: default avatarKolya Opahle <k.opahle@sap.com>

Co-authored-by: default avatarMatthias Urhahn <matthias.urhahn@sap.com>
Co-authored-by: default avatarharambasicluka <64483219+harambasicluka@users.noreply.github.com>
parent 0319458a
No related branches found
No related tags found
No related merge requests found
......@@ -615,6 +615,8 @@ object LocalData {
)
}
fun submissionWasSuccessful(): Boolean = numberOfSuccessfulSubmissions() >= 1
fun testGUID(): String? = getSharedPreferenceInstance().getString(
CoronaWarnApplication.getAppContext()
.getString(R.string.preference_test_guid),
......
......@@ -114,7 +114,7 @@ object SubmissionRepository {
private suspend fun refreshUIState(refreshTestResult: Boolean) {
var uiState = DeviceUIState.UNPAIRED
if (LocalData.numberOfSuccessfulSubmissions() == 1) {
if (LocalData.submissionWasSuccessful()) {
uiState = DeviceUIState.SUBMITTED_FINAL
} else {
if (LocalData.registrationToken() != null) {
......
......@@ -563,7 +563,11 @@ object RiskLevelTransaction : Transaction() {
*/
private fun updateRiskLevelScore(riskLevel: RiskLevel) {
val lastCalculatedScore = RiskLevelRepository.getLastCalculatedScore()
if (RiskLevel.riskLevelChangedBetweenLowAndHigh(lastCalculatedScore, riskLevel)) {
if (RiskLevel.riskLevelChangedBetweenLowAndHigh(
lastCalculatedScore,
riskLevel
) && !LocalData.submissionWasSuccessful()
) {
NotificationHelper.sendNotification(
CoronaWarnApplication.getAppContext().getString(R.string.notification_body),
NotificationCompat.PRIORITY_HIGH
......
......@@ -89,13 +89,18 @@ class DiagnosisTestResultRetrievalPeriodicWorker(
* @see TestResult
*/
private fun initiateNotification(testResult: TestResult) {
if (LocalData.isTestResultNotificationSent() || LocalData.submissionWasSuccessful()) {
return
}
if (testResult == TestResult.NEGATIVE || testResult == TestResult.POSITIVE ||
testResult == TestResult.INVALID
) {
if (!CoronaWarnApplication.isAppInForeground) {
NotificationHelper.sendNotification(
CoronaWarnApplication.getAppContext()
.getString(R.string.notification_name), CoronaWarnApplication.getAppContext()
.getString(R.string.notification_name),
CoronaWarnApplication.getAppContext()
.getString(R.string.notification_body),
NotificationCompat.PRIORITY_HIGH
)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment