From 197a716d300c8d1c268d01e6c387435fd7e030af Mon Sep 17 00:00:00 2001 From: Martin Alig Date: Thu, 17 Jun 2021 10:33:16 +0200 Subject: [PATCH] New Flag for notification. --- .../backend/sdk/config/ws/config/WSBaseConfig.java | 4 +++- .../config/ws/config/mock/MockForceUpdateConfig.java | 2 +- .../sdk/config/ws/config/mock/MockInfoBoxConfig.java | 2 +- .../config/ws/controller/GaenConfigController.java | 5 ++++- .../backend/sdk/config/ws/model/ConfigResponse.java | 11 +++++++++++ 5 files changed, 20 insertions(+), 4 deletions(-) mode change 100644 => 100755 dpppt-config-backend/src/main/java/org/dpppt/switzerland/backend/sdk/config/ws/config/WSBaseConfig.java mode change 100644 => 100755 dpppt-config-backend/src/main/java/org/dpppt/switzerland/backend/sdk/config/ws/config/mock/MockForceUpdateConfig.java mode change 100644 => 100755 dpppt-config-backend/src/main/java/org/dpppt/switzerland/backend/sdk/config/ws/config/mock/MockInfoBoxConfig.java mode change 100644 => 100755 dpppt-config-backend/src/main/java/org/dpppt/switzerland/backend/sdk/config/ws/controller/GaenConfigController.java diff --git a/dpppt-config-backend/src/main/java/org/dpppt/switzerland/backend/sdk/config/ws/config/WSBaseConfig.java b/dpppt-config-backend/src/main/java/org/dpppt/switzerland/backend/sdk/config/ws/config/WSBaseConfig.java old mode 100644 new mode 100755 index 9a6fb9f..5b5e4ef --- a/dpppt-config-backend/src/main/java/org/dpppt/switzerland/backend/sdk/config/ws/config/WSBaseConfig.java +++ b/dpppt-config-backend/src/main/java/org/dpppt/switzerland/backend/sdk/config/ws/config/WSBaseConfig.java @@ -62,6 +62,8 @@ public abstract class WSBaseConfig implements SchedulingConfigurer, WebMvcConfig @Value("${ws.retentiondays: 21}") int retentionDays; + @Value("${ws.checkinupdatenotificationenabled: true}") + boolean checkInUpdateNotificationEnabled; @Value("#{${ws.security.headers: {'X-Content-Type-Options':'nosniff', 'X-Frame-Options':'DENY','X-Xss-Protection':'1; mode=block'}}}") Map additionalHeaders; @@ -79,7 +81,7 @@ public void addResourceHandlers(ResourceHandlerRegistry registry) { @Bean public GaenConfigController gaenConfigController(Messages messages) { - return new GaenConfigController(messages, interOpsCountryCodes); + return new GaenConfigController(messages, interOpsCountryCodes, checkInUpdateNotificationEnabled); } @Bean diff --git a/dpppt-config-backend/src/main/java/org/dpppt/switzerland/backend/sdk/config/ws/config/mock/MockForceUpdateConfig.java b/dpppt-config-backend/src/main/java/org/dpppt/switzerland/backend/sdk/config/ws/config/mock/MockForceUpdateConfig.java old mode 100644 new mode 100755 index 447cf67..1c18c92 --- a/dpppt-config-backend/src/main/java/org/dpppt/switzerland/backend/sdk/config/ws/config/mock/MockForceUpdateConfig.java +++ b/dpppt-config-backend/src/main/java/org/dpppt/switzerland/backend/sdk/config/ws/config/mock/MockForceUpdateConfig.java @@ -29,7 +29,7 @@ public GaenConfigController gaenConfigController(Messages messages) { public class MockForceUpdateController extends GaenConfigController { public MockForceUpdateController(Messages messages) { - super(messages, interOpsCountryCodes); + super(messages, interOpsCountryCodes, false); } @Override diff --git a/dpppt-config-backend/src/main/java/org/dpppt/switzerland/backend/sdk/config/ws/config/mock/MockInfoBoxConfig.java b/dpppt-config-backend/src/main/java/org/dpppt/switzerland/backend/sdk/config/ws/config/mock/MockInfoBoxConfig.java old mode 100644 new mode 100755 index 70de2ca..d218d30 --- a/dpppt-config-backend/src/main/java/org/dpppt/switzerland/backend/sdk/config/ws/config/mock/MockInfoBoxConfig.java +++ b/dpppt-config-backend/src/main/java/org/dpppt/switzerland/backend/sdk/config/ws/config/mock/MockInfoBoxConfig.java @@ -30,7 +30,7 @@ public GaenConfigController gaenConfigController(Messages messages) { public class MockInfoBoxController extends GaenConfigController { public MockInfoBoxController(Messages messages) { - super(messages, interOpsCountryCodes); + super(messages, interOpsCountryCodes, false); } @Override diff --git a/dpppt-config-backend/src/main/java/org/dpppt/switzerland/backend/sdk/config/ws/controller/GaenConfigController.java b/dpppt-config-backend/src/main/java/org/dpppt/switzerland/backend/sdk/config/ws/controller/GaenConfigController.java old mode 100644 new mode 100755 index f211908..3462d82 --- a/dpppt-config-backend/src/main/java/org/dpppt/switzerland/backend/sdk/config/ws/controller/GaenConfigController.java +++ b/dpppt-config-backend/src/main/java/org/dpppt/switzerland/backend/sdk/config/ws/controller/GaenConfigController.java @@ -96,12 +96,14 @@ public class GaenConfigController { protected final Messages messages; private final List interOpsCountryCodes; private final TestLocationHelper testLocationHelper; + private final boolean checkInUpdateNotificationEnabled; public GaenConfigController(Messages messages, - List interOpsCountryCodes) { + List interOpsCountryCodes, boolean checkInUpdateNotificationEnabled) { this.messages = messages; this.interOpsCountryCodes = interOpsCountryCodes; this.testLocationHelper = new TestLocationHelper(messages); + this.checkInUpdateNotificationEnabled = checkInUpdateNotificationEnabled; } @Documentation(description = "Echo endpoint", responses = { "200 => Hello from DP3T Config WS" }) @@ -121,6 +123,7 @@ public GaenConfigController(Messages messages, @Documentation(description = "Version of the OS", example = "ios13.6") @RequestParam String osversion, @Documentation(description = "Build number of the app", example = "ios-200619.2333.175") @RequestParam String buildnr) { ConfigResponse config = new ConfigResponse(); + config.setCheckInUpdateNotificationEnabled(this.checkInUpdateNotificationEnabled); config.setInterOpsCountries(interOpsCountryCodes); config.setTestInformationUrls(testLocationHelper.getTestInfoUrls()); config.setWhatToDoPositiveTestTexts(whatToDoPositiveTestTexts(messages)); diff --git a/dpppt-config-backend/src/main/java/org/dpppt/switzerland/backend/sdk/config/ws/model/ConfigResponse.java b/dpppt-config-backend/src/main/java/org/dpppt/switzerland/backend/sdk/config/ws/model/ConfigResponse.java index 551dbb0..8ceb27e 100644 --- a/dpppt-config-backend/src/main/java/org/dpppt/switzerland/backend/sdk/config/ws/model/ConfigResponse.java +++ b/dpppt-config-backend/src/main/java/org/dpppt/switzerland/backend/sdk/config/ws/model/ConfigResponse.java @@ -44,6 +44,9 @@ public class ConfigResponse { @Documentation(description = "Localized urls to test information website") private Map testInformationUrls; + @Documentation(description = "Flag to enable notifications informing users about the new checkin feature") + private boolean checkInUpdateNotificationEnabled = false; + public boolean isForceUpdate() { return forceUpdate; } @@ -107,4 +110,12 @@ public Map getTestInformationUrls() { public void setTestInformationUrls(Map testInformationUrls) { this.testInformationUrls = testInformationUrls; } + + public void setCheckInUpdateNotificationEnabled(boolean checkInUpdateNotificationEnabled) { + this.checkInUpdateNotificationEnabled = checkInUpdateNotificationEnabled; + } + + public boolean isCheckInUpdateNotificationEnabled() { + return checkInUpdateNotificationEnabled; + } }