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

Commit

Permalink
Merge tag 'v2.3.2' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
d4rken committed Jun 10, 2021
2 parents 9ec222a + 646f80f commit 4855156
Show file tree
Hide file tree
Showing 588 changed files with 17,433 additions and 3,458 deletions.
99 changes: 0 additions & 99 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,6 @@ commands:
- ~/.gradle
key: gradle-v1-{{ arch }}-{{ checksum "build.gradle" }}-{{ checksum "Corona-Warn-App/build.gradle" }}-{{ checksum "Server-Protocol-Buffer/build.gradle" }}

restore-android-build-cache-macos:
description: "Restore Android build caches on macOS"
steps:
- restore_cache:
key: android-buildcache-v1-{{ arch }}

save-android-build-cache-macos:
description: "Save Android build caches on macOS"
steps:
- save_cache:
paths:
- ~/.android/build-cache
- ~/.android/cache
key: android-buildcache-v1-{{ arch }}-{{ epoch }}

run-gradle-cmd:
description: "Running gradle command with environment options"
parameters:
Expand Down Expand Up @@ -104,90 +89,6 @@ commands:
circleci step halt
fi
setup-android-macos:
description: "Setup Android environment on macOS executor"
steps:
- restore_cache:
key: android-sdk-v1-{{ arch }}-{{ checksum ".circleci/install-android-sdk.sh" }}
- run:
name: Set ANDROID_SDK_ROOT environment variable
command: echo 'export ANDROID_SDK_ROOT=$HOME/android-sdk' >> $BASH_ENV
- run:
name: Install Android SDK
command: |
sh .circleci/install-android-sdk.sh
echo 'export PATH=$ANDROID_SDK_ROOT/cmdline-tools/latest/bin:$PATH' >> $BASH_ENV
echo 'export PATH=$ANDROID_SDK_ROOT/cmdline-tools/latest:$PATH' >> $BASH_ENV
echo 'export PATH=$ANDROID_SDK_ROOT/platform-tools:$PATH' >> $BASH_ENV
echo 'export PATH=$ANDROID_SDK_ROOT/emulator:$PATH' >> $BASH_ENV
echo 'export PATH=$ANDROID_SDK_ROOT/build-tools/29.0.3:$PATH' >> $BASH_ENV
source $BASH_ENV
sdkmanager --list
- save_cache:
key: android-sdk-v1-{{ arch }}-{{ checksum ".circleci/install-android-sdk.sh" }}
paths:
- /Users/distiller/android-sdk

run-emulator-for-api:
parameters:
apilevel:
type: integer
description: "Setup and start emulator for API<< parameters.apilevel >>"
steps:
- run:
name: Create emulator AVD
command: >
echo "no" | avdmanager --verbose create avd --force
--name "emulator_API<< parameters.apilevel >>"
--package "system-images;android-<< parameters.apilevel >>;google_apis;x86_64"
- run:
name: Configure emulator settings
command: |
cd $HOME/.android/avd/emulator_API<< parameters.apilevel >>.avd
sed -i '' -e 's/hw.lcd.density=[0-9]*/hw.lcd.density=560/g' config.ini
sed -i '' -e 's/hw.lcd.height=[0-9]*/hw.lcd.height=2880/g' config.ini
sed -i '' -e 's/hw.lcd.width=[0-9]*/hw.lcd.width=1440/g' config.ini
sed -i '' -e 's/hw.ramSize=[0-9]*/hw.ramSize=1536/g' config.ini
- run:
name: Check host state
command: |
emulator -accel-check
emulator -version
- run:
name: Start emulator AVD
command: >
emulator @emulator_API<< parameters.apilevel >>
-no-window
-no-audio
-no-boot-anim
-memory 2048
-nojni
background: true
no_output_timeout: 60m
- run:
name: Wait for emulator
command: |
adb wait-for-device shell 'while [[ -z $(getprop dev.bootcomplete) ]]; do sleep 1; done;'
adb devices
sleep 5
- run:
name: Disable animations
command: |
adb shell settings put global window_animation_scale 0
adb shell settings put global transition_animation_scale 0
adb shell settings put global animator_duration_scale 0
kill-all-emulators:
description: "Kill all emulators"
steps:
- run:
name: Kill all emulators
command: |
adb devices | grep emulator | cut -f1 | while read line; do adb -s $line emu kill; done
sleep 2
adb kill-server
sleep 2
compress-path:
parameters:
input:
Expand Down
29 changes: 0 additions & 29 deletions .circleci/install-android-sdk.sh

This file was deleted.

9 changes: 0 additions & 9 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .reuse/dep5
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,8 @@ License: Apache-2.0

Files: Corona-Warn-App/src/test/java/testhelpers/extensions/LiveDataTestUtil.kt
Copyright: 2019 The Android Open Source Project
License: Apache-2.0

