Skip to content

Commit

Permalink
Merge pull request #117 from SwissCovid/feature/checkin-update-notifi…
Browse files Browse the repository at this point in the history
…cation

New Flag for notification.
  • Loading branch information
martinalig authored Jun 17, 2021
2 parents c3c2b35 + 197a716 commit 5dc06f2
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<String,String> additionalHeaders;
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,14 @@ public class GaenConfigController {
protected final Messages messages;
private final List<String> interOpsCountryCodes;
private final TestLocationHelper testLocationHelper;
private final boolean checkInUpdateNotificationEnabled;

public GaenConfigController(Messages messages,
List<String> interOpsCountryCodes) {
List<String> 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" })
Expand All @@ -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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ public class ConfigResponse {
@Documentation(description = "Localized urls to test information website")
private Map<String, String> testInformationUrls;

@Documentation(description = "Flag to enable notifications informing users about the new checkin feature")
private boolean checkInUpdateNotificationEnabled = false;

public boolean isForceUpdate() {
return forceUpdate;
}
Expand Down Expand Up @@ -107,4 +110,12 @@ public Map<String, String> getTestInformationUrls() {
public void setTestInformationUrls(Map<String, String> testInformationUrls) {
this.testInformationUrls = testInformationUrls;
}

public void setCheckInUpdateNotificationEnabled(boolean checkInUpdateNotificationEnabled) {
this.checkInUpdateNotificationEnabled = checkInUpdateNotificationEnabled;
}

public boolean isCheckInUpdateNotificationEnabled() {
return checkInUpdateNotificationEnabled;
}
}

0 comments on commit 5dc06f2

Please sign in to comment.