Skip to content
This repository has been archived by the owner on Dec 7, 2022. It is now read-only.

Commit

Permalink
Add stub CdnService to turn off the app completely
Browse files Browse the repository at this point in the history
  • Loading branch information
hvisser committed Sep 14, 2022
1 parent cf2b4c5 commit 2ec9c47
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* Copyright (c) 2020 De Staat der Nederlanden, Ministerie van Volksgezondheid, Welzijn en Sport.
* Licensed under the EUROPEAN UNION PUBLIC LICENCE v. 1.2
*
* SPDX-License-Identifier: EUPL-1.2
*/
package nl.rijksoverheid.en.applifecycle.service

import nl.rijksoverheid.en.api.CacheStrategy
import nl.rijksoverheid.en.api.CdnService
import nl.rijksoverheid.en.api.model.AppConfig
import nl.rijksoverheid.en.api.model.Manifest
import nl.rijksoverheid.en.api.model.ResourceBundle
import nl.rijksoverheid.en.api.model.RiskCalculationParameters
import okhttp3.ResponseBody
import retrofit2.Response

/**
* Stub implementation of [CdnService] that produces the appropriate response for the app
* to show that is has been deactivated without hitting the server.
*/
class EndOfLifeCdnService : CdnService {
override suspend fun getExposureKeySetFile(id: String): Response<ResponseBody> {
throw NotImplementedError()
}

override suspend fun getManifest(cacheStrategy: CacheStrategy?): Manifest {
return Manifest(emptyList(), "", "end-of-life-id")
}

override suspend fun getRiskCalculationParameters(
id: String,
cacheStrategy: CacheStrategy?
): RiskCalculationParameters {
throw NotImplementedError()
}

override suspend fun getAppConfig(id: String, cacheStrategy: CacheStrategy?): AppConfig {
return AppConfig(coronaMelderDeactivated = "deactivated")
}

override suspend fun getResourceBundle(
id: String,
cacheStrategy: CacheStrategy?
): ResourceBundle {
throw NotImplementedError()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import nl.rijksoverheid.en.ExposureNotificationsRepository
import nl.rijksoverheid.en.api.CdnService
import nl.rijksoverheid.en.api.LabTestService
import nl.rijksoverheid.en.applifecycle.AppLifecycleManager
import nl.rijksoverheid.en.applifecycle.service.EndOfLifeCdnService
import nl.rijksoverheid.en.beagle.debugDrawer
import nl.rijksoverheid.en.config.AppConfigManager
import nl.rijksoverheid.en.enapi.nearby.NearbyExposureNotificationApi
Expand Down Expand Up @@ -183,8 +184,6 @@ object RepositoryFactory {
}

private fun getCdnService(context: Context): CdnService {
return cdnService ?: CdnService.create(context, BuildConfig.VERSION_CODE).also {
cdnService = it
}
return EndOfLifeCdnService()
}
}
1 change: 0 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ allprojects {
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
kotlinOptions {
jvmTarget = "1.8"
allWarningsAsErrors = true
}
}

Expand Down

0 comments on commit 2ec9c47

Please sign in to comment.