Skip to content
This repository has been archived by the owner on Jun 20, 2023. It is now read-only.

Commit

Permalink
Merge pull request #248 from corona-warn-app/dev
Browse files Browse the repository at this point in the history
0.8.6
  • Loading branch information
htooisap authored Jun 7, 2020
2 parents 73c97f9 + 8dd2299 commit 1aaa718
Show file tree
Hide file tree
Showing 111 changed files with 4,547 additions and 545 deletions.
12 changes: 11 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
version: 2.1
orbs:
android: circleci/[email protected]
sonarcloud: sonarsource/[email protected]
commands:
install-ndk: android/install-ndk
restore-build-cache: android/restore-build-cache
save-build-cache: android/save-build-cache
scan-sonar: sonarcloud/scan
jobs:
quickBuildReleaseWithTestsAndChecks:
executor: android/android
Expand All @@ -22,6 +24,13 @@ jobs:
environment:
JVM_OPTS: -Xmx2048m
GRADLE_OPTS: -Xmx1536m -XX:+HeapDumpOnOutOfMemoryError -Dorg.gradle.caching=true -Dorg.gradle.configureondemand=true -Dkotlin.compiler.execution.strategy=in-process -Dkotlin.incremental=false
- run:
name: JaCoCo report
command: ./gradlew :Corona-Warn-App:jacocoTestReportDeviceRelease
environment:
JVM_OPTS: -Xmx2048m
GRADLE_OPTS: -Xmx1536m -XX:+HeapDumpOnOutOfMemoryError -Dorg.gradle.caching=true -Dorg.gradle.configureondemand=true -Dkotlin.compiler.execution.strategy=in-process -Dkotlin.incremental=false
- scan-sonar
- save-build-cache
- save_cache:
paths:
Expand All @@ -36,4 +45,5 @@ workflows:
version: 2
workflow:
jobs:
- quickBuildReleaseWithTestsAndChecks
- quickBuildReleaseWithTestsAndChecks:
context: SonarCloud
2 changes: 2 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ Before submitting, please take the time to check the points below and provide so
* [ ] [Link your Pull Request to an issue](https://help.github.com/en/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue) (if applicable)
* [ ] Create Work In Progress [WIP] pull requests only if you need clarification or an explicit review before you can continue your work item.
* [ ] Make sure that your PR is not introducing _unnecessary_ reformatting (e.g., introduced by on-save hooks in your IDE)
* [ ] Make sure that your PR does not contain changes in strings.xml (see issue #72)
* [ ] Make sure that your PR does not contain compiled sources (already set by the default .gitignore) and / or binary files

## Description
<!-- Please be brief in describing which issue is solved by your PR or which enhancement it brings -->
2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ The following rule governs documentation contributions:

* Commits should be as small as possible while ensuring that each commit is correct independently (i.e., each commit should compile and pass tests).

* Pull requests must not contain compiled sources (already set by the default .gitignore) or binary files

* Test your changes as thoroughly as possible before you commit them. Preferably, automate your test by unit/integration tests. If tested manually, provide information about the test scope in the PR description (e.g. “Test passed: Upgrade version from 0.42 to 0.42.23.”).

* Create _Work In Progress [WIP]_ pull requests only if you need clarification or an explicit review before you can continue your work item.
Expand Down
20 changes: 9 additions & 11 deletions Corona-Warn-App/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: "androidx.navigation.safeargs.kotlin"
apply plugin: 'jacoco'

android {
ndkVersion "21.2.6472646"
Expand All @@ -33,8 +32,8 @@ android {
applicationId 'de.rki.coronawarnapp'
minSdkVersion 23
targetSdkVersion 29
versionCode 12
versionName "0.8.5"
versionCode 13
versionName "0.8.6"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

buildConfigField "String", "DOWNLOAD_CDN_URL", "\"$DOWNLOAD_CDN_URL\""
Expand Down Expand Up @@ -62,7 +61,12 @@ android {
def VERIFICATION_CDN_URL = properties.getProperty('VERIFICATION_CDN_URL')
if (VERIFICATION_CDN_URL)
buildConfigField "String", "VERIFICATION_CDN_URL", "\"$VERIFICATION_CDN_URL\""
}

javaCompileOptions {
annotationProcessorOptions {
arguments += ["room.schemaLocation": "$projectDir/schemas".toString()]
}
}
}

Expand All @@ -78,6 +82,7 @@ android {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
testCoverageEnabled true
buildConfigField "String", "EXPORT_SIGNATURE_ID", "\"de.rki.coronawarnapp-dev\""
}
}
Expand Down Expand Up @@ -141,13 +146,6 @@ android {

}

task jacocoTestReport(type: JacocoReport, dependsOn: ['testDeviceReleaseUnitTest']) {
reports {
xml.enabled = true
html.enabled = true
}
}

dependencies {
// KOTLIN
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.7"
Expand Down Expand Up @@ -209,7 +207,7 @@ dependencies {
implementation "androidx.room:room-ktx:$room_version"
implementation "androidx.room:room-guava:$room_version"
kapt "androidx.room:room-compiler:$room_version"
implementation "androidx.sqlite:sqlite:2.0.1"
implementation "androidx.sqlite:sqlite:2.1.0"

// UTILS
implementation project(":Server-Protocol-Buffer")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
{
"formatVersion": 1,
"database": {
"version": 1,
"identityHash": "fc62bfe144d17a099180c8023c340138",
"entities": [
{
"tableName": "exposure_summary",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `daysSinceLastExposure` INTEGER NOT NULL, `matchedKeyCount` INTEGER NOT NULL, `maximumRiskScore` INTEGER NOT NULL, `summationRiskScore` INTEGER NOT NULL, `attenuationDurationsInMinutes` TEXT NOT NULL)",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "daysSinceLastExposure",
"columnName": "daysSinceLastExposure",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "matchedKeyCount",
"columnName": "matchedKeyCount",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "maximumRiskScore",
"columnName": "maximumRiskScore",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "summationRiskScore",
"columnName": "summationRiskScore",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "attenuationDurationsInMinutes",
"columnName": "attenuationDurationsInMinutes",
"affinity": "TEXT",
"notNull": true
}
],
"primaryKey": {
"columnNames": [
"id"
],
"autoGenerate": true
},
"indices": [
{
"name": "index_exposure_summary_id",
"unique": false,
"columnNames": [
"id"
],
"createSql": "CREATE INDEX IF NOT EXISTS `index_exposure_summary_id` ON `${TABLE_NAME}` (`id`)"
}
],
"foreignKeys": []
},
{
"tableName": "date",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `path` TEXT NOT NULL, `type` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "path",
"columnName": "path",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "type",
"columnName": "type",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"columnNames": [
"id"
],
"autoGenerate": false
},
"indices": [
{
"name": "index_date_id",
"unique": false,
"columnNames": [
"id"
],
"createSql": "CREATE INDEX IF NOT EXISTS `index_date_id` ON `${TABLE_NAME}` (`id`)"
}
],
"foreignKeys": []
},
{
"tableName": "tracing_interval",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`from` INTEGER NOT NULL, `to` INTEGER NOT NULL, PRIMARY KEY(`from`, `to`))",
"fields": [
{
"fieldPath": "from",
"columnName": "from",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "to",
"columnName": "to",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"columnNames": [
"from",
"to"
],
"autoGenerate": false
},
"indices": [
{
"name": "index_tracing_interval_from_to",
"unique": false,
"columnNames": [
"from",
"to"
],
"createSql": "CREATE INDEX IF NOT EXISTS `index_tracing_interval_from_to` ON `${TABLE_NAME}` (`from`, `to`)"
}
],
"foreignKeys": []
}
],
"views": [],
"setupQueries": [
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'fc62bfe144d17a099180c8023c340138')"
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@
package de.rki.coronawarnapp.util.security

import android.content.Context
import android.database.sqlite.SQLiteDatabase
import androidx.test.core.app.ApplicationProvider
import de.rki.coronawarnapp.storage.AppDatabase
import de.rki.coronawarnapp.storage.DATABASE_NAME
import de.rki.coronawarnapp.storage.keycache.KeyCacheEntity
import kotlinx.coroutines.runBlocking
import net.sqlcipher.database.SQLiteException
Expand All @@ -35,7 +33,6 @@ import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.JUnit4
import java.io.File
import java.util.UUID
import kotlin.random.Random

Expand Down
13 changes: 0 additions & 13 deletions Corona-Warn-App/src/main/assets/pins.properties

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import androidx.lifecycle.LifecycleObserver
import androidx.lifecycle.OnLifecycleEvent
import androidx.lifecycle.ProcessLifecycleOwner
import androidx.localbroadcastmanager.content.LocalBroadcastManager
import de.rki.coronawarnapp.exception.ErrorReportReceiver
import de.rki.coronawarnapp.exception.ReportingConstants.ERROR_REPORT_LOCAL_BROADCAST_CHANNEL
import de.rki.coronawarnapp.exception.reporting.ErrorReportReceiver
import de.rki.coronawarnapp.exception.reporting.ReportingConstants.ERROR_REPORT_LOCAL_BROADCAST_CHANNEL
import de.rki.coronawarnapp.notification.NotificationHelper
import org.conscrypt.Conscrypt
import java.security.Security
Expand Down Expand Up @@ -101,7 +101,8 @@ class CoronaWarnApplication : Application(), LifecycleObserver,
}

override fun onActivityResumed(activity: Activity) {
errorReceiver = ErrorReportReceiver(activity)
errorReceiver =
ErrorReportReceiver(activity)
LocalBroadcastManager.getInstance(this)
.registerReceiver(errorReceiver, IntentFilter(ERROR_REPORT_LOCAL_BROADCAST_CHANNEL))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import de.rki.coronawarnapp.databinding.FragmentTestForAPIBinding
import de.rki.coronawarnapp.exception.ExceptionCategory
import de.rki.coronawarnapp.exception.ExceptionCategory.INTERNAL
import de.rki.coronawarnapp.exception.TransactionException
import de.rki.coronawarnapp.exception.report
import de.rki.coronawarnapp.exception.reporting.report
import de.rki.coronawarnapp.nearby.InternalExposureNotificationClient
import de.rki.coronawarnapp.nearby.InternalExposureNotificationPermissionHelper
import de.rki.coronawarnapp.receiver.ExposureStateUpdateReceiver
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import com.google.zxing.integration.android.IntentResult
import de.rki.coronawarnapp.databinding.FragmentTestRiskLevelCalculationBinding
import de.rki.coronawarnapp.exception.ExceptionCategory
import de.rki.coronawarnapp.exception.TransactionException
import de.rki.coronawarnapp.exception.report
import de.rki.coronawarnapp.exception.reporting.report
import de.rki.coronawarnapp.nearby.InternalExposureNotificationClient
import de.rki.coronawarnapp.risk.RiskLevel
import de.rki.coronawarnapp.risk.TimeVariables
Expand Down Expand Up @@ -258,7 +258,9 @@ class TestRiskLevelCalculation : Fragment() {
"Tracing Duration: " +
"${TimeUnit.MILLISECONDS.toDays(TimeVariables.getTimeActiveTracingDuration())} days \n" +
"Tracing Duration in last 14 days: " +
"${TimeVariables.getActiveTracingDaysInRetentionPeriod()} days"
"${TimeVariables.getActiveTracingDaysInRetentionPeriod()} days \n" +
"Last time risk level calculation ${LocalData.lastTimeRiskLevelCalculation()}"

binding.labelRiskScore.text = riskAsString

val lowClass =
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package de.rki.coronawarnapp.exception

import okio.IOException

class CwaWebSecurityException(cause: Throwable) : IOException(
"an error occurred while trying to establish a secure connection to the server",
cause
)
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.rki.coronawarnapp.exception
package de.rki.coronawarnapp.exception.reporting

import android.app.Activity
import android.content.BroadcastReceiver
Expand All @@ -7,6 +7,7 @@ import android.content.Intent
import android.util.Log
import de.rki.coronawarnapp.CoronaWarnApplication
import de.rki.coronawarnapp.R
import de.rki.coronawarnapp.exception.ExceptionCategory
import de.rki.coronawarnapp.util.DialogHelper

class ErrorReportReceiver(private val activity: Activity) : BroadcastReceiver() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package de.rki.coronawarnapp.exception
package de.rki.coronawarnapp.exception.reporting

import android.content.Intent
import androidx.localbroadcastmanager.content.LocalBroadcastManager
import de.rki.coronawarnapp.CoronaWarnApplication
import de.rki.coronawarnapp.exception.ExceptionCategory
import java.io.PrintWriter
import java.io.StringWriter

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.rki.coronawarnapp.exception
package de.rki.coronawarnapp.exception.reporting

object ReportingConstants {
const val ERROR_REPORT_LOCAL_BROADCAST_CHANNEL = "error-report"
Expand Down
Loading

0 comments on commit 1aaa718

Please sign in to comment.