Files: Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/encoding/Base45Decoder.kt
Copyright: Copyright 2021 A-SIT Plus GmbH
License: Apache-2.0
17 changes: 11 additions & 6 deletions Corona-Warn-App/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ def environmentExtractor = { File path ->
return "\"${escapedJson}\""
}

jacoco {
toolVersion = "0.8.7"
}

android {
println("Current VERSION_MAJOR: ${VERSION_MAJOR}")
Expand All @@ -20,8 +23,7 @@ android {
println("Current VERSION_BUILD: ${VERSION_BUILD}")

compileSdkVersion 29
buildToolsVersion "29.0.3"

buildToolsVersion "30.0.3"
defaultConfig {
applicationId 'de.rki.coronawarnapp'
minSdkVersion 23
Expand Down Expand Up @@ -128,7 +130,7 @@ android {
applicationIdSuffix '.test'

ext {
envTypeDefault = [debug: "INT", release: "WRU-XD"]
envTypeDefault = [debug: "INT", release: "WRU"]
}

if (signingPropFile.canRead()) {
Expand Down Expand Up @@ -306,7 +308,7 @@ dependencies {
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutineVersion"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-play-services:$coroutineVersion"
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutineVersion"
testImplementation "org.jetbrains.kotlin:kotlin-reflect:1.4.21"
testImplementation "org.jetbrains.kotlin:kotlin-reflect:1.5.0"
androidTestImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutineVersion"

// ANDROID STANDARD
Expand All @@ -332,7 +334,7 @@ dependencies {
implementation "androidx.recyclerview:recyclerview-selection:1.1.0"

// DAGGER
def dagger_version = "2.31.2"
def dagger_version = "2.35.1"
implementation "com.google.dagger:dagger:$dagger_version"
implementation "com.google.dagger:dagger-android:$dagger_version"
implementation "com.google.dagger:dagger-android-support:$dagger_version"
Expand All @@ -353,7 +355,7 @@ dependencies {

// Testing
testImplementation "androidx.arch.core:core-testing:2.1.0"
testImplementation('org.robolectric:robolectric:4.4') {
testImplementation('org.robolectric:robolectric:4.5.1') {
exclude group: 'com.google.protobuf'
}
testImplementation "io.mockk:mockk:1.10.4"
Expand Down Expand Up @@ -437,4 +439,7 @@ dependencies {

// ANIMATIONS
implementation "com.airbnb.android:lottie:3.5.0"

// HCert
implementation("com.upokecenter:cbor:4.4.1")
}
9 changes: 8 additions & 1 deletion Corona-Warn-App/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,11 @@

##---------------End: proguard configuration for Gson ----------

-keep class de.rki.coronawarnapp.server.protocols.internal.** { *; }
-keep class de.rki.coronawarnapp.server.protocols.internal.** { *; }

# Fixes R8 bug https://issuetracker.google.com/issues/170709331
# May be removed after newer R8 version is in use and the fix is confirmed
# Prevents the app from crashing on navigation due to animation resources not being found.
-keepclassmembers class **.R$* {
public static <fields>;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,24 @@ import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.matcher.ViewMatchers.withId
import androidx.test.espresso.matcher.ViewMatchers.withText
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel
import dagger.Module
import dagger.android.ContributesAndroidInjector
import de.rki.coronawarnapp.R
import de.rki.coronawarnapp.appconfig.AppConfigProvider
import de.rki.coronawarnapp.appconfig.ConfigData
import de.rki.coronawarnapp.appconfig.PresenceTracingConfig
import de.rki.coronawarnapp.presencetracing.checkins.qrcode.QrCodeGenerator
import de.rki.coronawarnapp.presencetracing.storage.repo.TraceLocationRepository
import de.rki.coronawarnapp.ui.presencetracing.organizer.details.QrCodeDetailFragment
import de.rki.coronawarnapp.ui.presencetracing.organizer.details.QrCodeDetailFragmentArgs
import de.rki.coronawarnapp.ui.presencetracing.organizer.details.QrCodeDetailViewModel
import io.mockk.MockKAnnotations
import io.mockk.coEvery
import io.mockk.every
import io.mockk.impl.annotations.MockK
import io.mockk.mockk
import kotlinx.coroutines.flow.flowOf
import org.joda.time.DateTimeZone
import org.junit.After
import org.junit.Before
Expand All @@ -30,6 +37,7 @@ import java.util.TimeZone
class QrCodeDetailFragmentTest : BaseUITest() {

@MockK private lateinit var qrCodeGenerator: QrCodeGenerator
@MockK private lateinit var appConfigProvider: AppConfigProvider
@MockK private lateinit var traceLocationRepository: TraceLocationRepository

private val timeZone = TimeZone.getTimeZone("Europe/Berlin")
Expand All @@ -42,6 +50,13 @@ class QrCodeDetailFragmentTest : BaseUITest() {

coEvery { traceLocationRepository.traceLocationForId(1) } returns TraceLocationData.traceLocationSameDate
coEvery { traceLocationRepository.traceLocationForId(2) } returns TraceLocationData.traceLocationDifferentDate
coEvery { appConfigProvider.currentConfig } returns flowOf(
mockk<ConfigData>().apply {
every { presenceTracing } returns mockk<PresenceTracingConfig>().apply {
every { qrCodeErrorCorrectionLevel } returns ErrorCorrectionLevel.M
}
}
)

setupMockViewModel(
object : QrCodeDetailViewModel.Factory {
Expand Down Expand Up @@ -87,7 +102,8 @@ class QrCodeDetailFragmentTest : BaseUITest() {
traceLocationId = traceLocationId,
qrCodeGenerator = qrCodeGenerator,
traceLocationRepository = traceLocationRepository,
dispatcher = TestDispatcherProvider()
dispatcher = TestDispatcherProvider(),
appConfigProvider = appConfigProvider
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ import de.rki.coronawarnapp.coronatest.type.pcr.SubmissionStatePCR.TestInvalid
import de.rki.coronawarnapp.coronatest.type.pcr.SubmissionStatePCR.TestNegative
import de.rki.coronawarnapp.coronatest.type.pcr.SubmissionStatePCR.TestPending
import de.rki.coronawarnapp.coronatest.type.pcr.SubmissionStatePCR.TestPositive
import de.rki.coronawarnapp.coronatest.type.rapidantigen.SubmissionStateRAT
import de.rki.coronawarnapp.risk.RiskState
import de.rki.coronawarnapp.submission.ui.homecards.PcrTestErrorCard
import de.rki.coronawarnapp.submission.ui.homecards.PcrTestInvalidCard
import de.rki.coronawarnapp.submission.ui.homecards.PcrTestNegativeCard
import de.rki.coronawarnapp.submission.ui.homecards.PcrTestPendingCard
import de.rki.coronawarnapp.submission.ui.homecards.PcrTestPositiveCard
import de.rki.coronawarnapp.submission.ui.homecards.PcrTestSubmissionDoneCard
import de.rki.coronawarnapp.submission.ui.homecards.RapidTestNegativeCard
import de.rki.coronawarnapp.submission.ui.homecards.TestFetchingCard
import de.rki.coronawarnapp.submission.ui.homecards.TestUnregisteredCard
import de.rki.coronawarnapp.tracing.TracingProgress
Expand All @@ -29,6 +31,12 @@ import de.rki.coronawarnapp.tracing.ui.homecards.TracingDisabledCard
import de.rki.coronawarnapp.tracing.ui.homecards.TracingFailedCard
import de.rki.coronawarnapp.tracing.ui.homecards.TracingProgressCard
import de.rki.coronawarnapp.util.TimeAndDateExtensions.toLocalDateUtc
import de.rki.coronawarnapp.vaccination.core.VaccinatedPerson
import de.rki.coronawarnapp.vaccination.ui.homecard.ImmuneVaccinationHomeCard
import de.rki.coronawarnapp.vaccination.ui.homecard.VaccinationHomeCard
import io.mockk.every
import io.mockk.mockk
import org.joda.time.Duration
import org.joda.time.Instant

object HomeData {
Expand Down Expand Up @@ -147,6 +155,13 @@ object HomeData {
onClickAction = {}
)

val TEST_NEGATIVE_ITEM_RAT = RapidTestNegativeCard.Item(
state = SubmissionStateRAT.TestNegative(
testRegisteredAt = Instant.now()
),
onClickAction = {}
)

val TEST_INVALID_ITEM = PcrTestInvalidCard.Item(
state = TestInvalid,
onDeleteTest = {}
Expand All @@ -169,4 +184,34 @@ object HomeData {
onClickAction = {}
)
}

object Vaccination {
val INCOMPLETE = VaccinationHomeCard.Item(
vaccinatedPerson = mockk<VaccinatedPerson>().apply {
every { fullName } returns "Andrea Schneider"
every { identifier } returns mockk()
every { getVaccinationStatus(any()) } returns VaccinatedPerson.Status.INCOMPLETE
every { getTimeUntilImmunity(any()) } returns Duration.standardDays(14)
},
onClickAction = {}
)
val COMPLETE = VaccinationHomeCard.Item(
vaccinatedPerson = mockk<VaccinatedPerson>().apply {
every { fullName } returns "Andrea Schneider"
every { identifier } returns mockk()
every { getVaccinationStatus(any()) } returns VaccinatedPerson.Status.COMPLETE
every { getTimeUntilImmunity(any()) } returns Duration.standardDays(14)
},
onClickAction = {}
)
val IMMUNITY = ImmuneVaccinationHomeCard.Item(
vaccinatedPerson = mockk<VaccinatedPerson>().apply {
every { fullName } returns "Andrea Schneider"
every { identifier } returns mockk()
every { getVaccinationStatus(any()) } returns VaccinatedPerson.Status.IMMUNITY
every { getTimeUntilImmunity(any()) } returns Duration.standardDays(14)
},
onClickAction = {}
)
}
}
Loading

0 comments on commit 4855156

Please sign in to comment.