Skip to content

Commit

Permalink
Merge pull request #133 from SwissCovid/feature/deactivation
Browse files Browse the repository at this point in the history
implement app deactivation flag and texts
  • Loading branch information
simonroesch authored Mar 30, 2022
2 parents 2021d5f + 76c7031 commit 728953d
Show file tree
Hide file tree
Showing 22 changed files with 263 additions and 99 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import org.springframework.boot.actuate.info.InfoEndpoint;
import org.springframework.boot.actuate.logging.LoggersEndpoint;
import org.springframework.boot.actuate.metrics.export.prometheus.PrometheusScrapeEndpoint;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import org.springframework.core.Ordered;
Expand All @@ -15,8 +14,6 @@
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;

@Configuration
@Order(Ordered.HIGHEST_PRECEDENCE + 9)
Expand All @@ -31,13 +28,6 @@ public class ActuatorSecurity extends WebSecurityConfigurerAdapter {
@Value("${ws.monitor.prometheus.password}")
private String password;


@Bean
ActuatorSecurityConfig passwordDefault() {
return new ActuatorSecurityConfig(
user, password);
}

@Override
protected void configure(HttpSecurity http) throws Exception {
http.requestMatcher(
Expand Down Expand Up @@ -74,13 +64,9 @@ protected void configure(
throws Exception {
auth.inMemoryAuthentication()
.withUser(user)
.password(passwordEncoder().encode(password))
.password(password)
.roles(PROMETHEUS_ROLE);
}
@Bean
public PasswordEncoder passwordEncoder() {
return new BCryptPasswordEncoder();
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,15 @@ public VaccinationInfoHelper vaccinationInfoHelper(Messages messages) {
public GaenConfigController gaenConfigController(
Messages messages,
VaccinationInfoHelper vaccinationInfoHelper,
@Value("${ws.vaccination-info.show:false}") boolean showVaccinationInfo) {
@Value("${ws.vaccination-info.show:false}") boolean showVaccinationInfo,
@Value("${ws.deactivate-app:false}") boolean deactivate) {
return new GaenConfigController(
messages,
interOpsCountryCodes,
checkInUpdateNotificationEnabled,
vaccinationInfoHelper,
showVaccinationInfo);
showVaccinationInfo,
deactivate);
}

@Bean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,25 @@ public class MockForceUpdateConfig {
public GaenConfigController gaenConfigController(
Messages messages,
VaccinationInfoHelper vaccinationInfoHelper,
@Value("${ws.vaccination-info.show:false}") boolean showVaccinationInfo) {
return new MockForceUpdateController(messages, vaccinationInfoHelper, showVaccinationInfo);
@Value("${ws.vaccination-info.show:false}") boolean showVaccinationInfo,
@Value("$(ws.deactivate-app:false") boolean deactivate) {
return new MockForceUpdateController(messages, vaccinationInfoHelper, showVaccinationInfo, deactivate);
}

public class MockForceUpdateController extends GaenConfigController {

public MockForceUpdateController(
Messages messages,
VaccinationInfoHelper vaccinationInfoHelper,
boolean showVaccinationInfo) {
boolean showVaccinationInfo,
boolean deactivate) {
super(
messages,
interOpsCountryCodes,
false,
vaccinationInfoHelper,
showVaccinationInfo);
showVaccinationInfo,
deactivate);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,25 @@ public class MockInfoBoxConfig {
public GaenConfigController gaenConfigController(
Messages messages,
VaccinationInfoHelper vaccinationInfoHelper,
@Value("${ws.vaccination-info.show:false}") boolean showVaccinationInfo) {
return new MockInfoBoxController(messages, vaccinationInfoHelper, showVaccinationInfo);
@Value("${ws.vaccination-info.show:false}") boolean showVaccinationInfo,
@Value("$(ws.deactivate-app:false") boolean deactivate) {
return new MockInfoBoxController(messages, vaccinationInfoHelper, showVaccinationInfo, deactivate);
}

public class MockInfoBoxController extends GaenConfigController {

public MockInfoBoxController(
Messages messages,
VaccinationInfoHelper vaccinationInfoHelper,
boolean showVaccinationInfo) {
boolean showVaccinationInfo,
boolean deactivate) {
super(
messages,
interOpsCountryCodes,
false,
vaccinationInfoHelper,
showVaccinationInfo);
showVaccinationInfo,
deactivate);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import org.dpppt.switzerland.backend.sdk.config.ws.helper.IOS136InfoBoxHelper;
import org.dpppt.switzerland.backend.sdk.config.ws.helper.MockHelper;
import org.dpppt.switzerland.backend.sdk.config.ws.helper.TestLocationHelper;
import org.dpppt.switzerland.backend.sdk.config.ws.helper.VaccinationInfoHelper;
Expand Down Expand Up @@ -78,28 +77,39 @@ public class GaenConfigController {
private static final String IOS_VERSION_14 = "ios14.0";
private static final Version APP_VERSION_1_0_9 = new Version("ios-1.0.9");
private static final Version IOS_APP_VERSION_1_1_2 = new Version("ios-1.1.2");
private static final Version APP_VERSION_2_3_1 = new Version("ios-2.3.1");


private static final Logger logger = LoggerFactory.getLogger(GaenConfigController.class);

public static final String TERMINATION_TITLE = "termination_title";
public static final String TERMINATION_TEXT = "termination_text";
public static final String TERMINATION_TEXT_INFOBOX = "termination_text_infobox";
public static final String TERMINATION_LINK_TITLE = "termination_link_title";
public static final String TERMINATION_LINK_URL = "termination_url";

protected final Messages messages;
private final List<String> interOpsCountryCodes;
private final TestLocationHelper testLocationHelper;
private final boolean checkInUpdateNotificationEnabled;
private final VaccinationInfoHelper vaccinationInfoHelper;
private final boolean showVaccinationInfo;
private final boolean deactivate;

public GaenConfigController(
Messages messages,
List<String> interOpsCountryCodes,
boolean checkInUpdateNotificationEnabled,
VaccinationInfoHelper vaccinationInfoHelper,
boolean showVaccinationInfo) {
boolean showVaccinationInfo,
boolean deactivate) {
this.messages = messages;
this.interOpsCountryCodes = interOpsCountryCodes;
this.testLocationHelper = new TestLocationHelper(messages);
this.checkInUpdateNotificationEnabled = checkInUpdateNotificationEnabled;
this.vaccinationInfoHelper = vaccinationInfoHelper;
this.showVaccinationInfo = showVaccinationInfo;
this.deactivate = deactivate;
}

@Documentation(
Expand Down Expand Up @@ -140,27 +150,13 @@ public GaenConfigController(
config.setVaccinationBookingCantons(vaccinationInfoHelper.getVaccinationBookingCantons());
config.setVaccinationBookingInfo(vaccinationInfoHelper.getVaccinationBookingInfo());
config.setShowVaccinationInfo(showVaccinationInfo);
config.setDeactivate(deactivate);

// For iOS 13.6 users show information about weekly notification
if (osversion.startsWith(IOS_VERSION_DE_WEEKLY_NOTIFCATION_INFO)) {
IOS136InfoBoxHelper.setInfoTextForiOS136(config);
}

// if we have testflight builds suggest to switch to store version
if (TESTFLIGHT_VERSIONS.contains(buildnr)) {
config = testFlightUpdate();
}

// Build nr of the initial iOS pilot test app. Contains bug, that factors are
// not used correctly in contact calculations. Set factorHigh to 0.0 for
// improving the calculation.
if (buildnr.equals("ios-200524.1316.87")) {
config.getiOSGaenSdkConfig().setFactorHigh(0.0d);
}

// Check for old app Versions, iOS only
if (userAppVersion.isIOS() && APP_VERSION_1_0_9.isLargerVersionThan(userAppVersion)) {
config = generalUpdateRelease(true);
//Check for version >2.3.1 (the deactivation update)
if (userAppVersion.isLargerVersionThan(APP_VERSION_2_3_1)) {
config.setDeactivationMessage(appDeactivationInfobox(false));
} else {
config.setInfoBox(appDeactivationInfobox(true));
}

// Work around a limitation of SwissCovid 1.1.2 on iOS which requires an InfoBox
Expand Down Expand Up @@ -295,6 +291,42 @@ private ConfigResponse testFlightUpdate() {
return configResponse;
}


private InfoBox createDeactivationInfobox(Language language, boolean oldVersion){
InfoBox infoBox = new InfoBox();
if(oldVersion){
infoBox.setMsg(messages.getNullableMessage(TERMINATION_TEXT_INFOBOX, language.toLocale()));
}else{
infoBox.setMsg(messages.getNullableMessage(TERMINATION_TEXT, language.toLocale()));
}

infoBox.setTitle(messages.getNullableMessage(TERMINATION_TITLE, language.toLocale()));
infoBox.setUrlTitle(messages.getNullableMessage(TERMINATION_LINK_TITLE, language.toLocale()));
infoBox.setUrl(messages.getNullableMessage(TERMINATION_LINK_URL, language.toLocale()));
infoBox.setIsDismissible(false);
return infoBox;
}


private InfoBoxCollection appDeactivationInfobox(boolean oldVersion) {
InfoBoxCollection collection = new InfoBoxCollection();
collection.setDeInfoBox(createDeactivationInfobox(Language.DE, oldVersion));
collection.setEnInfoBox(createDeactivationInfobox(Language.EN, oldVersion));
collection.setFrInfoBox(createDeactivationInfobox(Language.FR, oldVersion));
collection.setItInfoBox(createDeactivationInfobox(Language.IT, oldVersion));
collection.setPtInfoBox(createDeactivationInfobox(Language.PT, oldVersion));
collection.setEsInfoBox(createDeactivationInfobox(Language.ES, oldVersion));
collection.setSqInfoBox(createDeactivationInfobox(Language.SQ, oldVersion));
collection.setHrInfoBox(createDeactivationInfobox(Language.HR, oldVersion));
collection.setBsInfoBox(createDeactivationInfobox(Language.BS, oldVersion));
collection.setRmInfoBox(createDeactivationInfobox(Language.RM, oldVersion));
collection.setSrInfoBox(createDeactivationInfobox(Language.SR, oldVersion));
collection.setTiInfoBox(createDeactivationInfobox(Language.TI, oldVersion));
collection.setTrInfoBox(createDeactivationInfobox(Language.TR, oldVersion));
return collection;
}


private ConfigResponse generalUpdateRelease(boolean isIos) {
ConfigResponse configResponse = new ConfigResponse();
String appstoreUrl =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ public class ConfigResponse {
"feature flag. when set to true the vaccination infos should be displayed")
private Boolean showVaccinationInfo;

@Documentation(
description = "Flag to deactivate the app, stopping contact tracing and showing a message to the user"
)
private Boolean deactivate;

@Documentation(description = "Holds a message translated in different languages")
private InfoBoxCollection deactivationMessage = null;

public boolean isForceUpdate() {
return forceUpdate;
}
Expand Down Expand Up @@ -162,4 +170,21 @@ public Boolean getShowVaccinationInfo() {
public void setShowVaccinationInfo(Boolean showVaccinationInfo) {
this.showVaccinationInfo = showVaccinationInfo;
}

public Boolean getDeactivate() {
return deactivate;
}

public void setDeactivate(Boolean deactivate) {
this.deactivate = deactivate;
}

public InfoBoxCollection getDeactivationMessage() {
return deactivationMessage;
}

public void setDeactivationMessage(
InfoBoxCollection deactivationMessage) {
this.deactivationMessage = deactivationMessage;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ server.port=8080
management.endpoints.enabled-by-default=false
vcap.services.ecdsa_cs_dev.credentials.privateKey=LS0tLS1CRUdJTiBQUklWQVRFIEtFWS0tLS0tCk1JR0VBZ0VBTUJBR0J5cUdTTTQ5QWdFR0JTdUJCQUFLQkcwd2F3SUJBUVFnMkRsai9lNW5rRlBtTk1MVjd1NjQKenFuOHdSeVgrUTgyc045RDRSWXlvNjJoUkFOQ0FBVGFzRmgwR0tlazVZNEp1d2dpNUg4QWsvcWZqa0pDd3o3UApYb0lVZWJnaXN5N1RWUUxySW1CUFU3aWcwMzdrMGRvVXhrK1hkQktYNDN2L3JkR1lVS2YxCi0tLS0tRU5EIFBSSVZBVEUgS0VZLS0tLS0K
vcap.services.ecdsa_cs_dev.credentials.publicKey=LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUNTRENDQWU2Z0F3SUJBZ0lVS3pEQlJIZlZVN2djRGZxUTBGUDFLTkJULzVJd0NnWUlLb1pJemowRUF3SXcKZXpFTE1Ba0dBMVVFQmhNQ1EwZ3hEVEFMQmdOVkJBZ01CRUpsY200eERUQUxCZ05WQkFjTUJFSmxjbTR4RERBSwpCZ05WQkFvTUEwSkpWREVNTUFvR0ExVUVDd3dEUlZkS01RMHdDd1lEVlFRRERBUlVaWE4wTVNNd0lRWUpLb1pJCmh2Y05BUWtCRmhSemRYQndiM0owUUdKcGRDNWhaRzFwYmk1amFEQWVGdzB5TURBME1qZ3hNakUwTlRGYUZ3MHkKTVRBME1qZ3hNakUwTlRGYU1Ic3hDekFKQmdOVkJBWVRBa05JTVEwd0N3WURWUVFJREFSQ1pYSnVNUTB3Q3dZRApWUVFIREFSQ1pYSnVNUXd3Q2dZRFZRUUtEQU5DU1ZReEREQUtCZ05WQkFzTUEwVlhTakVOTUFzR0ExVUVBd3dFClZHVnpkREVqTUNFR0NTcUdTSWIzRFFFSkFSWVVjM1Z3Y0c5eWRFQmlhWFF1WVdSdGFXNHVZMmd3VmpBUUJnY3EKaGtqT1BRSUJCZ1VyZ1FRQUNnTkNBQVRhc0ZoMEdLZWs1WTRKdXdnaTVIOEFrL3FmamtKQ3d6N1BYb0lVZWJnaQpzeTdUVlFMckltQlBVN2lnMDM3azBkb1V4aytYZEJLWDQzdi9yZEdZVUtmMW8xTXdVVEFkQmdOVkhRNEVGZ1FVCnVTS2lWSUdsRnpQdDdXd3Z1VGNicDNrckQ0UXdId1lEVlIwakJCZ3dGb0FVdVNLaVZJR2xGelB0N1d3dnVUY2IKcDNrckQ0UXdEd1lEVlIwVEFRSC9CQVV3QXdFQi96QUtCZ2dxaGtqT1BRUURBZ05JQURCRkFpQkRteEJUQ3BZawphN0hFeUFEWnN4d3p3b2h0TjBwNTd5QllMYjZzQ3B3ODhBSWhBSXpTUDdCV0tGWmNDSmI5ZmhwcjZaTXpJd0tlCkhhSWpIK2E4elV2Nk1PaW8KLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo=
ws.deactivate-app=true
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ bs:
inform_code_intro_text: Iako se lični podaci koji se odnose na vas ne šalju, možda se neko seća svog kontakta sa vama na osnovu datuma.
inform_code_intro_button: Saglasan
symptom_faq1_title: Koji su simptomi COVID-19?
symptom_faq1_text: Ovi simptomi se često javljaju:\n\n– temperatura, osećaj groznice\n– bolovi u grlu\n– kašalj (najčešće suv)\n– kratak dah\n– bolovi u grudima\n– iznenadni gubitak čula mirisa i/ili ukusa\n\nOsim toga, mogući su sledeći simptomi:\n\n– glavobolja\n– opšta slabost, malaksalost\n– bolovi u mišićima\n– kijavica\n– simptomi gastrointestinalnog trakta (mučnina, povraćanje, proliv, bolovi u stomaku)\n– osipi na koži
symptom_faq1_text: Novi virus korone često može pokazati različite simptome bolesti. Najčešći simptomi su:\n\n– bol u grlu\n– kašalj (uglavnom suv)\n– kratak dah\n– bol u grudima\n– temperatura\n– iznenadni gubitak čula mirisa i/ili ukusa\n– glavobolja\n– opšta slabost, malaksalost\n– bolovi u mišićima\n– kijavica\n– simptomi gastrointestinalnog trakta (mučnina, povraćanje, proliv, bolovi u stomaku)\n– osipi na koži\n\nImajte na umu sledeće: Simptomi bolesti su različite jačine i mogu varati u zavisnost od varijante virusa. Mogu biti i blagi. I samo kijavica može značiti da ste zaraženi.
meldungen_positive_tested_faq1_title: Zbog čega je praćenje deaktivirano?
meldungen_positive_tested_faq1_text: Posle pozitivnog testa praćenje se automatski deaktivira u aplikaciji. Praćenje može ponovo da se aktivira čim izađete iz izolacije.
language_key: bs
Expand Down Expand Up @@ -618,9 +618,9 @@ bs:
checkin_report_title1: Zaštititi kontakte
checkin_report_title2: Obratiti pažnju na simptome
checkin_report_title3: Vršiti testiranje
checkin_report_subtitle1: Mogli biste biti zarazni, a da to ne primetite. Pridržavajte se važećih higijenskih i zaštitnih mera i zaštitite svoju porodicu, prijatelje i okolinu.
checkin_report_subtitle1: Mogli ste da se zarazite, a da ne primetite. Obratite pažnju na sledeće mere opreza:\n\n- nositi masku do 7 dana posle kontakta)\n\n- ograničiti kontakte\n\n- držati razmak (najmanje 1,5 metar)\n\n- izbegavati javne zatvorene prostore
checkin_report_subtitle2: Proveravajte svoje zdravsveno stanje.
checkin_report_subtitle3: Odmah se testirajte ako imate simptome. Čak i ako nema simptoma i niste u potpunosti vakcinisani, test korone je važan i preporučuje se.
checkin_report_subtitle3: U slučaju pojave <b>simptoma odmah se testirati</b> – i ako ste vakcinisati (uključ. dopunske vakcine) ili ste preležali koronu. Čak i ako imate samo blage simptome, testiranje je korisno i preporučljivo.<br/><br/><b>Testirajte se</b>, i ako <b>nemate simptome</b>. Možete biti zaraženi i kada nemate simptome. Test u tom slučaju treba uraditi nekoliko dana (4–7) posle rizičnog kontakta. U tom vremenu se najčešće može otkriti zaraza.
meldung_detail_checkin_title: Prijava
not_thank_you_screen_title: Podaci nisu poslati
not_thank_you_screen_text1: Nisu poslati privatni ključevi.
Expand Down Expand Up @@ -723,3 +723,9 @@ bs:
vaccination_impf_check_action: Na proveru vakcinisanja
vaccination_impf_check_url: https://covid19.impf-check.ch/
vaccination_impf_check_title: Zakažite sada termin
termination_header: Informacije
termination_title: Rad aplikacije SvissCovid je obustavljen
termination_text: Hvala vam što ste preuzeli aplikaciju SwissCovid.\n\nKorišćenjem aplikacije SwissCovid dali ste relevantan doprinos u borbi protiv pandemije. Više od 200.000 ljudi bilo je u mogućnosti da brzo informiše druge o riziku od infekcije i tako prekine lance infekcije.\n\nUkidanjem saveznih mera obustavljen je i rad aplikacije SwissCovid. Aplikacija je sada neaktivna i trebalo bi da je deinstalirate. Ukoliko bi reaktivacija bila neophodna zbog epidemiološke situacije, ponovo se radujemo vašoj podršci.
termination_text_infobox: Hvala vam što ste preuzeli aplikaciju SwissCovid.\n\nKorišćenjem aplikacije SwissCovid dali ste relevantan doprinos u borbi protiv pandemije. Više od 200.000 ljudi bilo je u mogućnosti da brzo informiše druge o riziku od infekcije i tako prekine lance infekcije.\n\nUkidanjem saveznih mera obustavljen je i rad aplikacije SwissCovid. Aplikacija je sada neaktivna i trebalo bi da je deinstalirate. Ukoliko bi reaktivacija bila neophodna zbog epidemiološke situacije, ponovo se radujemo vašoj podršci.
termination_link_title: Dalje informacije
termination_url: https://www.bag.admin.ch/bag/de/home/krankheiten/ausbrueche-epidemien-pandemien/aktuelle-ausbrueche-epidemien/novel-cov/swisscovid-app-und-contact-tracing.html
Loading

0 comments on commit 728953d

Please sign in to comment.