diff --git a/Corona-Warn-App/build.gradle b/Corona-Warn-App/build.gradle index fb8e0479978..8b07d0d1e99 100644 --- a/Corona-Warn-App/build.gradle +++ b/Corona-Warn-App/build.gradle @@ -32,14 +32,13 @@ android { applicationId 'de.rki.coronawarnapp' minSdkVersion 23 targetSdkVersion 29 - versionCode 22 - versionName "0.8.14" + versionCode 23 + versionName "0.8.15" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" buildConfigField "String", "DOWNLOAD_CDN_URL", "\"$DOWNLOAD_CDN_URL\"" buildConfigField "String", "SUBMISSION_CDN_URL", "\"$SUBMISSION_CDN_URL\"" buildConfigField "String", "VERIFICATION_CDN_URL", "\"$VERIFICATION_CDN_URL\"" - buildConfigField "String", "EXPORT_SIGNATURE_ID", "\"de.rki.coronawarnapp-dev\"" //override URLs. Use local.properties if exist. // If environment.properties also exist, override local.properties @@ -87,14 +86,12 @@ android { minifyEnabled true shrinkResources true proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - buildConfigField "String", "EXPORT_SIGNATURE_ID", "\"de.rki.coronawarnapp\"" } releaseForTest { applicationIdSuffix '.dev' minifyEnabled true shrinkResources true proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - buildConfigField "String", "EXPORT_SIGNATURE_ID", "\"de.rki.coronawarnapp-dev\"" } } @@ -232,4 +229,6 @@ dependencies { implementation 'net.zetetic:android-database-sqlcipher:4.4.0' implementation 'org.conscrypt:conscrypt-android:2.4.0' + // LOGGING + implementation 'com.jakewharton.timber:timber:4.7.1' } diff --git a/Corona-Warn-App/src/main/assets/export-server-public-keys-for-verification.properties b/Corona-Warn-App/src/main/assets/export-server-public-keys-for-verification.properties index 39a3689f72f..9b1c8e7bdb8 100644 --- a/Corona-Warn-App/src/main/assets/export-server-public-keys-for-verification.properties +++ b/Corona-Warn-App/src/main/assets/export-server-public-keys-for-verification.properties @@ -1,2 +1,2 @@ -de.rki.coronawarnapp-dev=MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE3BYTxr2HuJYQG+d7Ezu6KS8GEbFkiEvyJFg0j+C839gTjT6j7Ho0EXXZ/a07ZfvKcC2cmc1SunsrqU9Jov1J5Q== +de.rki.coronawarnapp.dev=MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE3BYTxr2HuJYQG+d7Ezu6KS8GEbFkiEvyJFg0j+C839gTjT6j7Ho0EXXZ/a07ZfvKcC2cmc1SunsrqU9Jov1J5Q== de.rki.coronawarnapp=MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEc7DEstcUIRcyk35OYDJ95/hTg3UVhsaDXKT0zK7NhHPXoyzipEnOp3GyNXDVpaPi3cAfQmxeuFMZAIX2+6A5Xg== \ No newline at end of file diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/CoronaWarnApplication.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/CoronaWarnApplication.kt index 4136487edde..2dddb152716 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/CoronaWarnApplication.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/CoronaWarnApplication.kt @@ -7,7 +7,6 @@ import android.content.Context import android.content.IntentFilter import android.content.pm.ActivityInfo import android.os.Bundle -import android.util.Log import androidx.lifecycle.Lifecycle import androidx.lifecycle.LifecycleObserver import androidx.lifecycle.OnLifecycleEvent @@ -17,6 +16,7 @@ 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 timber.log.Timber import java.security.Security class CoronaWarnApplication : Application(), LifecycleObserver, @@ -47,6 +47,10 @@ class CoronaWarnApplication : Application(), LifecycleObserver, Security.insertProviderAt(Conscrypt.newProvider(), 1) ProcessLifecycleOwner.get().lifecycle.addObserver(this) registerActivityLifecycleCallbacks(this) + + if (BuildConfig.DEBUG) { + Timber.plant(Timber.DebugTree()) + } } /** @@ -55,7 +59,7 @@ class CoronaWarnApplication : Application(), LifecycleObserver, @OnLifecycleEvent(Lifecycle.Event.ON_STOP) fun onAppBackgrounded() { isAppInForeground = false - Log.v(TAG, "App backgrounded") + Timber.v("App backgrounded") } /** @@ -64,7 +68,7 @@ class CoronaWarnApplication : Application(), LifecycleObserver, @OnLifecycleEvent(Lifecycle.Event.ON_START) fun onAppForegrounded() { isAppInForeground = true - Log.v(TAG, "App foregrounded") + Timber.v("App foregrounded") } override fun onActivityPaused(activity: Activity) { diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/TestForAPIFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/TestForAPIFragment.kt index ecf28e6f7b4..0c9a04cccc5 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/TestForAPIFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/TestForAPIFragment.kt @@ -5,7 +5,6 @@ import android.graphics.Bitmap import android.graphics.Color import android.os.Bundle import android.util.Base64 -import android.util.Log import android.view.LayoutInflater import android.view.View import android.view.ViewGroup @@ -78,6 +77,7 @@ import kotlinx.android.synthetic.main.fragment_test_for_a_p_i.text_scanned_key import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch import kotlinx.coroutines.withContext +import timber.log.Timber import java.io.File import java.lang.reflect.Type import java.util.UUID @@ -86,8 +86,6 @@ import java.util.UUID class TestForAPIFragment : Fragment(), InternalExposureNotificationPermissionHelper.Callback { companion object { - val TAG: String? = TestForAPIFragment::class.simpleName - const val CONFIG_SCORE = 8 fun keysToJson(keys: List): String { @@ -282,7 +280,7 @@ class TestForAPIFragment : Fragment(), InternalExposureNotificationPermissionHel } private val onScannedKey = { key: AppleLegacyKeyExchange.Key? -> - Log.i(TAG, "keys scanned..") + Timber.i("keys scanned..") key?.let { text_scanned_key.text = prettyKey(key) text_scanned_key.visibility = View.VISIBLE @@ -366,10 +364,7 @@ class TestForAPIFragment : Fragment(), InternalExposureNotificationPermissionHel lifecycleScope.launch { googleFileList = KeyFileHelper.asyncCreateExportFiles(appleFiles, dir) - Log.i( - TAG, - "Provide ${googleFileList.count()} files with ${appleKeyList.size} keys with token $token" - ) + Timber.i("Provide ${googleFileList.count()} files with ${appleKeyList.size} keys with token $token") try { // only testing implementation: this is used to wait for the broadcastreceiver of the OS / EN API InternalExposureNotificationClient.asyncProvideDiagnosisKeys( @@ -386,10 +381,7 @@ class TestForAPIFragment : Fragment(), InternalExposureNotificationPermissionHel } private fun checkExposure() { - Log.d( - TAG, - "Check Exposure with token $token" - ) + Timber.d("Check Exposure with token $token") lifecycleScope.launch { try { @@ -397,10 +389,8 @@ class TestForAPIFragment : Fragment(), InternalExposureNotificationPermissionHel InternalExposureNotificationClient.asyncGetExposureSummary(token!!) updateExposureSummaryDisplay(exposureSummary) showToast("Updated Exposure Summary with token $token") - Log.d( - TAG, "Received exposure with token $token from QR Code" - ) - Log.i(TAG, exposureSummary.toString()) + Timber.d("Received exposure with token $token from QR Code") + Timber.i(exposureSummary.toString()) } catch (e: Exception) { e.report(ExceptionCategory.EXPOSURENOTIFICATION) } diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/TestRiskLevelCalculation.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/TestRiskLevelCalculation.kt index 94df6e4ab1c..f44da266a1f 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/TestRiskLevelCalculation.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/TestRiskLevelCalculation.kt @@ -2,7 +2,6 @@ package de.rki.coronawarnapp import android.content.Intent import android.os.Bundle -import android.util.Log import android.view.LayoutInflater import android.view.View import android.view.ViewGroup @@ -41,6 +40,7 @@ import kotlinx.android.synthetic.main.fragment_test_risk_level_calculation.trans import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch import kotlinx.coroutines.withContext +import timber.log.Timber import java.io.File import java.util.UUID import java.util.concurrent.TimeUnit @@ -171,7 +171,7 @@ class TestRiskLevelCalculation : Fragment() { } private val onScannedKey = { key: AppleLegacyKeyExchange.Key? -> - Log.i(TestForAPIFragment.TAG, "keys scanned..") + Timber.i("keys scanned..") provideDiagnosisKey(key) } @@ -214,10 +214,7 @@ class TestRiskLevelCalculation : Fragment() { lifecycleScope.launch { googleFileList = KeyFileHelper.asyncCreateExportFiles(appleFiles, dir) - Log.i( - TAG, - "Provide ${googleFileList.count()} files with ${appleKeyList.size} keys with token $token" - ) + Timber.i("Provide ${googleFileList.count()} files with ${appleKeyList.size} keys with token $token") try { // only testing implementation: this is used to wait for the broadcastreceiver of the OS / EN API InternalExposureNotificationClient.asyncProvideDiagnosisKeys( diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/exception/reporting/ErrorReportReceiver.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/exception/reporting/ErrorReportReceiver.kt index 45d6eff86e6..d9e4be92bf3 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/exception/reporting/ErrorReportReceiver.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/exception/reporting/ErrorReportReceiver.kt @@ -4,11 +4,11 @@ import android.app.Activity import android.content.BroadcastReceiver import android.content.Context 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 +import timber.log.Timber import java.util.Locale class ErrorReportReceiver(private val activity: Activity) : BroadcastReceiver() { @@ -67,9 +67,6 @@ class ErrorReportReceiver(private val activity: Activity) : BroadcastReceiver() } )) } - Log.e( - TAG, - "[$category]${(prefix ?: "")} $message${(suffix ?: "")}" - ) + Timber.e("[$category]${(prefix ?: "")} $message${(suffix ?: "")}") } } diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/http/WebRequestBuilder.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/http/WebRequestBuilder.kt index efad6238f3e..7611015f3a6 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/http/WebRequestBuilder.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/http/WebRequestBuilder.kt @@ -20,7 +20,6 @@ package de.rki.coronawarnapp.http import KeyExportFormat -import android.util.Log import com.google.protobuf.InvalidProtocolBufferException import de.rki.coronawarnapp.exception.ApplicationConfigurationCorruptException import de.rki.coronawarnapp.exception.ApplicationConfigurationInvalidException @@ -40,6 +39,7 @@ import de.rki.coronawarnapp.util.security.SecurityHelper import de.rki.coronawarnapp.util.security.VerificationKeys import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext +import timber.log.Timber import java.io.File import java.util.Date import java.util.UUID @@ -97,13 +97,12 @@ class WebRequestBuilder( suspend fun asyncGetKeyFilesFromServer( url: String ): File = withContext(Dispatchers.IO) { - val requestID = UUID.randomUUID() val fileName = "${UUID.nameUUIDFromBytes(url.toByteArray())}.zip" val file = File(FileStorageHelper.keyExportDirectory, fileName) file.outputStream().use { - Log.v(requestID.toString(), "Added $url to queue.") + Timber.v("Added $url to queue.") distributionService.getKeyFiles(url).byteStream().copyTo(it, DEFAULT_BUFFER_SIZE) - Log.v(requestID.toString(), "key file request successful.") + Timber.v("key file request successful.") } return@withContext file } @@ -176,7 +175,7 @@ class WebRequestBuilder( faked: Boolean, keyList: List ) = withContext(Dispatchers.IO) { - Log.d(TAG, "Writing ${keyList.size} Keys to the Submission Payload.") + Timber.d("Writing ${keyList.size} Keys to the Submission Payload.") val submissionPayload = KeyExportFormat.SubmissionPayload.newBuilder() .addAllKeys(keyList) .build() diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/http/interceptor/RetryInterceptor.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/http/interceptor/RetryInterceptor.kt index 23f3a9948dc..76ba4e03d8b 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/http/interceptor/RetryInterceptor.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/http/interceptor/RetryInterceptor.kt @@ -1,9 +1,9 @@ package de.rki.coronawarnapp.http.interceptor -import android.util.Log import okhttp3.Interceptor import okhttp3.Request import okhttp3.Response +import timber.log.Timber class RetryInterceptor : Interceptor { companion object { @@ -15,7 +15,7 @@ class RetryInterceptor : Interceptor { var response = chain.proceed(request) var tryCount = 0 while (!response.isSuccessful && tryCount < MAX_RETRY_COUNT) { - Log.d(this.javaClass.simpleName, "Request is not successful - $tryCount") + Timber.d("Request is not successful - $tryCount") tryCount++ response = chain.proceed(request) } diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/nearby/ExposureStateUpdateWorker.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/nearby/ExposureStateUpdateWorker.kt index bf0fb12d918..8af906afe22 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/nearby/ExposureStateUpdateWorker.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/nearby/ExposureStateUpdateWorker.kt @@ -1,7 +1,6 @@ package de.rki.coronawarnapp.nearby import android.content.Context -import android.util.Log import androidx.work.CoroutineWorker import androidx.work.WorkerParameters import com.google.android.gms.common.api.ApiException @@ -12,6 +11,7 @@ import de.rki.coronawarnapp.exception.TransactionException import de.rki.coronawarnapp.exception.reporting.report import de.rki.coronawarnapp.storage.ExposureSummaryRepository import de.rki.coronawarnapp.transaction.RiskLevelTransaction +import timber.log.Timber class ExposureStateUpdateWorker(val context: Context, workerParams: WorkerParameters) : CoroutineWorker(context, workerParams) { @@ -21,21 +21,21 @@ class ExposureStateUpdateWorker(val context: Context, workerParams: WorkerParame override suspend fun doWork(): Result { try { - Log.v(TAG, "worker to persist exposure summary started") + Timber.v("worker to persist exposure summary started") val token = inputData.getString(ExposureNotificationClient.EXTRA_TOKEN) ?: throw NoTokenException(IllegalArgumentException("no token was found in the intent")) - Log.v(TAG, "valid token $token retrieved") + Timber.v("valid token $token retrieved") val exposureSummary = InternalExposureNotificationClient .asyncGetExposureSummary(token) ExposureSummaryRepository.getExposureSummaryRepository() .insertExposureSummaryEntity(exposureSummary) - Log.v(TAG, "exposure summary state updated: $exposureSummary") + Timber.v("exposure summary state updated: $exposureSummary") RiskLevelTransaction.start() - Log.v(TAG, "risk level calculation triggered") + Timber.v("risk level calculation triggered") } catch (e: ApiException) { e.report(ExceptionCategory.EXPOSURENOTIFICATION) } catch (e: TransactionException) { diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/notification/NotificationHelper.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/notification/NotificationHelper.kt index 725cb0986a2..32a87c0c443 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/notification/NotificationHelper.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/notification/NotificationHelper.kt @@ -9,12 +9,12 @@ import android.content.Intent import android.media.AudioAttributes import android.media.RingtoneManager import android.os.Build -import android.util.Log import androidx.core.app.NotificationCompat import androidx.core.app.NotificationManagerCompat import de.rki.coronawarnapp.BuildConfig import de.rki.coronawarnapp.CoronaWarnApplication import de.rki.coronawarnapp.ui.main.MainActivity +import timber.log.Timber import kotlin.random.Random /** @@ -172,9 +172,9 @@ object NotificationHelper { private fun logNotificationBuild(notification: Notification?) { if (BuildConfig.DEBUG) { if (notification != null) { - Log.d(TAG, "Notification build successfully.") + Timber.d("Notification build successfully.") } else { - Log.d(TAG, "Notification build failed.") + Timber.d("Notification build failed.") } } } diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/risk/RiskLevelCalculation.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/risk/RiskLevelCalculation.kt index 0da900ecf9c..b2e73150567 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/risk/RiskLevelCalculation.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/risk/RiskLevelCalculation.kt @@ -1,8 +1,8 @@ package de.rki.coronawarnapp.risk -import android.util.Log import com.google.android.gms.nearby.exposurenotification.ExposureSummary import de.rki.coronawarnapp.server.protocols.ApplicationConfigurationOuterClass +import timber.log.Timber import kotlin.math.round object RiskLevelCalculation { @@ -31,13 +31,10 @@ object RiskLevelCalculation { val defaultBucketOffset = attenuationParameters.defaultBucketOffset.toDouble() val normalizationDivisor = attenuationParameters.riskScoreNormalizationDivisor.toDouble() - Log.v( - TAG, - "Weighted Attenuation: ($weightedAttenuationLow +" + - " $weightedAttenuationMid +" + - " $weightedAttenuationHigh +" + - " $defaultBucketOffset)" - ) + val attenuationStrings = + "Weighted Attenuation: ($weightedAttenuationLow + $weightedAttenuationMid + " + + "$weightedAttenuationHigh + $defaultBucketOffset)" + Timber.v(attenuationStrings) val weightedAttenuationDuration = weightedAttenuationLow @@ -45,10 +42,7 @@ object RiskLevelCalculation { .plus(weightedAttenuationHigh) .plus(defaultBucketOffset) - Log.v( - TAG, - "Formula used: ($maximumRiskScore / $normalizationDivisor) * $weightedAttenuationDuration" - ) + Timber.v("Formula used: ($maximumRiskScore / $normalizationDivisor) * $weightedAttenuationDuration") val riskScore = (maximumRiskScore / normalizationDivisor) * weightedAttenuationDuration diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/service/diagnosiskey/DiagnosisKeyService.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/service/diagnosiskey/DiagnosisKeyService.kt index 426350c08e1..c2dc27c88dc 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/service/diagnosiskey/DiagnosisKeyService.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/service/diagnosiskey/DiagnosisKeyService.kt @@ -20,10 +20,10 @@ package de.rki.coronawarnapp.service.diagnosiskey import KeyExportFormat -import android.util.Log import de.rki.coronawarnapp.exception.DiagnosisKeyRetrievalException import de.rki.coronawarnapp.exception.DiagnosisKeySubmissionException import de.rki.coronawarnapp.http.WebRequestBuilder +import timber.log.Timber /** * The Diagnosis Key Service is used to interact with the Server to submit and retrieve keys through @@ -50,7 +50,7 @@ object DiagnosisKeyService { authCode: String, keysToReport: List ) { - Log.d(TAG, "Diagnosis Keys will be submitted.") + Timber.d("Diagnosis Keys will be submitted.") WebRequestBuilder.getInstance().asyncSubmitKeysToServer( authCode, false, diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/sharing/ExposureSharingService.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/sharing/ExposureSharingService.kt index b70a41978ce..6b07ea1084b 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/sharing/ExposureSharingService.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/sharing/ExposureSharingService.kt @@ -3,7 +3,6 @@ package de.rki.coronawarnapp.sharing import android.graphics.Bitmap import android.graphics.Color import android.util.Base64 -import android.util.Log import com.google.android.gms.common.api.ApiException import com.google.protobuf.ByteString import com.google.zxing.BarcodeFormat @@ -13,6 +12,7 @@ import de.rki.coronawarnapp.exception.ExceptionCategory.INTERNAL import de.rki.coronawarnapp.exception.reporting.report import de.rki.coronawarnapp.nearby.InternalExposureNotificationClient import de.rki.coronawarnapp.server.protocols.AppleLegacyKeyExchange +import timber.log.Timber object ExposureSharingService { private const val defaultWidth: Int = 150 @@ -47,7 +47,7 @@ object ExposureSharingService { bmp.setPixel(x, y, if (bMatrix.get(x, y)) Color.BLACK else Color.WHITE) } } - Log.d("ExposureSharingService", "Bitmap generated") + Timber.d("Bitmap generated") callback(bmp) } catch (e: ApiException) { e.report(EXPOSURENOTIFICATION) @@ -67,7 +67,7 @@ object ExposureSharingService { val key = AppleLegacyKeyExchange.Key.parseFrom(decodedQr) callback(key) } catch (ex: Exception) { - Log.d("ExposureSharingService", "$ex") + Timber.d("$ex") callback(null) } } diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/storage/FileStorageHelper.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/storage/FileStorageHelper.kt index 1de5f941f6a..f1844b19fff 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/storage/FileStorageHelper.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/storage/FileStorageHelper.kt @@ -1,7 +1,7 @@ package de.rki.coronawarnapp.storage -import android.util.Log import de.rki.coronawarnapp.CoronaWarnApplication +import timber.log.Timber import java.io.File import java.util.concurrent.TimeUnit @@ -86,14 +86,11 @@ object FileStorageHelper { // LOGGING private fun logFileRemovalResult(fileName: String, result: Boolean) = - Log.d(TAG, "File $fileName was deleted: $result") + Timber.d("File $fileName was deleted: $result") private fun logAvailableSpace(availableSpace: Long) = - Log.d(TAG, "Available space: $availableSpace") + Timber.d("Available space: $availableSpace") private fun logInsufficientSpace(availableSpace: Long) = - Log.e( - TAG, - "Not enough free space! Required: ${FileStorageConstants.FREE_SPACE_THRESHOLD} Has: $availableSpace" - ) + Timber.e("Not enough free space! Required: ${FileStorageConstants.FREE_SPACE_THRESHOLD} Has: $availableSpace") } diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/storage/TracingRepository.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/storage/TracingRepository.kt index 3beb1fb40b6..966f104dc70 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/storage/TracingRepository.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/storage/TracingRepository.kt @@ -78,6 +78,8 @@ object TracingRepository { val isEnabled = InternalExposureNotificationClient.asyncIsEnabled() isTracingEnabled.value = isEnabled } catch (e: Exception) { + // when API is not available, ensure tracing is displayed as off + isTracingEnabled.postValue(false) e.report( ExceptionCategory.EXPOSURENOTIFICATION, TAG, diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/storage/tracing/TracingIntervalRepository.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/storage/tracing/TracingIntervalRepository.kt index 43f434f3c17..ff547b58622 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/storage/tracing/TracingIntervalRepository.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/storage/tracing/TracingIntervalRepository.kt @@ -20,9 +20,9 @@ package de.rki.coronawarnapp.storage.tracing import android.content.Context -import android.util.Log import de.rki.coronawarnapp.risk.TimeVariables import de.rki.coronawarnapp.storage.AppDatabase +import timber.log.Timber class TracingIntervalRepository(private val tracingIntervalDao: TracingIntervalDao) { @@ -48,7 +48,7 @@ class TracingIntervalRepository(private val tracingIntervalDao: TracingIntervalD } suspend fun createInterval(from: Long, to: Long) { - Log.v(TAG, "Insert Tracing Interval $from, $to") + Timber.v("Insert Tracing Interval $from, $to") if (to < from) throw IllegalArgumentException("to cannot be after or equal from") tracingIntervalDao.insertInterval(TracingIntervalEntity().apply { this.from = from @@ -61,7 +61,7 @@ class TracingIntervalRepository(private val tracingIntervalDao: TracingIntervalD return tracingIntervalDao.getAllIntervals().map { Pair(it.from, it.to) }.also { - Log.d(TAG, "Intervals: $it") + Timber.d("Intervals: $it") } } diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/timer/TimerHelper.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/timer/TimerHelper.kt index 4a3d7b4b3fb..6212810fa0b 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/timer/TimerHelper.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/timer/TimerHelper.kt @@ -1,6 +1,5 @@ package de.rki.coronawarnapp.timer -import android.util.Log import de.rki.coronawarnapp.BuildConfig import de.rki.coronawarnapp.risk.TimeVariables import de.rki.coronawarnapp.storage.LocalData @@ -8,6 +7,7 @@ import de.rki.coronawarnapp.storage.SettingsRepository import org.joda.time.DateTime import org.joda.time.DateTimeZone import org.joda.time.Instant +import timber.log.Timber import java.util.Timer import java.util.concurrent.atomic.AtomicBoolean import kotlin.concurrent.fixedRateTimer @@ -141,20 +141,20 @@ object TimerHelper { * Log timer start */ private fun Timer.logTimerStart() { - if (BuildConfig.DEBUG) Log.d(TAG, "Timer started: $this") + if (BuildConfig.DEBUG) Timber.d("Timer started: $this") } /** * Log timer stop */ private fun logTimerStop(timerName: String) { - if (BuildConfig.DEBUG) Log.d(TAG, "Timer stopped: $timerName") + if (BuildConfig.DEBUG) Timber.d("Timer stopped: $timerName") } /** * Log timer exception */ private fun logTimerException(exception: java.lang.Exception) { - Log.e(TAG, "Timer exception: $exception") + Timber.e("Timer exception: $exception") } } diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/transaction/RetrieveDiagnosisKeysTransaction.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/transaction/RetrieveDiagnosisKeysTransaction.kt index 0382e75115f..0aa86c705ca 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/transaction/RetrieveDiagnosisKeysTransaction.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/transaction/RetrieveDiagnosisKeysTransaction.kt @@ -19,7 +19,6 @@ package de.rki.coronawarnapp.transaction -import android.util.Log import com.google.android.gms.nearby.exposurenotification.ExposureConfiguration import de.rki.coronawarnapp.CoronaWarnApplication import de.rki.coronawarnapp.nearby.InternalExposureNotificationClient @@ -37,6 +36,7 @@ import de.rki.coronawarnapp.transaction.RetrieveDiagnosisKeysTransaction.Retriev import de.rki.coronawarnapp.transaction.RetrieveDiagnosisKeysTransaction.rollback import de.rki.coronawarnapp.transaction.RetrieveDiagnosisKeysTransaction.start import de.rki.coronawarnapp.util.CachedKeyFileHolder +import timber.log.Timber import java.io.File import java.util.Date import java.util.UUID @@ -142,7 +142,7 @@ object RetrieveDiagnosisKeysTransaction : Transaction() { ****************************************************/ executeAPISubmission(token, keyFiles, exposureConfiguration) } else { - Log.w(TAG, "no key files, skipping submission to internal API.") + Timber.w("no key files, skipping submission to internal API.") } /**************************************************** * Fetch Date Update @@ -174,17 +174,17 @@ object RetrieveDiagnosisKeysTransaction : Transaction() { } private fun rollbackSetup() { - Log.v(TAG, "rollback $SETUP") + Timber.v("rollback $SETUP") LocalData.lastTimeDiagnosisKeysFromServerFetch(lastFetchDateForRollback.get()) } private fun rollbackToken() { - Log.v(TAG, "rollback $TOKEN") + Timber.v("rollback $TOKEN") LocalData.googleApiToken(googleAPITokenForRollback.get()) } private suspend fun rollbackFilesFromWebRequests() { - Log.v(TAG, "rollback $FILES_FROM_WEB_REQUESTS") + Timber.v("rollback $FILES_FROM_WEB_REQUESTS") KeyCacheRepository.getDateRepository(CoronaWarnApplication.getAppContext()) .clear() } @@ -197,7 +197,7 @@ object RetrieveDiagnosisKeysTransaction : Transaction() { throw IllegalStateException("The Exposure Notification Framework must be active, check your tracing status") lastFetchDateForRollback.set(LocalData.lastTimeDiagnosisKeysFromServerFetch()) val currentDate = Date(System.currentTimeMillis()) - Log.d(TAG, "using $currentDate as current date in Transaction.") + Timber.d("using $currentDate as current date in Transaction.") currentDate } @@ -247,7 +247,7 @@ object RetrieveDiagnosisKeysTransaction : Transaction() { token ) } - Log.d(TAG, "Diagnosis Keys provided successfully, Token: $token") + Timber.d("Diagnosis Keys provided successfully, Token: $token") } /** diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/transaction/RiskLevelTransaction.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/transaction/RiskLevelTransaction.kt index 2da061e43e2..076cfe2288c 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/transaction/RiskLevelTransaction.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/transaction/RiskLevelTransaction.kt @@ -1,6 +1,5 @@ package de.rki.coronawarnapp.transaction -import android.util.Log import androidx.core.app.NotificationCompat import androidx.lifecycle.MutableLiveData import com.google.android.gms.nearby.exposurenotification.ExposureSummary @@ -42,6 +41,7 @@ import de.rki.coronawarnapp.util.ConnectivityHelper import de.rki.coronawarnapp.util.TimeAndDateExtensions.millisecondsToHours import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext +import timber.log.Timber import java.util.concurrent.atomic.AtomicReference /** @@ -277,7 +277,7 @@ object RiskLevelTransaction : Transaction() { val isTracingEnabled = InternalExposureNotificationClient.asyncIsEnabled() if (!isTracingEnabled) return@executeState NO_CALCULATION_POSSIBLE_TRACING_OFF - Log.v(TAG, "$transactionId - TRACING_NOT_ACTIVE_RISK not applicable") + Timber.v("$transactionId - TRACING_NOT_ACTIVE_RISK not applicable") return@executeState UNDETERMINED } @@ -290,13 +290,10 @@ object RiskLevelTransaction : Transaction() { // if there was no key retrieval before, we return no calculation state TimeVariables.getLastTimeDiagnosisKeysFromServerFetch() ?: return@executeState UNKNOWN_RISK_INITIAL.also { - Log.v( - TAG, - "$transactionId - no last time diagnosis keys from server fetch timestamp was found" - ) + Timber.v("$transactionId - no last time diagnosis keys from server fetch timestamp was found") } - Log.v(TAG, "$transactionId - CHECK_UNKNOWN_RISK_INITIAL_NO_KEYS not applicable") + Timber.v("$transactionId - CHECK_UNKNOWN_RISK_INITIAL_NO_KEYS not applicable") return@executeState UNDETERMINED } @@ -319,11 +316,11 @@ object RiskLevelTransaction : Transaction() { TimeVariables.getMaxStaleExposureRiskRange() && isActiveTracingTimeAboveThreshold() ) { return@executeState UNKNOWN_RISK_OUTDATED_RESULTS.also { - Log.v(TAG, "diagnosis keys outdated and active tracing time is above threshold") + Timber.v("diagnosis keys outdated and active tracing time is above threshold") } } - Log.v(TAG, "$transactionId - CHECK_UNKNOWN_RISK_OUTDATED not applicable") + Timber.v("$transactionId - CHECK_UNKNOWN_RISK_OUTDATED not applicable") return@executeState UNDETERMINED } @@ -363,7 +360,7 @@ object RiskLevelTransaction : Transaction() { .also { // todo remove after testing sessions recordedTransactionValuesForTestingOnly.appConfig = it - Log.v(TAG, "$transactionId - retrieved configuration from backend") + Timber.v("$transactionId - retrieved configuration from backend") } } @@ -377,7 +374,7 @@ object RiskLevelTransaction : Transaction() { return@executeState lastExposureSummary.also { // todo remove after testing sessions recordedTransactionValuesForTestingOnly.exposureSummary = it - Log.v(TAG, "$transactionId - get the exposure summary for further calculation") + Timber.v("$transactionId - get the exposure summary for further calculation") } } @@ -402,7 +399,7 @@ object RiskLevelTransaction : Transaction() { ).also { // todo remove after testing sessions recordedTransactionValuesForTestingOnly.riskScore = it - Log.v(TAG, "calculated risk with the given config: $it") + Timber.v("calculated risk with the given config: $it") } // these are the defined risk classes. They will divide the calculated @@ -416,10 +413,7 @@ object RiskLevelTransaction : Transaction() { // if the calculated risk score is above the defined level threshold we return the high level risk score if (riskScore >= highRiskScoreClass.min && riskScore <= highRiskScoreClass.max) { - Log.v( - TAG, "$riskScore is above the defined " + - "min value ${highRiskScoreClass.min}" - ) + Timber.v("$riskScore is above the defined min value ${highRiskScoreClass.min}") return@executeState INCREASED_RISK } else if (riskScore > highRiskScoreClass.max) { throw RiskLevelCalculationException( @@ -427,7 +421,7 @@ object RiskLevelTransaction : Transaction() { ) } - Log.v(TAG, "$transactionId - INCREASED_RISK not applicable") + Timber.v("$transactionId - INCREASED_RISK not applicable") return@executeState UNDETERMINED } @@ -439,11 +433,11 @@ object RiskLevelTransaction : Transaction() { ) { // if the active tracing duration is not above the defined threshold we return no calculation state if (!isActiveTracingTimeAboveThreshold()) { - Log.v(TAG, "$transactionId - active tracing time is not enough") + Timber.v("$transactionId - active tracing time is not enough") return@executeState UNKNOWN_RISK_INITIAL } - Log.v(TAG, "$transactionId - UNKNOWN_RISK_INITIAL not applicable") + Timber.v("$transactionId - UNKNOWN_RISK_INITIAL not applicable") return@executeState UNDETERMINED } @@ -452,7 +446,7 @@ object RiskLevelTransaction : Transaction() { */ private suspend fun executeUpdateRiskLevelScore(riskLevel: RiskLevel) = executeState(UPDATE_RISK_LEVEL) { - Log.v(TAG, "$transactionId - update the risk level with $riskLevel") + Timber.v("$transactionId - update the risk level with $riskLevel") updateRiskLevelScore(riskLevel) .also { // todo remove after testing sessions @@ -467,7 +461,7 @@ object RiskLevelTransaction : Transaction() { * Executes the [CLOSE] Transaction State */ private suspend fun executeClose() = executeState(CLOSE) { - Log.v(TAG, "$transactionId - transaction will close") + Timber.v("$transactionId - transaction will close") lastCalculatedRiskLevelScoreForRollback.set(null) lastCalculatedRiskLevelDate.set(null) } @@ -486,11 +480,7 @@ object RiskLevelTransaction : Transaction() { */ private suspend fun isValidResult(riskLevel: RiskLevel): Boolean { if (riskLevel != UNDETERMINED) { - Log.v( - TAG, - "$transactionId - $riskLevel was determined by the transaction. " + - "UPDATE and CLOSE will be called" - ) + Timber.v("$transactionId - $riskLevel was determined by the transaction. UPDATE and CLOSE will be called") lastCalculatedRiskLevelScoreForRollback.set(RiskLevelRepository.getLastCalculatedScore()) executeUpdateRiskLevelScore(riskLevel) lastCalculatedRiskLevelDate.set(LocalData.lastTimeRiskLevelCalculation()) @@ -511,7 +501,7 @@ object RiskLevelTransaction : Transaction() { private suspend fun getLastExposureSummary(): ExposureSummary? { return ExposureSummaryRepository.getExposureSummaryRepository() .getLatestExposureSummary().also { - Log.v(TAG, "used exposure summary for the risk level calculation: $it") + Timber.v("used exposure summary for the risk level calculation: $it") } } @@ -523,7 +513,7 @@ object RiskLevelTransaction : Transaction() { private suspend fun getApplicationConfiguration(): ApplicationConfigurationOuterClass.ApplicationConfiguration = withContext(Dispatchers.Default) { return@withContext ApplicationConfigurationService.asyncRetrieveApplicationConfiguration() - .also { Log.v(TAG, "configuration from backend: $it") } + .also { Timber.v("configuration from backend: $it") } } /** @@ -539,8 +529,8 @@ object RiskLevelTransaction : Transaction() { val activeTracingDurationInHours = durationTracingIsActive.millisecondsToHours() return (activeTracingDurationInHours >= durationTracingIsActiveThreshold).also { - Log.v( - TAG, "active tracing time ($activeTracingDurationInHours h) is above threshold " + + Timber.v( + "active tracing time ($activeTracingDurationInHours h) is above threshold " + "($durationTracingIsActiveThreshold h): $it" ) } @@ -579,7 +569,7 @@ object RiskLevelTransaction : Transaction() { .insertExposureSummaryEntity(exposureSummary) return exposureSummary.also { - Log.v(TAG, "$transactionId - generated new exposure summary with $googleToken") + Timber.v("$transactionId - generated new exposure summary with $googleToken") } } diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/transaction/Transaction.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/transaction/Transaction.kt index fd97788bf7e..f43dfd36aa2 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/transaction/Transaction.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/transaction/Transaction.kt @@ -19,7 +19,6 @@ package de.rki.coronawarnapp.transaction -import android.util.Log import de.rki.coronawarnapp.BuildConfig import de.rki.coronawarnapp.exception.RollbackException import de.rki.coronawarnapp.exception.TransactionException @@ -31,6 +30,7 @@ import kotlinx.coroutines.sync.Mutex import kotlinx.coroutines.sync.withLock import kotlinx.coroutines.withContext import kotlinx.coroutines.withTimeout +import timber.log.Timber import java.util.UUID import java.util.concurrent.atomic.AtomicReference import kotlin.coroutines.CoroutineContext @@ -91,7 +91,7 @@ abstract class Transaction { private fun setState(state: TransactionState) = currentTransactionState.set(state) .also { - Log.d(TAG, "$transactionId - STATE CHANGE: ${currentTransactionState.get()}") + Timber.d("$transactionId - STATE CHANGE: ${currentTransactionState.get()}") } /** @@ -215,11 +215,9 @@ abstract class Transaction { */ private suspend fun lockAndExecute(unique: Boolean, block: suspend CoroutineScope.() -> T) { if (unique && internalMutualExclusionLock.isLocked) { - Log.w( - TAG, - "TRANSACTION WITH ID $transactionId ALREADY RUNNING ($currentTransactionState) AS UNIQUE, " + - "SKIPPING EXECUTION." - ) + val runningString = "TRANSACTION WITH ID $transactionId ALREADY RUNNING " + + "($currentTransactionState) AS UNIQUE, SKIPPING EXECUTION." + Timber.w(runningString) return } try { @@ -230,12 +228,10 @@ abstract class Transaction { block.invoke(this) } }.also { - Log.i( - TAG, + val completedString = "TRANSACTION $transactionId COMPLETED (${System.currentTimeMillis()}) " + - "in $it ms, " + - "STATES EXECUTED: ${getExecutedStates()}" - ) + "in $it ms, STATES EXECUTED: ${getExecutedStates()}" + Timber.i(completedString) } resetExecutedStateStack() } @@ -278,7 +274,7 @@ abstract class Transaction { * @throws RollbackException throws a rollback exception when handleRollbackError() is called */ protected open suspend fun rollback() { - if (BuildConfig.DEBUG) Log.d(TAG, "Initiate Rollback") + if (BuildConfig.DEBUG) Timber.d("Initiate Rollback") } /** diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/LauncherActivity.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/LauncherActivity.kt index 45b78f06344..2c4daee38d5 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/LauncherActivity.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/LauncherActivity.kt @@ -1,7 +1,6 @@ package de.rki.coronawarnapp.ui import android.content.Intent -import android.os.Bundle import androidx.appcompat.app.AppCompatActivity import androidx.lifecycle.lifecycleScope import de.rki.coronawarnapp.storage.LocalData @@ -17,21 +16,15 @@ class LauncherActivity : AppCompatActivity() { private lateinit var updateChecker: UpdateChecker - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - updateChecker = UpdateChecker(this) + override fun onResume() { + super.onResume() + updateChecker = UpdateChecker(this) lifecycleScope.launch { updateChecker.checkForUpdate() } } - override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { - super.onActivityResult(requestCode, resultCode, data) - - updateChecker.onActivityResult(requestCode, resultCode) - } - fun navigateToActivities() { if (LocalData.isOnboarded()) { startMainActivity() diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/information/InformationAboutFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/information/InformationAboutFragment.kt index b202c909bbe..d88206e60ab 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/information/InformationAboutFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/information/InformationAboutFragment.kt @@ -5,8 +5,8 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.view.accessibility.AccessibilityEvent -import de.rki.coronawarnapp.databinding.FragmentInformationAboutBinding import androidx.fragment.app.Fragment +import de.rki.coronawarnapp.databinding.FragmentInformationAboutBinding import de.rki.coronawarnapp.ui.main.MainActivity /** diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/information/InformationContactFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/information/InformationContactFragment.kt index bc1d4682c5f..c0e00a66e04 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/information/InformationContactFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/information/InformationContactFragment.kt @@ -5,9 +5,9 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.view.accessibility.AccessibilityEvent +import androidx.fragment.app.Fragment import de.rki.coronawarnapp.R import de.rki.coronawarnapp.databinding.FragmentInformationContactBinding -import androidx.fragment.app.Fragment import de.rki.coronawarnapp.ui.main.MainActivity import de.rki.coronawarnapp.util.CallHelper diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/information/InformationFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/information/InformationFragment.kt index e9a12156158..804181ce3fa 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/information/InformationFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/information/InformationFragment.kt @@ -5,10 +5,10 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.view.accessibility.AccessibilityEvent +import androidx.fragment.app.Fragment import androidx.navigation.fragment.findNavController import de.rki.coronawarnapp.R import de.rki.coronawarnapp.databinding.FragmentInformationBinding -import androidx.fragment.app.Fragment import de.rki.coronawarnapp.ui.doNavigate import de.rki.coronawarnapp.ui.main.MainActivity import de.rki.coronawarnapp.util.OpenUrlHelper diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/information/InformationLegalFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/information/InformationLegalFragment.kt index 69bdd1901e5..cbe86b19918 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/information/InformationLegalFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/information/InformationLegalFragment.kt @@ -5,8 +5,8 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.view.accessibility.AccessibilityEvent -import de.rki.coronawarnapp.databinding.FragmentInformationLegalBinding import androidx.fragment.app.Fragment +import de.rki.coronawarnapp.databinding.FragmentInformationLegalBinding import de.rki.coronawarnapp.ui.main.MainActivity /** diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/information/InformationPrivacyFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/information/InformationPrivacyFragment.kt index 04ad54dd6d9..d7ee64f5343 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/information/InformationPrivacyFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/information/InformationPrivacyFragment.kt @@ -5,8 +5,8 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.view.accessibility.AccessibilityEvent -import de.rki.coronawarnapp.databinding.FragmentInformationPrivacyBinding import androidx.fragment.app.Fragment +import de.rki.coronawarnapp.databinding.FragmentInformationPrivacyBinding import de.rki.coronawarnapp.ui.main.MainActivity /** diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/information/InformationTechnicalFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/information/InformationTechnicalFragment.kt index d9e1680831b..eeef00278c6 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/information/InformationTechnicalFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/information/InformationTechnicalFragment.kt @@ -5,8 +5,8 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.view.accessibility.AccessibilityEvent -import de.rki.coronawarnapp.databinding.FragmentInformationTechnicalBinding import androidx.fragment.app.Fragment +import de.rki.coronawarnapp.databinding.FragmentInformationTechnicalBinding import de.rki.coronawarnapp.ui.main.MainActivity /** diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/information/InformationTermsFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/information/InformationTermsFragment.kt index abf3752492d..ad0a09245ad 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/information/InformationTermsFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/information/InformationTermsFragment.kt @@ -5,8 +5,8 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.view.accessibility.AccessibilityEvent -import de.rki.coronawarnapp.databinding.FragmentInformationTermsBinding import androidx.fragment.app.Fragment +import de.rki.coronawarnapp.databinding.FragmentInformationTermsBinding import de.rki.coronawarnapp.ui.main.MainActivity /** diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/main/MainFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/main/MainFragment.kt index 954ef415253..4ad3482f342 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/main/MainFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/main/MainFragment.kt @@ -1,7 +1,6 @@ package de.rki.coronawarnapp.ui.main import android.os.Bundle -import android.util.Log import android.view.LayoutInflater import android.view.View import android.view.ViewGroup @@ -9,18 +8,19 @@ import android.view.accessibility.AccessibilityEvent import android.widget.PopupMenu import androidx.core.app.NotificationCompat import androidx.core.app.NotificationManagerCompat +import androidx.fragment.app.Fragment import androidx.fragment.app.activityViewModels +import androidx.navigation.fragment.findNavController import de.rki.coronawarnapp.R import de.rki.coronawarnapp.databinding.FragmentMainBinding import de.rki.coronawarnapp.notification.NotificationHelper import de.rki.coronawarnapp.timer.TimerHelper -import androidx.fragment.app.Fragment -import androidx.navigation.fragment.findNavController import de.rki.coronawarnapp.ui.doNavigate import de.rki.coronawarnapp.ui.viewmodel.SettingsViewModel import de.rki.coronawarnapp.ui.viewmodel.SubmissionViewModel import de.rki.coronawarnapp.ui.viewmodel.TracingViewModel import de.rki.coronawarnapp.util.OpenUrlHelper +import timber.log.Timber /** * After the user has finished the onboarding this fragment will be the heart of the application. @@ -91,9 +91,9 @@ class MainFragment : Fragment() { val shareButtonString: String = getString(R.string.button_share) val menuButtonString: String = getString(R.string.button_menu) val mainCardString: String = getString(R.string.hint_external_webpage) - binding.mainHeaderShare.buttonIcon.setContentDescription(shareButtonString) - binding.mainHeaderOptionsMenu.buttonIcon.setContentDescription(menuButtonString) - binding.mainAbout.mainCard.setContentDescription(mainCardString) + binding.mainHeaderShare.buttonIcon.contentDescription = shareButtonString + binding.mainHeaderOptionsMenu.buttonIcon.contentDescription = menuButtonString + binding.mainAbout.mainCard.contentDescription = mainCardString } private fun setButtonOnClickListener() { @@ -187,9 +187,8 @@ class MainFragment : Fragment() { } // todo remove only for testing R.id.menu_notification_test -> { - Log.i(TAG, "calling notification") - Log.i( - TAG, + Timber.i("calling notification") + Timber.i( NotificationManagerCompat.from(requireContext()).areNotificationsEnabled() .toString() ) diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/main/MainOverviewFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/main/MainOverviewFragment.kt index 64525282def..4de43734005 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/main/MainOverviewFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/main/MainOverviewFragment.kt @@ -5,8 +5,8 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.view.accessibility.AccessibilityEvent -import de.rki.coronawarnapp.databinding.FragmentMainOverviewBinding import androidx.fragment.app.Fragment +import de.rki.coronawarnapp.databinding.FragmentMainOverviewBinding /** * The fragment displays static informative content to the user diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/main/MainShareFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/main/MainShareFragment.kt index 24f17d685e0..5352289e971 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/main/MainShareFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/main/MainShareFragment.kt @@ -4,10 +4,10 @@ import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.ViewGroup +import androidx.fragment.app.Fragment import androidx.fragment.app.activityViewModels import de.rki.coronawarnapp.R import de.rki.coronawarnapp.databinding.FragmentMainShareBinding -import androidx.fragment.app.Fragment import de.rki.coronawarnapp.ui.viewmodel.TracingViewModel import de.rki.coronawarnapp.util.ShareHelper diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/onboarding/OnboardingFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/onboarding/OnboardingFragment.kt index 1e8c0bab7ba..13925c8779a 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/onboarding/OnboardingFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/onboarding/OnboardingFragment.kt @@ -5,9 +5,9 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.view.accessibility.AccessibilityEvent -import de.rki.coronawarnapp.databinding.FragmentOnboardingBinding import androidx.fragment.app.Fragment import androidx.navigation.fragment.findNavController +import de.rki.coronawarnapp.databinding.FragmentOnboardingBinding import de.rki.coronawarnapp.ui.doNavigate /** diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/onboarding/OnboardingNotificationsFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/onboarding/OnboardingNotificationsFragment.kt index 596116eb685..a89d179d5c7 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/onboarding/OnboardingNotificationsFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/onboarding/OnboardingNotificationsFragment.kt @@ -7,8 +7,8 @@ import android.view.ViewGroup import android.view.accessibility.AccessibilityEvent import androidx.appcompat.app.AlertDialog import androidx.core.app.NotificationManagerCompat -import de.rki.coronawarnapp.databinding.FragmentOnboardingNotificationsBinding import androidx.fragment.app.Fragment +import de.rki.coronawarnapp.databinding.FragmentOnboardingNotificationsBinding /** * This fragment ask the user if he wants to get notifications and finishes the onboarding afterwards. diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/onboarding/OnboardingTestFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/onboarding/OnboardingTestFragment.kt index 45f68dceeef..a95516e58c4 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/onboarding/OnboardingTestFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/onboarding/OnboardingTestFragment.kt @@ -5,9 +5,9 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.view.accessibility.AccessibilityEvent -import de.rki.coronawarnapp.databinding.FragmentOnboardingTestBinding import androidx.fragment.app.Fragment import androidx.navigation.fragment.findNavController +import de.rki.coronawarnapp.databinding.FragmentOnboardingTestBinding import de.rki.coronawarnapp.ui.doNavigate /** diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/onboarding/OnboardingTracingFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/onboarding/OnboardingTracingFragment.kt index 1ce916af60f..7d251557b91 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/onboarding/OnboardingTracingFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/onboarding/OnboardingTracingFragment.kt @@ -7,7 +7,9 @@ import android.view.View import android.view.ViewGroup import android.view.accessibility.AccessibilityEvent import androidx.appcompat.app.AlertDialog +import androidx.fragment.app.Fragment import androidx.lifecycle.lifecycleScope +import androidx.navigation.fragment.findNavController import de.rki.coronawarnapp.R import de.rki.coronawarnapp.databinding.FragmentOnboardingTracingBinding import de.rki.coronawarnapp.exception.ExceptionCategory @@ -15,8 +17,6 @@ import de.rki.coronawarnapp.exception.reporting.report import de.rki.coronawarnapp.nearby.InternalExposureNotificationClient import de.rki.coronawarnapp.nearby.InternalExposureNotificationPermissionHelper import de.rki.coronawarnapp.storage.LocalData -import androidx.fragment.app.Fragment -import androidx.navigation.fragment.findNavController import de.rki.coronawarnapp.ui.doNavigate import de.rki.coronawarnapp.util.DialogHelper import kotlinx.coroutines.launch diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/riskdetails/RiskDetailsFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/riskdetails/RiskDetailsFragment.kt index 559eff7c332..8f6f5a752b2 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/riskdetails/RiskDetailsFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/riskdetails/RiskDetailsFragment.kt @@ -5,11 +5,11 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.view.accessibility.AccessibilityEvent +import androidx.fragment.app.Fragment import androidx.fragment.app.activityViewModels +import androidx.navigation.fragment.findNavController import de.rki.coronawarnapp.databinding.FragmentRiskDetailsBinding import de.rki.coronawarnapp.timer.TimerHelper -import androidx.fragment.app.Fragment -import androidx.navigation.fragment.findNavController import de.rki.coronawarnapp.ui.doNavigate import de.rki.coronawarnapp.ui.main.MainActivity import de.rki.coronawarnapp.ui.viewmodel.SettingsViewModel diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/settings/SettingsFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/settings/SettingsFragment.kt index 3aa099338d9..9460bfe99ff 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/settings/SettingsFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/settings/SettingsFragment.kt @@ -4,10 +4,10 @@ import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.ViewGroup -import androidx.fragment.app.activityViewModels -import de.rki.coronawarnapp.databinding.FragmentSettingsBinding import androidx.fragment.app.Fragment +import androidx.fragment.app.activityViewModels import androidx.navigation.fragment.findNavController +import de.rki.coronawarnapp.databinding.FragmentSettingsBinding import de.rki.coronawarnapp.ui.doNavigate import de.rki.coronawarnapp.ui.main.MainActivity import de.rki.coronawarnapp.ui.viewmodel.SettingsViewModel diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/settings/SettingsNotificationFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/settings/SettingsNotificationFragment.kt index 2344f700960..4317f0e40ad 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/settings/SettingsNotificationFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/settings/SettingsNotificationFragment.kt @@ -66,7 +66,7 @@ class SettingsNotificationFragment : Fragment() { val updateTestNotificationSwitch = binding.settingsSwitchRowNotificationsTest.settingsSwitchRowSwitch // Settings - val settingsRow = binding.settingsNavigationRowSystem.navigationRow + val settingsRow = binding.settingsNotificationsCard.tracingStatusCardButton val goBack = binding.settingsNotificationsHeader.headerButtonBack.buttonIcon // Update Risk diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/settings/SettingsResetFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/settings/SettingsResetFragment.kt index 2e3c59fe4c9..a0f6f4b3bf1 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/settings/SettingsResetFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/settings/SettingsResetFragment.kt @@ -6,17 +6,16 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.widget.Toast +import androidx.fragment.app.Fragment import androidx.lifecycle.lifecycleScope import com.google.android.gms.common.api.ApiException import de.rki.coronawarnapp.databinding.FragmentSettingsResetBinding import de.rki.coronawarnapp.exception.ExceptionCategory import de.rki.coronawarnapp.exception.reporting.report import de.rki.coronawarnapp.nearby.InternalExposureNotificationClient -import androidx.fragment.app.Fragment import de.rki.coronawarnapp.ui.main.MainActivity import de.rki.coronawarnapp.ui.onboarding.OnboardingActivity import de.rki.coronawarnapp.util.DataRetentionHelper -import de.rki.coronawarnapp.util.SettingsNavigationHelper import de.rki.coronawarnapp.worker.BackgroundWorkScheduler import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch @@ -60,9 +59,6 @@ class SettingsResetFragment : Fragment() { binding.settingsResetHeader.headerButtonBack.buttonIcon.setOnClickListener { (activity as MainActivity).goBack() } - binding.settingsResetKeys.tracingStatusCardButton.setOnClickListener { - SettingsNavigationHelper.toEnSettings(requireContext()) - } } // TODO verify that all local data is deleted diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/settings/SettingsTracingFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/settings/SettingsTracingFragment.kt index 534b387cce9..e22cdad1d5b 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/settings/SettingsTracingFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/settings/SettingsTracingFragment.kt @@ -6,6 +6,7 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.widget.Toast +import androidx.fragment.app.Fragment import androidx.fragment.app.activityViewModels import androidx.lifecycle.lifecycleScope import de.rki.coronawarnapp.R @@ -15,7 +16,6 @@ import de.rki.coronawarnapp.exception.reporting.report import de.rki.coronawarnapp.nearby.InternalExposureNotificationClient import de.rki.coronawarnapp.nearby.InternalExposureNotificationPermissionHelper import de.rki.coronawarnapp.storage.LocalData -import androidx.fragment.app.Fragment import de.rki.coronawarnapp.ui.ViewBlocker import de.rki.coronawarnapp.ui.main.MainActivity import de.rki.coronawarnapp.ui.viewmodel.SettingsViewModel @@ -125,8 +125,8 @@ class SettingsTracingFragment : Fragment(), private fun startStopTracing() { // if tracing is enabled when listener is activated it should be disabled lifecycleScope.launch { - if (InternalExposureNotificationClient.asyncIsEnabled()) { - try { + try { + if (InternalExposureNotificationClient.asyncIsEnabled()) { Toast.makeText( requireContext(), "Tracing stopped successfully", @@ -135,25 +135,26 @@ class SettingsTracingFragment : Fragment(), .show() InternalExposureNotificationClient.asyncStop() - } catch (exception: Exception) { - exception.report( - ExceptionCategory.EXPOSURENOTIFICATION, - TAG, - null - ) - } - tracingViewModel.refreshIsTracingEnabled() - BackgroundWorkScheduler.stopWorkScheduler() - } else { - // tracing was already activated - if (LocalData.initialTracingActivationTimestamp() != null) { - internalExposureNotificationPermissionHelper.requestPermissionToStartTracing() + tracingViewModel.refreshIsTracingEnabled() + BackgroundWorkScheduler.stopWorkScheduler() } else { - // tracing was never activated - // ask for consent via dialog for initial tracing activation when tracing was not - // activated during onboarding - showConsentDialog() + // tracing was already activated + if (LocalData.initialTracingActivationTimestamp() != null) { + internalExposureNotificationPermissionHelper.requestPermissionToStartTracing() + } else { + // tracing was never activated + // ask for consent via dialog for initial tracing activation when tracing was not + // activated during onboarding + showConsentDialog() + } } + } catch (exception: Exception) { + tracingViewModel.refreshIsTracingEnabled() + exception.report( + ExceptionCategory.EXPOSURENOTIFICATION, + TAG, + null + ) } } } diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionContactFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionContactFragment.kt index 70596697e92..edc1c920a4d 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionContactFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionContactFragment.kt @@ -5,10 +5,10 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.view.accessibility.AccessibilityEvent -import de.rki.coronawarnapp.R -import de.rki.coronawarnapp.databinding.FragmentSubmissionContactBinding import androidx.fragment.app.Fragment import androidx.navigation.fragment.findNavController +import de.rki.coronawarnapp.R +import de.rki.coronawarnapp.databinding.FragmentSubmissionContactBinding import de.rki.coronawarnapp.ui.doNavigate import de.rki.coronawarnapp.ui.main.MainActivity import de.rki.coronawarnapp.util.CallHelper diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionDispatcherFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionDispatcherFragment.kt index f2aee760c3d..dbc66ff1006 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionDispatcherFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionDispatcherFragment.kt @@ -5,10 +5,10 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.view.accessibility.AccessibilityEvent -import de.rki.coronawarnapp.R -import de.rki.coronawarnapp.databinding.FragmentSubmissionDispatcherBinding import androidx.fragment.app.Fragment import androidx.navigation.fragment.findNavController +import de.rki.coronawarnapp.R +import de.rki.coronawarnapp.databinding.FragmentSubmissionDispatcherBinding import de.rki.coronawarnapp.ui.doNavigate import de.rki.coronawarnapp.ui.main.MainActivity import de.rki.coronawarnapp.util.DialogHelper diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionDoneFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionDoneFragment.kt index 4c7b7d780c6..dfcc635eb8b 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionDoneFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionDoneFragment.kt @@ -4,9 +4,9 @@ import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.ViewGroup -import de.rki.coronawarnapp.databinding.FragmentSubmissionDoneBinding import androidx.fragment.app.Fragment import androidx.navigation.fragment.findNavController +import de.rki.coronawarnapp.databinding.FragmentSubmissionDoneBinding import de.rki.coronawarnapp.ui.doNavigate /** diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionIntroFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionIntroFragment.kt index 724c7acb1cb..5c688523b10 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionIntroFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionIntroFragment.kt @@ -5,9 +5,9 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.view.accessibility.AccessibilityEvent -import de.rki.coronawarnapp.databinding.FragmentSubmissionIntroBinding import androidx.fragment.app.Fragment import androidx.navigation.fragment.findNavController +import de.rki.coronawarnapp.databinding.FragmentSubmissionIntroBinding import de.rki.coronawarnapp.ui.doNavigate /** diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionQRCodeScanFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionQRCodeScanFragment.kt index 6abaa5c8a17..3b2323a4367 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionQRCodeScanFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionQRCodeScanFragment.kt @@ -5,7 +5,9 @@ import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.ViewGroup +import androidx.fragment.app.Fragment import androidx.fragment.app.activityViewModels +import androidx.navigation.fragment.findNavController import com.google.zxing.BarcodeFormat import com.journeyapps.barcodescanner.BarcodeResult import com.journeyapps.barcodescanner.DefaultDecoderFactory @@ -15,8 +17,6 @@ import de.rki.coronawarnapp.exception.http.BadRequestException import de.rki.coronawarnapp.exception.http.CwaClientError import de.rki.coronawarnapp.exception.http.CwaServerError import de.rki.coronawarnapp.exception.http.CwaWebException -import androidx.fragment.app.Fragment -import androidx.navigation.fragment.findNavController import de.rki.coronawarnapp.ui.doNavigate import de.rki.coronawarnapp.ui.main.MainActivity import de.rki.coronawarnapp.ui.viewmodel.SubmissionViewModel @@ -136,6 +136,11 @@ class SubmissionQRCodeScanFragment : Fragment() { }) viewModel.registrationState.observeEvent(viewLifecycleOwner, { + binding.submissionQrCodeScanSpinner.visibility = when (it) { + ApiRequestState.STARTED -> View.VISIBLE + else -> View.GONE + } + if (ApiRequestState.SUCCESS == it) { findNavController().doNavigate( SubmissionQRCodeScanFragmentDirections diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionResultPositiveOtherWarningFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionResultPositiveOtherWarningFragment.kt index 8e0f85e5f6a..7b28f7cdf85 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionResultPositiveOtherWarningFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionResultPositiveOtherWarningFragment.kt @@ -4,7 +4,9 @@ import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.ViewGroup +import androidx.fragment.app.Fragment import androidx.fragment.app.activityViewModels +import androidx.navigation.fragment.findNavController import com.google.android.gms.nearby.exposurenotification.TemporaryExposureKey import de.rki.coronawarnapp.R import de.rki.coronawarnapp.databinding.FragmentSubmissionPositiveOtherWarningBinding @@ -13,8 +15,6 @@ import de.rki.coronawarnapp.exception.http.CwaClientError import de.rki.coronawarnapp.exception.http.CwaServerError import de.rki.coronawarnapp.exception.http.ForbiddenException import de.rki.coronawarnapp.nearby.InternalExposureNotificationPermissionHelper -import androidx.fragment.app.Fragment -import androidx.navigation.fragment.findNavController import de.rki.coronawarnapp.ui.doNavigate import de.rki.coronawarnapp.ui.viewmodel.SubmissionViewModel import de.rki.coronawarnapp.ui.viewmodel.TracingViewModel @@ -52,6 +52,8 @@ class SubmissionResultPositiveOtherWarningFragment : Fragment(), } override fun onFailure(exception: Exception?) { + binding.submissionPositiveOtherWarningButtonNext.isEnabled = true + binding.submissionPositiveOtherWarningSpinner.visibility = View.GONE submissionFailed = true } @@ -137,6 +139,16 @@ class SubmissionResultPositiveOtherWarningFragment : Fragment(), }) submissionViewModel.submissionState.observeEvent(viewLifecycleOwner, { + binding.submissionPositiveOtherWarningButtonNext.isEnabled = when (it) { + ApiRequestState.STARTED -> false + else -> true + } + + binding.submissionPositiveOtherWarningSpinner.visibility = when (it) { + ApiRequestState.STARTED -> View.VISIBLE + else -> View.GONE + } + if (it == ApiRequestState.SUCCESS) { findNavController().doNavigate( SubmissionResultPositiveOtherWarningFragmentDirections @@ -148,6 +160,8 @@ class SubmissionResultPositiveOtherWarningFragment : Fragment(), private fun setButtonOnClickListener() { binding.submissionPositiveOtherWarningButtonNext.setOnClickListener { + binding.submissionPositiveOtherWarningButtonNext.isEnabled = false + binding.submissionPositiveOtherWarningSpinner.visibility = View.VISIBLE initiateWarningOthers() } binding.submissionPositiveOtherWarningHeader.headerButtonBack.buttonIcon.setOnClickListener { diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionTanFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionTanFragment.kt index ed607c6170e..a7c7a04ed15 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionTanFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionTanFragment.kt @@ -5,15 +5,15 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.view.accessibility.AccessibilityEvent +import androidx.fragment.app.Fragment import androidx.fragment.app.activityViewModels +import androidx.navigation.fragment.findNavController import de.rki.coronawarnapp.R import de.rki.coronawarnapp.databinding.FragmentSubmissionTanBinding import de.rki.coronawarnapp.exception.http.BadRequestException import de.rki.coronawarnapp.exception.http.CwaClientError import de.rki.coronawarnapp.exception.http.CwaServerError import de.rki.coronawarnapp.exception.http.CwaWebException -import androidx.fragment.app.Fragment -import androidx.navigation.fragment.findNavController import de.rki.coronawarnapp.ui.doNavigate import de.rki.coronawarnapp.ui.viewmodel.SubmissionViewModel import de.rki.coronawarnapp.util.DialogHelper @@ -101,6 +101,11 @@ class SubmissionTanFragment : Fragment() { binding.submissionTanHeader.headerButtonBack.buttonIcon.setOnClickListener { navigateToDispatchScreen() } submissionViewModel.registrationState.observeEvent(viewLifecycleOwner, { + binding.submissionTanSpinner.visibility = when (it) { + ApiRequestState.STARTED -> View.VISIBLE + else -> View.GONE + } + if (ApiRequestState.SUCCESS == it) { findNavController().doNavigate( SubmissionTanFragmentDirections.actionSubmissionTanFragmentToSubmissionResultFragment() diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionTanViewModel.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionTanViewModel.kt index 642ff6cf50d..e42d6c9a2cf 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionTanViewModel.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionTanViewModel.kt @@ -1,11 +1,11 @@ package de.rki.coronawarnapp.ui.submission -import android.util.Log import androidx.lifecycle.MutableLiveData import androidx.lifecycle.Transformations import androidx.lifecycle.ViewModel import de.rki.coronawarnapp.storage.SubmissionRepository import de.rki.coronawarnapp.util.TanHelper +import timber.log.Timber class SubmissionTanViewModel : ViewModel() { @@ -36,7 +36,7 @@ class SubmissionTanViewModel : ViewModel() { fun storeTeletan() { val teletan = tan.value!! - Log.d(TAG, "Storing teletan $teletan") + Timber.d("Storing teletan $teletan") SubmissionRepository.setTeletan(teletan) } } diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionTestResultFragment.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionTestResultFragment.kt index 80a632858d2..cbea694ff9f 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionTestResultFragment.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/submission/SubmissionTestResultFragment.kt @@ -5,14 +5,14 @@ import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.ViewGroup +import androidx.fragment.app.Fragment import androidx.fragment.app.activityViewModels +import androidx.navigation.fragment.findNavController import de.rki.coronawarnapp.R import de.rki.coronawarnapp.databinding.FragmentSubmissionTestResultBinding import de.rki.coronawarnapp.exception.http.CwaClientError import de.rki.coronawarnapp.exception.http.CwaServerError import de.rki.coronawarnapp.exception.http.CwaWebException -import androidx.fragment.app.Fragment -import androidx.navigation.fragment.findNavController import de.rki.coronawarnapp.ui.doNavigate import de.rki.coronawarnapp.ui.viewmodel.SubmissionViewModel import de.rki.coronawarnapp.ui.viewmodel.TracingViewModel diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/viewmodel/SubmissionViewModel.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/viewmodel/SubmissionViewModel.kt index 60376083e32..7e78fd840c0 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/viewmodel/SubmissionViewModel.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/viewmodel/SubmissionViewModel.kt @@ -5,6 +5,7 @@ import androidx.lifecycle.MutableLiveData import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import de.rki.coronawarnapp.exception.ExceptionCategory +import de.rki.coronawarnapp.exception.TransactionException import de.rki.coronawarnapp.exception.http.CwaWebException import de.rki.coronawarnapp.exception.reporting.report import de.rki.coronawarnapp.service.submission.SubmissionService @@ -121,7 +122,15 @@ class SubmissionViewModel : ViewModel() { } catch (err: CwaWebException) { exceptionLiveData?.value = Event(err) state.value = Event(ApiRequestState.FAILED) + } catch (err: TransactionException) { + if (err.cause is CwaWebException) { + exceptionLiveData?.value = Event(err.cause) + } else { + err.report(ExceptionCategory.INTERNAL) + } + state.value = Event(ApiRequestState.FAILED) } catch (err: Exception) { + state.value = Event(ApiRequestState.FAILED) err.report(ExceptionCategory.INTERNAL) } } diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/viewmodel/TracingViewModel.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/viewmodel/TracingViewModel.kt index 3c3b3612c88..f45b0645da3 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/viewmodel/TracingViewModel.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/viewmodel/TracingViewModel.kt @@ -1,6 +1,5 @@ package de.rki.coronawarnapp.ui.viewmodel -import android.util.Log import androidx.lifecycle.LiveData import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope @@ -13,6 +12,7 @@ import de.rki.coronawarnapp.storage.TracingRepository import de.rki.coronawarnapp.timer.TimerHelper import de.rki.coronawarnapp.transaction.RiskLevelTransaction import kotlinx.coroutines.launch +import timber.log.Timber import java.util.Date /** @@ -108,7 +108,7 @@ class TracingViewModel : ViewModel() { try { ExposureSummaryRepository.getExposureSummaryRepository() .getLatestExposureSummary() - Log.v(TAG, "retrieved latest exposure summary from db") + Timber.v("retrieved latest exposure summary from db") } catch (e: Exception) { e.report( de.rki.coronawarnapp.exception.ExceptionCategory.EXPOSURENOTIFICATION, diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/update/UpdateChecker.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/update/UpdateChecker.kt index 3d56617f253..580cdb81ce8 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/update/UpdateChecker.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/update/UpdateChecker.kt @@ -1,32 +1,24 @@ package de.rki.coronawarnapp.update -import android.app.Activity.RESULT_CANCELED -import android.app.Activity.RESULT_OK -import android.content.IntentSender.SendIntentException -import android.util.Log -import android.widget.Toast +import android.content.Intent +import android.net.Uri import androidx.appcompat.app.AlertDialog -import com.google.android.play.core.appupdate.AppUpdateInfo -import com.google.android.play.core.appupdate.AppUpdateManager -import com.google.android.play.core.appupdate.AppUpdateManagerFactory -import com.google.android.play.core.install.model.ActivityResult.RESULT_IN_APP_UPDATE_FAILED -import com.google.android.play.core.install.model.AppUpdateType -import com.google.android.play.core.install.model.UpdateAvailability +import androidx.core.content.ContextCompat.startActivity import de.rki.coronawarnapp.BuildConfig import de.rki.coronawarnapp.R import de.rki.coronawarnapp.exception.CwaSecurityException import de.rki.coronawarnapp.server.protocols.ApplicationConfigurationOuterClass import de.rki.coronawarnapp.service.applicationconfiguration.ApplicationConfigurationService import de.rki.coronawarnapp.ui.LauncherActivity -import kotlin.coroutines.resume -import kotlin.coroutines.resumeWithException -import kotlin.coroutines.suspendCoroutine +import timber.log.Timber class UpdateChecker(private val activity: LauncherActivity) { companion object { val TAG: String? = UpdateChecker::class.simpleName - private const val REQUEST_CODE = 100 + + const val STORE_PREFIX = "https://play.google.com/store/apps/details?id=" + const val COM_ANDROID_VENDING = "com.android.vending" } suspend fun checkForUpdate() { @@ -35,111 +27,62 @@ class UpdateChecker(private val activity: LauncherActivity) { val updateNeededFromServer: Boolean = try { checkIfUpdatesNeededFromServer() } catch (exception: CwaSecurityException) { - Log.e(TAG, "CwaSecurityException caught:" + exception.localizedMessage) + Timber.e("CwaSecurityException caught:%s", exception.localizedMessage) true } catch (exception: Exception) { - Log.e(TAG, "Exception caught:" + exception.localizedMessage) + Timber.e("Exception caught:%s", exception.localizedMessage) false } - // get AppUpdateManager - val baseContext = activity.baseContext - val appUpdateManager = AppUpdateManagerFactory.create(baseContext) - - var appUpdateInfo: AppUpdateInfo? = null - - val updateAvailableFromGooglePlay = try { - appUpdateInfo = checkForGooglePlayUpdate(appUpdateManager) - - val availability = appUpdateInfo.updateAvailability() - val immediateUpdateAllowed = - appUpdateInfo.isUpdateTypeAllowed(AppUpdateType.IMMEDIATE) - - availability == UpdateAvailability.UPDATE_AVAILABLE && immediateUpdateAllowed - } catch (exception: Exception) { - false - } - - if (updateNeededFromServer && updateAvailableFromGooglePlay && appUpdateInfo != null) { - Log.i(TAG, "show update dialog") - showUpdateAvailableDialog(appUpdateManager, appUpdateInfo) + if (updateNeededFromServer) { + showUpdateNeededDialog() } else { activity.navigateToActivities() } } - private fun showUpdateAvailableDialog( - appUpdateManager: AppUpdateManager, - appUpdateInfo: AppUpdateInfo - ) { + /** + * Show dialog there an update is needed and links to the play store + */ + private fun showUpdateNeededDialog() { AlertDialog.Builder(activity) .setTitle(activity.getString(R.string.update_dialog_title)) .setMessage(activity.getString(R.string.update_dialog_message)) + .setCancelable(false) .setPositiveButton(activity.getString(R.string.update_dialog_button)) { _, _ -> - startGooglePlayUpdateFlow(appUpdateManager, appUpdateInfo) - } - .create().show() - } - - private fun startGooglePlayUpdateFlow( - appUpdateManager: AppUpdateManager, - appUpdateInfo: AppUpdateInfo - ) { - try { - appUpdateManager.startUpdateFlowForResult( - appUpdateInfo, - AppUpdateType.IMMEDIATE, - activity, - REQUEST_CODE - ) - } catch (exception: SendIntentException) { - Log.i(TAG, exception.toString()) - } - } - - fun onActivityResult(requestCode: Int, resultCode: Int) { - if (REQUEST_CODE == requestCode) { - // TODO react to these - when (resultCode) { - RESULT_OK -> { - Log.i(TAG, "startFlowResult RESULT_OK") - activity.navigateToActivities() - } - RESULT_CANCELED -> { - Log.i(TAG, "startFlowResult RESULT_CANCELED") - } - RESULT_IN_APP_UPDATE_FAILED -> { - Log.i(TAG, "startFlowResult RESULT_IN_APP_UPDATE_FAILED") - val toast = Toast.makeText(activity, "In app update failed", Toast.LENGTH_LONG) - toast.show() - activity.navigateToActivities() + val uriStringInPlayStore = STORE_PREFIX + BuildConfig.APPLICATION_ID + val intent = Intent(Intent.ACTION_VIEW).apply { + data = Uri.parse( + uriStringInPlayStore + ) + setPackage(COM_ANDROID_VENDING) } + startActivity(activity, intent, null) } - } + .create().show() } private suspend fun checkIfUpdatesNeededFromServer(): Boolean { - val applicationConfigurationFromServer = ApplicationConfigurationService.asyncRetrieveApplicationConfiguration() val minVersionFromServer = applicationConfigurationFromServer.appVersion.android.min val minVersionFromServerString = constructSemanticVersionString(minVersionFromServer) - Log.i( - TAG, - "minVersionStringFromServer:" + constructSemanticVersionString( + + Timber.e( + "minVersionStringFromServer:%s", constructSemanticVersionString( minVersionFromServer ) ) - Log.i(TAG, "Current app version:" + BuildConfig.VERSION_NAME) + Timber.e("Current app version:%s", BuildConfig.VERSION_NAME) val needsImmediateUpdate = VersionComparator.isVersionOlder( BuildConfig.VERSION_NAME, minVersionFromServerString ) - Log.i(TAG, "needs update:" + needsImmediateUpdate) + Timber.e("needs update:$needsImmediateUpdate") return true } @@ -150,14 +93,4 @@ class UpdateChecker(private val activity: LauncherActivity) { semanticVersion.minor.toString() + "." + semanticVersion.patch.toString() } - - private suspend fun checkForGooglePlayUpdate(appUpdateManager: AppUpdateManager) = - suspendCoroutine { cont -> - val appUpdateInfoTask = appUpdateManager.appUpdateInfo - appUpdateInfoTask.addOnSuccessListener { - cont.resume(it) - }.addOnFailureListener { - cont.resumeWithException(it) - } - } } diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/CachedKeyFileHolder.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/CachedKeyFileHolder.kt index d0cdb95b4ed..78a5bb2d0fe 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/CachedKeyFileHolder.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/CachedKeyFileHolder.kt @@ -19,7 +19,6 @@ package de.rki.coronawarnapp.util -import android.util.Log import de.rki.coronawarnapp.CoronaWarnApplication import de.rki.coronawarnapp.http.WebRequestBuilder import de.rki.coronawarnapp.service.diagnosiskey.DiagnosisKeyConstants @@ -34,6 +33,7 @@ import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.async import kotlinx.coroutines.awaitAll import kotlinx.coroutines.withContext +import timber.log.Timber import java.io.File import java.util.Date import java.util.UUID @@ -69,7 +69,7 @@ object CachedKeyFileHolder { val serverDates = getDatesFromServer() // TODO remove last3HourFetch before Release if (isLast3HourFetchEnabled()) { - Log.v(TAG, "Last 3 Hours will be Fetched. Only use for Debugging!") + Timber.v("Last 3 Hours will be Fetched. Only use for Debugging!") val currentDateServerFormat = currentDate.toServerFormat() // just fetch the hours if the date is available if (serverDates.contains(currentDateServerFormat)) { @@ -109,7 +109,7 @@ object CachedKeyFileHolder { throw e } keyCache.getFilesFromEntries() - .also { it.forEach { file -> Log.v(TAG, "cached file:${file.path}") } } + .also { it.forEach { file -> Timber.v("cached file:${file.path}") } } } } @@ -119,10 +119,10 @@ object CachedKeyFileHolder { private suspend fun getMissingDaysFromDiff(datesFromServer: Collection): List { val cacheEntries = keyCache.getDates() return datesFromServer - .also { Log.d(TAG, "${it.size} days from server") } + .also { Timber.d("${it.size} days from server") } .filter { it.dateEntryCacheMiss(cacheEntries) } .toList() - .also { Log.d(TAG, "${it.size} missing days") } + .also { Timber.d("${it.size} missing days") } } /** @@ -135,10 +135,10 @@ object CachedKeyFileHolder { * TODO remove before Release */ private suspend fun getLast3Hours(day: Date): List = getHoursFromServer(day) - .also { Log.v(TAG, "${it.size} hours from server, but only latest 3 hours needed") } + .also { Timber.v("${it.size} hours from server, but only latest 3 hours needed") } .filter { TimeAndDateExtensions.getCurrentHourUTC() - LATEST_HOURS_NEEDED <= it.toInt() } .toList() - .also { Log.d(TAG, "${it.size} missing hours") } + .also { Timber.d("${it.size} missing hours") } /** * Determines whether a given String has an existing date cache entry under a unique name @@ -165,10 +165,7 @@ object CachedKeyFileHolder { */ private fun String.generateCacheKeyFromString() = "${UUID.nameUUIDFromBytes(this.toByteArray())}".also { - Log.v( - TAG, - "$this mapped to cache entry $it" - ) + Timber.v("$this mapped to cache entry $it") } /** diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/ConnectivityHelper.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/ConnectivityHelper.kt index dc4a01b60d8..33dd728eed2 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/ConnectivityHelper.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/ConnectivityHelper.kt @@ -11,9 +11,9 @@ import android.net.Network import android.net.NetworkCapabilities import android.net.NetworkRequest import android.os.Build -import android.util.Log import de.rki.coronawarnapp.exception.ExceptionCategory import de.rki.coronawarnapp.exception.reporting.report +import timber.log.Timber /** * Helper for connectivity statuses. @@ -152,7 +152,7 @@ object ConnectivityHelper { fun isBluetoothEnabled(): Boolean { val bAdapter = BluetoothAdapter.getDefaultAdapter() if (bAdapter == null) { - Log.d(TAG, "Device does not have bluetooth hardware") + Timber.d("Device does not have bluetooth hardware") return false } return bAdapter.isEnabled diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/DataRetentionHelper.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/DataRetentionHelper.kt index 863aa1a4e6f..2ffe2d1e633 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/DataRetentionHelper.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/DataRetentionHelper.kt @@ -21,10 +21,10 @@ package de.rki.coronawarnapp.util import android.annotation.SuppressLint import android.content.Context -import android.util.Log import de.rki.coronawarnapp.storage.AppDatabase import de.rki.coronawarnapp.storage.FileStorageHelper import de.rki.coronawarnapp.util.security.SecurityHelper +import timber.log.Timber /** * Helper for supplying functionality regarding Data Retention @@ -38,13 +38,13 @@ object DataRetentionHelper { */ @SuppressLint("ApplySharedPref") // We need a commit here to ensure consistency fun clearAllLocalData(context: Context) { - Log.w(TAG, "CWA LOCAL DATA DELETION INITIATED.") + Timber.w("CWA LOCAL DATA DELETION INITIATED.") // Database Reset AppDatabase.reset(context) // Shared Preferences Reset SecurityHelper.resetSharedPrefs() // Export File Reset FileStorageHelper.getAllFilesInKeyExportDirectory().forEach { it.delete() } - Log.w(TAG, "CWA LOCAL DATA DELETION COMPLETED.") + Timber.w("CWA LOCAL DATA DELETION COMPLETED.") } } diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/KeyFileHelper.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/KeyFileHelper.kt index 802ba9a2cb0..4bf7807abee 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/KeyFileHelper.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/KeyFileHelper.kt @@ -4,8 +4,6 @@ import KeyExportFormat import KeyExportFormat.TEKSignatureList import KeyExportFormat.TEKSignatureList.newBuilder import KeyExportFormat.TemporaryExposureKeyExport -import android.util.Log -import de.rki.coronawarnapp.BuildConfig import de.rki.coronawarnapp.server.protocols.AppleLegacyKeyExchange import de.rki.coronawarnapp.util.ProtoFormatConverterExtensions.convertToGoogleKey import de.rki.coronawarnapp.util.TimeAndDateExtensions.logUTCFormat @@ -13,6 +11,7 @@ import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.async import kotlinx.coroutines.awaitAll import kotlinx.coroutines.withContext +import timber.log.Timber import java.io.BufferedWriter import java.io.File import java.io.FileOutputStream @@ -39,14 +38,11 @@ object KeyFileHelper { ): List = withContext(Dispatchers.IO) { fileList.map { file -> async(Dispatchers.IO) { - if (BuildConfig.DEBUG) Log.d( - TAG, - "created export " + - "for batch ${file.header.batchNum}(of ${file.header.batchSize}) " + - "with ${file.keysCount} keys, " + - "BEG:${Date(file.header.startTimestamp).logUTCFormat()}, " + - "END:${Date(file.header.endTimestamp).logUTCFormat()}" - ) + val createdExportString = "created export for batch ${file.header.batchNum}" + + "(of ${file.header.batchSize}) with ${file.keysCount} keys, BEG:${Date( + file.header.startTimestamp + ).logUTCFormat()}, END:${Date(file.header.endTimestamp).logUTCFormat()}" + Timber.d(createdExportString) Pair( TemporaryExposureKeyExport .newBuilder() @@ -107,11 +103,8 @@ object KeyFileHelper { Pair(EXPORT_SIGNATURE_FILE_NAME, exportSignatureFile.await()) ) ).also { - if (BuildConfig.DEBUG) Log.d(TAG, "output file name:" + it.absolutePath) - if (BuildConfig.DEBUG) Log.d( - TAG, - "output file size:${it.length() / BYTES_IN_KILOBYTES} KB" - ) + Timber.d("output file name:${it.absolutePath}") + Timber.d("output file size:${it.length() / BYTES_IN_KILOBYTES} KB") exportFile.await().delete() exportSignatureFile.await().delete() diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/SettingsNavigationHelper.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/SettingsNavigationHelper.kt index 22265e06264..bb2fb34da90 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/SettingsNavigationHelper.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/SettingsNavigationHelper.kt @@ -4,7 +4,6 @@ import android.content.Context import android.content.Intent import android.os.Build import android.provider.Settings -import com.google.android.gms.nearby.exposurenotification.ExposureNotificationClient.ACTION_EXPOSURE_NOTIFICATION_SETTINGS /** * A helper to navigate to the os settings, used in different places in the application, @@ -45,15 +44,5 @@ object SettingsNavigationHelper { } context.startActivity(intent) } - - /** - * Navigate the user to the os exposure notification settings - * - * @param context - */ - fun toEnSettings(context: Context) { - val intent = Intent(ACTION_EXPOSURE_NOTIFICATION_SETTINGS) - context.startActivity(intent) - } // todo navigate storage settings } diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/ZipHelper.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/ZipHelper.kt index 2bf094c4417..22d10b8c0a7 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/ZipHelper.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/ZipHelper.kt @@ -19,8 +19,7 @@ package de.rki.coronawarnapp.util -import android.util.Log -import de.rki.coronawarnapp.BuildConfig +import timber.log.Timber import java.io.File import java.io.FileInputStream import java.io.FileOutputStream @@ -40,7 +39,7 @@ object ZipHelper { val outputFile = File(directory, nameOfOutputFile) if (outputFile.exists()) { - if (BuildConfig.DEBUG) Log.d(TAG, "file with output name already exists, override.") + Timber.d("file with output name already exists, override.") outputFile.delete() } outputFile.createNewFile() @@ -65,10 +64,7 @@ object ZipHelper { zipOutputStream: ZipOutputStream, filesWithName: Iterable> ) = filesWithName.forEach { file -> - if (BuildConfig.DEBUG) Log.d( - TAG, - "writing ${file.second.name} as ${file.first} " + "to $nameOfOutputFile in $directory" - ) + Timber.d("writing ${file.second.name} as ${file.first} to $nameOfOutputFile in $directory") val fileInputStream = FileInputStream(file.second) val zipEntry = ZipEntry(file.first) zipOutputStream.putNextEntry(zipEntry) @@ -83,7 +79,7 @@ object ZipHelper { do { val entry = it.nextEntry if (entry != null) { - Log.v(TAG, "read zip entry ${entry.name}") + Timber.v("read zip entry ${entry.name}") callback(entry, it.readBytes()) it.closeEntry() } diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/formatter/FormatterHelper.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/formatter/FormatterHelper.kt index 6b1a56f39da..c826961f01c 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/formatter/FormatterHelper.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/formatter/FormatterHelper.kt @@ -95,7 +95,7 @@ fun formatVisibilityText(text: String?): Int = formatVisibility(text != null && * @param text * @return */ -fun formatVisibilityText(text: CharSequence?): Int = formatVisibility(text != null) +fun formatVisibilityText(text: CharSequence?): Int = formatVisibility(text != null && text != "") /*Text*/ /** @@ -106,12 +106,14 @@ fun formatVisibilityText(text: CharSequence?): Int = formatVisibility(text != nu * @param stringFalse * @return */ -fun formatText(value: Boolean?, stringTrue: Int, stringFalse: Int): String { +fun formatText(value: Boolean?, stringTrue: Int, stringFalse: Int?): String { val appContext = CoronaWarnApplication.getAppContext() return if (value == true) { appContext.getString(stringTrue) } else { - appContext.getString(stringFalse) + if (stringFalse != null) { + appContext.getString(stringFalse) + } else "" } } diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/formatter/FormatterSettingsHelper.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/formatter/FormatterSettingsHelper.kt index c37cd7004a1..fbaea2c319e 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/formatter/FormatterSettingsHelper.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/formatter/FormatterSettingsHelper.kt @@ -41,11 +41,8 @@ fun formatNotificationsStatusText( * @param notifications * @return */ -fun formatNotificationsTitle(notifications: Boolean): String = formatText( - notifications, - R.string.settings_notifications_headline_active, - R.string.settings_notifications_headline_inactive -) +fun formatNotificationsTitle(notifications: Boolean): String? = + formatText(notifications, R.string.settings_notifications_headline_active, null) /** * Formats the settings notifications description text display depending on notifications status @@ -53,11 +50,8 @@ fun formatNotificationsTitle(notifications: Boolean): String = formatText( * @param notifications * @return */ -fun formatNotificationsDescription(notifications: Boolean): String = formatText( - notifications, - R.string.settings_notifications_body_active, - R.string.settings_notifications_body_inactive -) +fun formatNotificationsDescription(notifications: Boolean): String? = + formatText(notifications, R.string.settings_notifications_body_active, null) /** * Formats the settings notifications details illustration description depending on notifications status diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/security/SecurityConstants.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/security/SecurityConstants.kt index a489b160366..6ca022eccd2 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/security/SecurityConstants.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/security/SecurityConstants.kt @@ -1,7 +1,5 @@ package de.rki.coronawarnapp.util.security -import de.rki.coronawarnapp.BuildConfig - object SecurityConstants { const val DIGEST_ALGORITHM = "SHA-256" const val DB_PASSWORD_MIN_LENGTH = 32 @@ -11,6 +9,5 @@ object SecurityConstants { const val EXPORT_SIGNATURE_VERIFICATION_PUBLIC_KEYS = "export-server-public-keys-for-verification.properties" - const val EXPORT_ENVIRONMENT_IDENTIFIER = BuildConfig.EXPORT_SIGNATURE_ID const val EXPORT_FILE_SIGNATURE_VERIFICATION_ALGORITHM = "SHA256withECDSA" } diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/security/VerificationKeys.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/security/VerificationKeys.kt index 026ef81cac0..4e5a01b929f 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/security/VerificationKeys.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/util/security/VerificationKeys.kt @@ -3,11 +3,10 @@ package de.rki.coronawarnapp.util.security import KeyExportFormat import android.security.keystore.KeyProperties import android.util.Base64 -import android.util.Log import de.rki.coronawarnapp.BuildConfig import de.rki.coronawarnapp.CoronaWarnApplication -import de.rki.coronawarnapp.util.security.SecurityConstants.EXPORT_ENVIRONMENT_IDENTIFIER import de.rki.coronawarnapp.util.security.SecurityConstants.EXPORT_SIGNATURE_VERIFICATION_PUBLIC_KEYS +import timber.log.Timber import java.security.KeyFactory import java.security.Signature import java.security.spec.X509EncodedKeySpec @@ -38,10 +37,8 @@ class VerificationKeys { signature.getValidSignaturesForExport(export, signatureListBinary) .isEmpty() .also { - if (BuildConfig.DEBUG) { - if (it) Log.d(TAG, "export is invalid") - else Log.d(TAG, "export is valid") - } + if (it) Timber.d("export is invalid") + else Timber.d("export is valid") } } @@ -49,23 +46,34 @@ class VerificationKeys { export: ByteArray?, signatures: ByteArray? ) = getKeysForSignatureVerificationFilteredByEnvironment() - .flatMap { filteredIdAndKeyBinary -> - getTEKSignaturesForEnvironment(signatures) - .filter { signatureBinary -> - initVerify(filteredIdAndKeyBinary.value) + .filter { filteredIdAndPublicKeys -> + var verified = false + getTEKSignaturesForEnvironment(signatures).forEach { tek -> + filteredIdAndPublicKeys.value.forEach { publicKey -> + initVerify(publicKey) update(export) - verify(signatureBinary) + if (verify(tek)) verified = true } - .toList() + } + verified } - .also { Log.v(TAG, "${it.size} valid signatures found") } + .also { Timber.v("${it.size} valid signatures found") } private fun getKeysForSignatureVerificationFilteredByEnvironment() = verificationKeyProperties .entries - .associate { it.key as String to Base64.decode(it.value as String, Base64.DEFAULT) } - .mapValues { keyFactory.generatePublic(X509EncodedKeySpec(it.value)) } - .onEach { Log.v(TAG, "$it") } - .filterKeys { publicKeyIdentifier -> publicKeyIdentifier == EXPORT_ENVIRONMENT_IDENTIFIER } + .associate { + it.key as String to (it.value as String).split(",").mapNotNull { delimitedString -> + Base64.decode(delimitedString, Base64.DEFAULT) + }.map { binaryPublicKey -> + keyFactory.generatePublic( + X509EncodedKeySpec( + binaryPublicKey + ) + ) + } + } + .filterKeys { key -> key == BuildConfig.APPLICATION_ID } + .onEach { Timber.v("$it") } private fun getTEKSignaturesForEnvironment( signatureListBinary: ByteArray? @@ -73,7 +81,6 @@ class VerificationKeys { .parseFrom(signatureListBinary) .signaturesList .asSequence() - .filter { TEKSig -> TEKSig.signatureInfo.appBundleId == EXPORT_ENVIRONMENT_IDENTIFIER } - .onEach { Log.v(TAG, "$it") } + .onEach { Timber.v(it.toString()) } .mapNotNull { it.signature.toByteArray() } } diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/worker/BackgroundWorkScheduler.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/worker/BackgroundWorkScheduler.kt index bb7bf742c56..aaaa0d92c8c 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/worker/BackgroundWorkScheduler.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/worker/BackgroundWorkScheduler.kt @@ -1,6 +1,5 @@ package de.rki.coronawarnapp.worker -import android.util.Log import androidx.work.BackoffPolicy import androidx.work.ExistingPeriodicWorkPolicy import androidx.work.ExistingWorkPolicy @@ -15,6 +14,7 @@ import de.rki.coronawarnapp.storage.LocalData import org.joda.time.DateTime import org.joda.time.DateTimeZone import org.joda.time.Instant +import timber.log.Timber import java.util.concurrent.ExecutionException import java.util.concurrent.TimeUnit @@ -304,29 +304,23 @@ object BackgroundWorkScheduler { */ private fun Operation.logOperationSchedule(workType: WorkType) = this.result.addListener({ - if (BuildConfig.DEBUG) Log.d( - TAG, - "${workType.uniqueName} completed." - ) + Timber.d("${workType.uniqueName} completed.") }, { it.run() }) - .also { if (BuildConfig.DEBUG) Log.d(TAG, "${workType.uniqueName} scheduled.") } + .also { if (BuildConfig.DEBUG) Timber.d("${workType.uniqueName} scheduled.") } /** * Log operation cancellation */ private fun Operation.logOperationCancelByTag(workTag: WorkTag) = this.result.addListener({ - if (BuildConfig.DEBUG) Log.d( - TAG, - "All work with tag ${workTag.tag} canceled." - ) + Timber.d("All work with tag ${workTag.tag} canceled.") }, { it.run() }) - .also { if (BuildConfig.DEBUG) Log.d(TAG, "Canceling all work with tag ${workTag.tag}") } + .also { if (BuildConfig.DEBUG) Timber.d("Canceling all work with tag ${workTag.tag}") } /** * Log work active status */ private fun logWorkActiveStatus(tag: String, active: Boolean) { - if (BuildConfig.DEBUG) Log.d(TAG, "Work type $tag is active: $active") + if (BuildConfig.DEBUG) Timber.d("Work type $tag is active: $active") } } diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/worker/DiagnosisKeyRetrievalOneTimeWorker.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/worker/DiagnosisKeyRetrievalOneTimeWorker.kt index 3d00c7ce7d3..2e418ca126a 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/worker/DiagnosisKeyRetrievalOneTimeWorker.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/worker/DiagnosisKeyRetrievalOneTimeWorker.kt @@ -1,15 +1,14 @@ package de.rki.coronawarnapp.worker import android.content.Context -import android.util.Log import androidx.work.CoroutineWorker import androidx.work.WorkerParameters -import de.rki.coronawarnapp.BuildConfig import de.rki.coronawarnapp.storage.LocalData import de.rki.coronawarnapp.transaction.RetrieveDiagnosisKeysTransaction import org.joda.time.DateTime import org.joda.time.DateTimeZone import org.joda.time.Instant +import timber.log.Timber /** * One time diagnosis key retrieval work @@ -32,13 +31,10 @@ class DiagnosisKeyRetrievalOneTimeWorker(val context: Context, workerParams: Wor * @see RetrieveDiagnosisKeysTransaction */ override suspend fun doWork(): Result { - if (BuildConfig.DEBUG) Log.d(TAG, "Background job started. Run attempt: $runAttemptCount") + Timber.d("Background job started. Run attempt: $runAttemptCount") if (runAttemptCount > BackgroundConstants.WORKER_RETRY_COUNT_THRESHOLD) { - if (BuildConfig.DEBUG) Log.d( - TAG, - "Background job failed after $runAttemptCount attempts. Rescheduling" - ) + Timber.d("Background job failed after $runAttemptCount attempts. Rescheduling") return Result.failure() } var result = Result.success() diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/worker/DiagnosisKeyRetrievalPeriodicWorker.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/worker/DiagnosisKeyRetrievalPeriodicWorker.kt index 7188a72c54a..e69deb0c120 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/worker/DiagnosisKeyRetrievalPeriodicWorker.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/worker/DiagnosisKeyRetrievalPeriodicWorker.kt @@ -1,10 +1,9 @@ package de.rki.coronawarnapp.worker import android.content.Context -import android.util.Log import androidx.work.CoroutineWorker import androidx.work.WorkerParameters -import de.rki.coronawarnapp.BuildConfig +import timber.log.Timber /** * Periodic diagnosis key retrieval work @@ -29,13 +28,10 @@ class DiagnosisKeyRetrievalPeriodicWorker(val context: Context, workerParams: Wo * @see BackgroundWorkScheduler.scheduleDiagnosisKeyOneTimeWork() */ override suspend fun doWork(): Result { - if (BuildConfig.DEBUG) Log.d(TAG, "Background job started. Run attempt: $runAttemptCount") + Timber.d("Background job started. Run attempt: $runAttemptCount") if (runAttemptCount > BackgroundConstants.WORKER_RETRY_COUNT_THRESHOLD) { - if (BuildConfig.DEBUG) Log.d( - TAG, - "Background job failed after $runAttemptCount attempts. Rescheduling" - ) + Timber.d("Background job failed after $runAttemptCount attempts. Rescheduling") BackgroundWorkScheduler.scheduleDiagnosisKeyPeriodicWork() return Result.failure() } diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/worker/DiagnosisTestResultRetrievalPeriodicWorker.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/worker/DiagnosisTestResultRetrievalPeriodicWorker.kt index e1b40d62d61..3f57cdbd302 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/worker/DiagnosisTestResultRetrievalPeriodicWorker.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/worker/DiagnosisTestResultRetrievalPeriodicWorker.kt @@ -1,11 +1,9 @@ package de.rki.coronawarnapp.worker import android.content.Context -import android.util.Log import androidx.core.app.NotificationCompat import androidx.work.CoroutineWorker import androidx.work.WorkerParameters -import de.rki.coronawarnapp.BuildConfig import de.rki.coronawarnapp.CoronaWarnApplication import de.rki.coronawarnapp.R import de.rki.coronawarnapp.notification.NotificationHelper @@ -14,6 +12,7 @@ import de.rki.coronawarnapp.storage.LocalData import de.rki.coronawarnapp.util.TimeAndDateExtensions import de.rki.coronawarnapp.util.formatter.TestResult import de.rki.coronawarnapp.worker.BackgroundWorkScheduler.stop +import timber.log.Timber /** * Diagnosis Test Result Periodic retrieavl @@ -43,16 +42,10 @@ class DiagnosisTestResultRetrievalPeriodicWorker( */ override suspend fun doWork(): Result { - if (BuildConfig.DEBUG) Log.d( - TAG, - "Background job started. Run attempt: $runAttemptCount" - ) + Timber.d("Background job started. Run attempt: $runAttemptCount") if (runAttemptCount > BackgroundConstants.WORKER_RETRY_COUNT_THRESHOLD) { - if (BuildConfig.DEBUG) Log.d( - TAG, - "Background job failed after $runAttemptCount attempts. Rescheduling" - ) + Timber.d("Background job failed after $runAttemptCount attempts. Rescheduling") BackgroundWorkScheduler.scheduleDiagnosisKeyPeriodicWork() return Result.failure() } diff --git a/Corona-Warn-App/src/main/res/drawable-night/ic_illustration_test.xml b/Corona-Warn-App/src/main/res/drawable-night/ic_illustration_test.xml index 6e83eb3f1de..9472fc4720a 100644 --- a/Corona-Warn-App/src/main/res/drawable-night/ic_illustration_test.xml +++ b/Corona-Warn-App/src/main/res/drawable-night/ic_illustration_test.xml @@ -3,765 +3,451 @@ android:height="220dp" android:viewportWidth="360" android:viewportHeight="220"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Corona-Warn-App/src/main/res/drawable-night/ic_main_header.xml b/Corona-Warn-App/src/main/res/drawable-night/ic_main_header.xml index 99f802b0077..9e95a1a348c 100644 --- a/Corona-Warn-App/src/main/res/drawable-night/ic_main_header.xml +++ b/Corona-Warn-App/src/main/res/drawable-night/ic_main_header.xml @@ -1,103 +1,103 @@ + android:strokeColor="#00000000" /> + android:strokeColor="#00000000" /> + android:strokeColor="#00000000" /> + android:strokeColor="#00000000" /> + android:strokeColor="#00000000" /> + android:strokeColor="#00000000" /> + android:strokeColor="#00000000" /> + android:strokeColor="#00000000" /> + android:strokeColor="#00000000" /> + android:strokeColor="#00000000" /> + android:strokeColor="#00000000" /> + android:strokeColor="#00000000" /> + android:strokeColor="#00000000" /> + android:strokeColor="#00000000" /> + android:pathData="M18.444,25.873L18.444,29.004L18.599,29.16L18.665,29.104C19.124,29.358 19.436,29.846 19.436,30.408C19.436,31.232 18.77,31.899 17.948,31.899C17.127,31.899 16.461,31.232 16.461,30.408C16.461,29.759 16.875,29.209 17.453,29.004L17.453,26.131L17.608,26.028L17.453,25.873C16.183,25.768 15.026,25.263 14.108,24.484L11.899,26.698C12.163,27.252 12.067,27.935 11.609,28.394C11.029,28.976 10.087,28.976 9.506,28.394C8.925,27.812 8.925,26.868 9.506,26.286C9.964,25.827 10.645,25.731 11.198,25.996L13.407,23.782C12.677,22.917 12.189,21.842 12.045,20.659L12.177,20.585L12.022,20.429L8.897,20.429C8.693,21.008 8.144,21.423 7.497,21.423C6.675,21.423 6.009,20.756 6.009,19.932C6.009,19.109 6.675,18.442 7.497,18.442C8.144,18.442 8.693,18.857 8.897,19.435L9.053,19.591L9.204,19.435L12.022,19.435C12.126,18.162 12.63,17.003 13.407,16.083L11.198,13.869C10.645,14.133 9.964,14.037 9.506,13.579C8.925,12.996 8.925,12.053 9.506,11.47C10.087,10.888 11.029,10.888 11.609,11.47C12.067,11.929 12.163,12.612 11.899,13.166L14.108,15.38C15.026,14.601 16.183,14.097 17.453,13.992L17.453,11.079L17.608,11.016L17.453,10.86C16.875,10.655 16.461,10.105 16.461,9.456C16.461,8.633 17.127,7.966 17.948,7.966C18.77,7.966 19.436,8.633 19.436,9.456C19.436,10.105 19.021,10.655 18.444,10.86L18.444,13.992L18.599,14.147L18.721,14.021C20.054,14.195 21.249,14.811 22.154,15.717L30.568,7.283C27.338,4.046 22.877,2.044 17.948,2.044C8.092,2.044 0.101,10.053 0.101,19.932C0.101,29.812 8.092,37.82 17.948,37.82C22.877,37.82 27.338,35.818 30.568,32.581L22.154,24.147C21.187,25.116 19.889,25.753 18.444,25.873Z" + android:strokeColor="#00000000"> + android:fillType="nonZero" + android:strokeColor="#00000000"> + + + diff --git a/Corona-Warn-App/src/main/res/drawable-night/ic_submission_illustration_hotline.xml b/Corona-Warn-App/src/main/res/drawable-night/ic_submission_illustration_hotline.xml new file mode 100644 index 00000000000..6731208ebc9 --- /dev/null +++ b/Corona-Warn-App/src/main/res/drawable-night/ic_submission_illustration_hotline.xml @@ -0,0 +1,90 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/Corona-Warn-App/src/main/res/drawable-night/ic_submission_illustration_other_warning.xml b/Corona-Warn-App/src/main/res/drawable-night/ic_submission_illustration_other_warning.xml index f1175f21d2d..814323b348e 100644 --- a/Corona-Warn-App/src/main/res/drawable-night/ic_submission_illustration_other_warning.xml +++ b/Corona-Warn-App/src/main/res/drawable-night/ic_submission_illustration_other_warning.xml @@ -1,396 +1,200 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Corona-Warn-App/src/main/res/drawable/ic_illustration_notification_on.xml b/Corona-Warn-App/src/main/res/drawable/ic_illustration_notification_on.xml index 5b686c5d3e9..638af240aa2 100644 --- a/Corona-Warn-App/src/main/res/drawable/ic_illustration_notification_on.xml +++ b/Corona-Warn-App/src/main/res/drawable/ic_illustration_notification_on.xml @@ -1,288 +1,125 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Corona-Warn-App/src/main/res/drawable/ic_illustration_test.xml b/Corona-Warn-App/src/main/res/drawable/ic_illustration_test.xml index 1d609172114..4ded908d3ff 100644 --- a/Corona-Warn-App/src/main/res/drawable/ic_illustration_test.xml +++ b/Corona-Warn-App/src/main/res/drawable/ic_illustration_test.xml @@ -3,764 +3,499 @@ android:height="220dp" android:viewportWidth="360" android:viewportHeight="220"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Corona-Warn-App/src/main/res/drawable/ic_main_header.xml b/Corona-Warn-App/src/main/res/drawable/ic_main_header.xml index 7eb6941f8c2..3f5232bebd5 100644 --- a/Corona-Warn-App/src/main/res/drawable/ic_main_header.xml +++ b/Corona-Warn-App/src/main/res/drawable/ic_main_header.xml @@ -1,136 +1,136 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Corona-Warn-App/src/main/res/drawable/ic_main_illustration_invalid.xml b/Corona-Warn-App/src/main/res/drawable/ic_main_illustration_invalid.xml index e500c0fdc7f..99ec42e2ccf 100644 --- a/Corona-Warn-App/src/main/res/drawable/ic_main_illustration_invalid.xml +++ b/Corona-Warn-App/src/main/res/drawable/ic_main_illustration_invalid.xml @@ -1,123 +1,75 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - + android:width="110.25dp" + android:height="140dp" + android:viewportWidth="110.25" + android:viewportHeight="140"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Corona-Warn-App/src/main/res/drawable/ic_main_illustration_untested.xml b/Corona-Warn-App/src/main/res/drawable/ic_main_illustration_untested.xml index 689a88108c7..b6561105231 100644 --- a/Corona-Warn-App/src/main/res/drawable/ic_main_illustration_untested.xml +++ b/Corona-Warn-App/src/main/res/drawable/ic_main_illustration_untested.xml @@ -1,92 +1,41 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + android:width="110.28dp" + android:height="140dp" + android:viewportWidth="110.28" + android:viewportHeight="140"> + + + + + + + + diff --git a/Corona-Warn-App/src/main/res/drawable/ic_settings_illustration_notification_off.xml b/Corona-Warn-App/src/main/res/drawable/ic_settings_illustration_notification_off.xml index 14306fc0305..909604effb6 100644 --- a/Corona-Warn-App/src/main/res/drawable/ic_settings_illustration_notification_off.xml +++ b/Corona-Warn-App/src/main/res/drawable/ic_settings_illustration_notification_off.xml @@ -1,290 +1,122 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Corona-Warn-App/src/main/res/drawable/ic_settings_notification_circle.xml b/Corona-Warn-App/src/main/res/drawable/ic_settings_notification_circle.xml new file mode 100644 index 00000000000..883d65c56a2 --- /dev/null +++ b/Corona-Warn-App/src/main/res/drawable/ic_settings_notification_circle.xml @@ -0,0 +1,18 @@ + + + + diff --git a/Corona-Warn-App/src/main/res/drawable/ic_submission_illustration_hotline.xml b/Corona-Warn-App/src/main/res/drawable/ic_submission_illustration_hotline.xml new file mode 100644 index 00000000000..580c4fc2057 --- /dev/null +++ b/Corona-Warn-App/src/main/res/drawable/ic_submission_illustration_hotline.xml @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Corona-Warn-App/src/main/res/layout/fragment_information.xml b/Corona-Warn-App/src/main/res/layout/fragment_information.xml index 959f7754c12..edef7239dd8 100644 --- a/Corona-Warn-App/src/main/res/layout/fragment_information.xml +++ b/Corona-Warn-App/src/main/res/layout/fragment_information.xml @@ -112,14 +112,21 @@ + + diff --git a/Corona-Warn-App/src/main/res/layout/fragment_information_legal.xml b/Corona-Warn-App/src/main/res/layout/fragment_information_legal.xml index 0394c277723..8a22098c9a0 100644 --- a/Corona-Warn-App/src/main/res/layout/fragment_information_legal.xml +++ b/Corona-Warn-App/src/main/res/layout/fragment_information_legal.xml @@ -65,16 +65,26 @@ app:layout_constraintStart_toEndOf="@+id/guideline_start" app:layout_constraintTop_toBottomOf="@+id/information_legal_header_details" /> + + + app:layout_constraintTop_toBottomOf="@+id/information_legal_divider_contact" /> + + + app:layout_constraintTop_toBottomOf="@+id/information_legal_divider_taxid" /> + app:body="@{@string/settings_notifications_body_inactive}" + app:buttonText="@{@string/settings_notifications_button_open_settings}" + app:headline="@{@string/settings_notifications_headline_card}" + app:icon="@{@drawable/ic_settings_notification_circle}" + app:layout_constraintEnd_toStartOf="@+id/guideline_card_end" + app:layout_constraintStart_toStartOf="@+id/guideline_card_start" + app:layout_constraintTop_toBottomOf="@+id/settings_switch_row_notifications_test" /> + + diff --git a/Corona-Warn-App/src/main/res/layout/fragment_settings_reset.xml b/Corona-Warn-App/src/main/res/layout/fragment_settings_reset.xml index 9ce4584a352..1c5c5143cf9 100644 --- a/Corona-Warn-App/src/main/res/layout/fragment_settings_reset.xml +++ b/Corona-Warn-App/src/main/res/layout/fragment_settings_reset.xml @@ -51,7 +51,6 @@ android:layout_height="wrap_content" android:layout_marginTop="@dimen/spacing_medium" app:body="@{@string/settings_reset_body_keys}" - app:buttonText="@{@string/settings_tracing_status_connection_button}" app:headline="@{@string/settings_reset_headline_keys}" app:icon="@{@drawable/ic_settings_reset_circle}" app:layout_constraintEnd_toStartOf="@+id/guideline_card_end" diff --git a/Corona-Warn-App/src/main/res/layout/fragment_submission_positive_other_warning.xml b/Corona-Warn-App/src/main/res/layout/fragment_submission_positive_other_warning.xml index 9abda2c0f73..6a827d2f8e5 100644 --- a/Corona-Warn-App/src/main/res/layout/fragment_submission_positive_other_warning.xml +++ b/Corona-Warn-App/src/main/res/layout/fragment_submission_positive_other_warning.xml @@ -26,8 +26,10 @@ android:layout_height="@dimen/match_constraint" app:layout_constraintBottom_toTopOf="@+id/guideline_action" app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@+id/submission_positive_other_warning_header" /> + app:layout_constraintHorizontal_bias="0.0" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/submission_positive_other_warning_header" + app:layout_constraintVertical_bias="0.0" />