Skip to content

Commit

Permalink
Merge pull request #231 from DP-3T/hotfix/version-1.1.2
Browse files Browse the repository at this point in the history
Hotfix/version 1.1.2
  • Loading branch information
simonroesch committed Oct 19, 2020
2 parents 1cc2f7c + 6eef5ff commit 5d8fc53
Show file tree
Hide file tree
Showing 22 changed files with 553 additions and 128 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/appcenter_abnahme.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ name: Android Build
on:
push:
branches: [ master, develop ]
pull_request:
branches: [ master ]

jobs:
build:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/appcenter_dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ name: Android Build
on:
push:
branches: [ master, develop ]
pull_request:
branches: [ master ]

jobs:
build:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/appcenter_prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ name: Android Build AppCenter Prod
on:
push:
branches: [ master, develop ]
pull_request:
branches: [ master ]

jobs:
build:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/appcenter_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ name: Android Build
on:
push:
branches: [ master, develop ]
pull_request:
branches: [ master ]

jobs:
build:
Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ android {
applicationId "ch.admin.bag.dp3t"
minSdkVersion 23
targetSdkVersion 30
versionCode 11000
versionName "1.1.0"
versionCode 11200
versionName "1.1.2"
resConfigs "en", "fr", "de", "it", "pt", "es", "sq", "bs", "hr", "sr", "rm", "tr", "ti"

buildConfigField "long", "BUILD_TIME", readPropertyWithDefault('buildTimestamp', System.currentTimeMillis()) + 'L'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/
package ch.admin.bag.dp3t.debug;

import ch.admin.bag.dp3t.main.model.DefaultTracingStatusWrapper;
import ch.admin.bag.dp3t.home.model.DefaultTracingStatusWrapper;

public class TracingStatusWrapper extends DefaultTracingStatusWrapper {
// default implementation
Expand Down
1 change: 1 addition & 0 deletions app/src/main/java/ch/admin/bag/dp3t/MainApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ private static void createNewContactNotification(Context context, int contactId)
.setPriority(NotificationCompat.PRIORITY_MAX)
.setSmallIcon(R.drawable.ic_begegnungen)
.setContentIntent(pendingIntent)
.setOngoing(true)
.setAutoCancel(true)
.build();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
*
* SPDX-License-Identifier: MPL-2.0
*/

package ch.admin.bag.dp3t.contacts;

import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.Toolbar;
Expand All @@ -20,7 +20,11 @@
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import java.text.SimpleDateFormat;
import java.util.Locale;

import ch.admin.bag.dp3t.R;
import ch.admin.bag.dp3t.storage.SecureStorage;
import ch.admin.bag.dp3t.viewmodel.TracingViewModel;

public class HistoryFragment extends Fragment {
Expand Down Expand Up @@ -51,6 +55,11 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat
toolbar.setNavigationOnClickListener(v -> getParentFragmentManager().popBackStack());

setupRecyclerView(view);

SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss", Locale.GERMAN);
TextView nextFakeRequestView = view.findViewById(R.id.history_next_fake_request);
nextFakeRequestView.setText(getString(R.string.synchronizations_view_next_fake_request) +
sdf.format(SecureStorage.getInstance(view.getContext()).getTDummy()));
}

private void setupRecyclerView(View view) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ private static void loadConfig(Context context) throws IOException, ResponseErro
SecureStorage secureStorage = SecureStorage.getInstance(context);
secureStorage.setDoForceUpdate(config.getDoForceUpdate());

secureStorage.setWhatToDoPositiveTestTexts(config.getWhatToDoPositiveTestTexts());

InfoBoxModel info = config.getInfoBox(context.getString(R.string.language_key));
if (info != null) {
if (info.getInfoId() == null || !info.getInfoId().equals(secureStorage.getInfoboxId())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public class ConfigResponseModel {

private boolean forceUpdate;
private InfoBoxModelCollection infoBox;
private WhatToDoPositiveTestTextsCollection whatToDoPositiveTestTexts;
private SdkConfigModel androidGaenSdkConfig;

public boolean getDoForceUpdate() {
Expand All @@ -32,4 +33,8 @@ public SdkConfigModel getSdkConfig() {
return androidGaenSdkConfig;
}

public WhatToDoPositiveTestTextsCollection getWhatToDoPositiveTestTexts() {
return whatToDoPositiveTestTexts;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Copyright (c) 2020 Ubique Innovation AG <https://www.ubique.ch>
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*
* SPDX-License-Identifier: MPL-2.0
*/
package ch.admin.bag.dp3t.networking.models;

public class FaqEntryModel {

private String title;
private String text;
private String iconAndroid;

/* optional */
private String linkTitle;
private String linkUrl;

public String getTitle() {
return title;
}

public String getText() {
return text;
}

public String getIconAndroid() {
return iconAndroid;
}

public String getLinkTitle() {
return linkTitle;
}

public String getLinkUrl() {
return linkUrl;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Copyright (c) 2020 Ubique Innovation AG <https://www.ubique.ch>
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*
* SPDX-License-Identifier: MPL-2.0
*/
package ch.admin.bag.dp3t.networking.models;

import java.util.HashMap;

public class WhatToDoPositiveTestTextsCollection extends HashMap<String, WhatToDoPositiveTestTextsModel> {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* Copyright (c) 2020 Ubique Innovation AG <https://www.ubique.ch>
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*
* SPDX-License-Identifier: MPL-2.0
*/
package ch.admin.bag.dp3t.networking.models;

import java.util.List;

public class WhatToDoPositiveTestTextsModel {

private String enterCovidcodeBoxSupertitle;
private String enterCovidcodeBoxTitle;
private String enterCovidcodeBoxText;
private String enterCovidcodeBoxButtonTitle;

//dismissible will be ignored by clients
private InfoBoxModel infoBox;

private List<FaqEntryModel> faqEntries;

public String getEnterCovidcodeBoxSupertitle() {
return enterCovidcodeBoxSupertitle;
}

public String getEnterCovidcodeBoxTitle() {
return enterCovidcodeBoxTitle;
}

public String getEnterCovidcodeBoxText() {
return enterCovidcodeBoxText;
}

public String getEnterCovidcodeBoxButtonTitle() {
return enterCovidcodeBoxButtonTitle;
}

public InfoBoxModel getInfoBox() {
return infoBox;
}

public List<FaqEntryModel> getFaqEntries() {
return faqEntries;
}

}
11 changes: 9 additions & 2 deletions app/src/main/java/ch/admin/bag/dp3t/stats/DiagramYAxisView.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public class DiagramYAxisView extends View {
private float dp;

private int maxYValue;
private float paddingTopDp;

private Paint labelPaint;
Rect textRect = new Rect();
Expand All @@ -55,7 +56,9 @@ public DiagramYAxisView(Context context, @Nullable AttributeSet attrs, int defSt
private void init(Context context) {
dp = context.getResources().getDisplayMetrics().density;

int labelPaintColor = getResources().getColor(R.color.stats_diagram_labels, null);
paddingTopDp = context.getResources().getDimension(R.dimen.stats_diagram_padding_top);

int labelPaintColor = context.getResources().getColor(R.color.stats_diagram_labels, null);
float labelTextSize = context.getResources().getDimension(R.dimen.text_size_small);
Typeface labelTypeface = ResourcesCompat.getFont(context, R.font.inter_regular);
labelPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
Expand Down Expand Up @@ -89,12 +92,16 @@ protected void onDraw(Canvas canvas) {

private void drawYAxisLabels(Canvas canvas) {
float xAxisYCoord = getHeight() - DiagramView.OFFSET_BOTTOM_X_AXIS * dp;
float diagramHeight = xAxisYCoord - paddingTopDp;

for (int yLabel : getYAxisLabelValues(maxYValue)) {
String label = Integer.toString(yLabel);

// Note that the origin of the text is the BOTTOM LEFT coordinate (not the top left)!!!
labelPaint.getTextBounds(label, 0, label.length(), textRect);
float bottom = xAxisYCoord + textRect.height() / 2F - xAxisYCoord * (yLabel / (float) maxYValue);
float bottom = xAxisYCoord // baseline
+ textRect.height() / 2F // center text vertically
- (yLabel / (float) maxYValue) * diagramHeight; // move back up according to the y-label value

canvas.drawText(label, PADDING_Y_AXIS_LEFT * dp, bottom, labelPaint);
}
Expand Down
23 changes: 23 additions & 0 deletions app/src/main/java/ch/admin/bag/dp3t/storage/SecureStorage.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@

import java.io.IOException;
import java.security.GeneralSecurityException;
import java.util.HashMap;

import com.google.gson.Gson;

import ch.admin.bag.dp3t.networking.models.WhatToDoPositiveTestTextsCollection;
import ch.admin.bag.dp3t.networking.models.WhatToDoPositiveTestTextsModel;

public class SecureStorage {

Expand Down Expand Up @@ -46,11 +52,14 @@ public class SecureStorage {
private static final String KEY_LAST_CONFIG_LOAD_SUCCESS_APP_VERSION = "last_config_load_success_app_version";
private static final String KEY_LAST_CONFIG_LOAD_SUCCESS_SDK_INT = "last_config_load_success_sdk_int";
private static final String KEY_T_DUMMY = "KEY_T_DUMMY";
private static final String KEY_WHAT_TO_DO_POSITIVE_TEST_TEXTS = "whatToDoPositiveTestTexts";

private static SecureStorage instance;

private SharedPreferences prefs;

private Gson gson = new Gson();

private final MutableLiveData<Boolean> forceUpdateLiveData;
private final MutableLiveData<Boolean> hasInfoboxLiveData;

Expand Down Expand Up @@ -265,4 +274,18 @@ public void setTDummy(long time) {
prefs.edit().putLong(KEY_T_DUMMY, time).apply();
}

public void setWhatToDoPositiveTestTexts(WhatToDoPositiveTestTextsCollection whatToDoPositiveTestTexts) {
prefs.edit().putString(KEY_WHAT_TO_DO_POSITIVE_TEST_TEXTS, gson.toJson(whatToDoPositiveTestTexts)).apply();
}

public WhatToDoPositiveTestTextsModel getWhatToDoPositiveTestTexts(String language) {
HashMap<String, WhatToDoPositiveTestTextsModel> map =
gson.fromJson(prefs.getString(KEY_WHAT_TO_DO_POSITIVE_TEST_TEXTS, "null"),
WhatToDoPositiveTestTextsCollection.class);
if (map == null) {
return null;
}
return map.get(language);
}

}
Loading

0 comments on commit 5d8fc53

Please sign in to comment.