Commit e2c7ae6e authored by Harri Kirik's avatar Harri Kirik
Browse files

Merge branch 'feature/COVAPP-480-sync' into 'develop'

Update the DP-3T SDK

See merge request hoia/dp3t-app-android!139
parents 2c495781 9eeafa8c
......@@ -17,11 +17,12 @@
| 28.04.2021 | Harri Kirik | Added the detekt library. Updated the DP-3D SDK version. |
| 06.05.2021 | Harri Kirik | Updated the version of the DP-3T SDK. |
| 10.05.2021 | Aleks Krause | Updated the versions of the most libraries to up to date versions. |
| 21.07.2021 | Harri Kirik | Updated the DP-3T version and the versions of the dependencies of DP-3T. |
## Licenses
### dp3t-sdk-android
Version: 2.2.0.b1-EE-PRODUCTION
Version: 2.3.1.b1-EE-PRODUCTION
https://github.com/DP-3T/dp3t-sdk-android
License: https://github.com/DP-3T/dp3t-sdk-android/blob/master-alpha/LICENSE
Changelog: https://github.com/DP-3T/dp3t-sdk-android/blob/master-alpha/CHANGELOG.md
......@@ -49,6 +50,7 @@ Changelog: https://github.com/junit-team/junit4/releases
Version: 1.3.72
https://kotlinlang.org
License: https://github.com/JetBrains/kotlin-web-site/blob/master/LICENSE
### Mockito
Version: 3.9.0
https://github.com/mockito/mockito
......@@ -173,16 +175,26 @@ Version: 1.1.0-alpha03
https://developer.android.com/jetpack/androidx/releases/security
License: https://developer.android.com/license
Changelog: https://developer.android.com/jetpack/androidx/releases/security
### Play services
### Play Services Base
Version: 17.6.0
https://developers.google.com/android/guides/overview
License: https://developer.android.com/license
Changelog: https://developers.google.com/android/guides/releases
### Play Services Tasks
Version: 17.2.1
https://developers.google.com/android/guides/overview
License: https://developer.android.com/license
Changelog: https://developers.google.com/android/guides/releases
### Dagger
Version: 2.35.1
https://github.com/google/dagger
License: https://github.com/google/dagger/blob/master/LICENSE.txt
Changelog: https://github.com/google/dagger/blob/master/CHANGELOG.md
### GSON
Version: 2.8.6
https://github.com/google/gson
......
......@@ -172,6 +172,7 @@ dependencies {
implementation deps.eventBus
implementation deps.playServicesBase
implementation deps.playServicesTasks
implementation project(':lib_mvvm')
......
......@@ -76,7 +76,7 @@ class DebugMenuFragment : MvvmFragment(), ViewBindingHolder<FragmentDebugBinding
requireBinding().buttonBack.setOnClickListener { findNavController().popBackStack() }
setupSdkViews()
setupStateOptions()
setupAppScreens()
setupDebugButtons()
setupLogActions()
initViewModel()
}
......@@ -157,6 +157,7 @@ class DebugMenuFragment : MvvmFragment(), ViewBindingHolder<FragmentDebugBinding
}
}
updateRadioGroup(optionsGroup)
updateButtonStatesBasedOnTheDebugState()
}
private fun updateRadioGroup(optionsGroup: RadioGroup) {
......@@ -169,7 +170,22 @@ class DebugMenuFragment : MvvmFragment(), ViewBindingHolder<FragmentDebugBinding
optionsGroup.check(preSetId)
}
private fun setupAppScreens() {
private fun updateButtonStatesBasedOnTheDebugState() {
when (getDebugAppState()) {
DebugAppState.NONE -> enableButtonDebugDp3tSync(true)
DebugAppState.HEALTHY -> enableButtonDebugDp3tSync(false)
DebugAppState.CONTACT_EXPOSED -> enableButtonDebugDp3tSync(false)
DebugAppState.REPORTED_EXPOSED -> enableButtonDebugDp3tSync(false)
}.exhaustive
}
private fun enableButtonDebugDp3tSync(enabled: Boolean) {
requireBinding {
buttonDebugDp3tSync.isEnabled = enabled
}
}
private fun setupDebugButtons() {
requireBinding {
buttonDebugStateErrorDialog.setOnClickListener { showDebugStateErrorDialog() }
buttonDebugStateContactNotification.setOnClickListener { notifier.createNewContactNotification(requireActivity(), -1) }
......@@ -178,6 +194,7 @@ class DebugMenuFragment : MvvmFragment(), ViewBindingHolder<FragmentDebugBinding
buttonDebugStateShareScreenSuccess.setOnClickListener { showShareSuccessScreen() }
buttonDebugStateOpenSettingsAndScrollToCrossCountry.setOnClickListener { openSettingsAndScrollToCrossCountry() }
buttonDebugStateCrossCountryPopUp.setOnClickListener { openCrossCountryPopUp() }
buttonDebugDp3tSync.setOnClickListener { viewModel.startDP3TSyncClicked() }
}
}
......@@ -272,6 +289,7 @@ class DebugMenuFragment : MvvmFragment(), ViewBindingHolder<FragmentDebugBinding
private fun setDebugAppState(debugAppState: DebugAppState) {
(tracingViewModel.tracingStatusInterface as TracingStatusWrapper).setDebugAppState(context, debugAppState)
updateButtonStatesBasedOnTheDebugState()
}
private fun openSettingsAndScrollToCrossCountry() {
......
......@@ -2,13 +2,21 @@ package org.dpppt.android.app.debug.debugmenu
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import io.reactivex.rxjava3.disposables.Disposable
import mobi.lab.mvvm.Event
import org.dpppt.android.app.common.util.asLiveData
import org.dpppt.android.app.common.util.backgroundToMain
import org.dpppt.android.app.domain.usecase.dp3t.GaenSyncUseCase
import org.dpppt.android.app.util.dispose
import timber.log.Timber
import javax.inject.Inject
class DebugMenuViewModel @Inject constructor() : ViewModel() {
class DebugMenuViewModel @Inject constructor(
private val syncUseCase: GaenSyncUseCase
) : ViewModel() {
private val _action = MutableLiveData<Event<Action>>()
val action = _action.asLiveData()
private var dp3tSyncDisposable: Disposable? = null
fun postCurrentDevelopmentLogClicked() {
_action.value = Event(Action.PostCurrentDevelopmentLog)
......@@ -22,6 +30,17 @@ class DebugMenuViewModel @Inject constructor() : ViewModel() {
_action.value = Event(Action.ShowLogAccessError(error))
}
fun startDP3TSyncClicked() {
Timber.d("Sync start called")
dispose(dp3tSyncDisposable)
dp3tSyncDisposable = syncUseCase.execute()
.backgroundToMain()
.subscribe(
{ Timber.d("Sync success") },
{ error -> Timber.e(error, "Sync error") }
)
}
sealed class Action {
object PostCurrentDevelopmentLog : Action()
object ViewAllDevelopmentLogs : Action()
......
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/gray2" android:state_enabled="false"/>
<item android:color="@color/blue"/>
</selector>
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/white"/>
</selector>
......@@ -62,8 +62,7 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/size_16">
android:layout_height="wrap_content">
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guide_start"
......@@ -217,7 +216,23 @@
app:layout_constraintEnd_toEndOf="@id/guide_end"
app:layout_constraintStart_toStartOf="@id/guide_start"
app:layout_constraintTop_toBottomOf="@id/sdk_version_text"
app:layout_constraintBottom_toBottomOf="parent" />
app:layout_constraintBottom_toTopOf="@id/buttonDebugDp3tSync" />
<com.google.android.material.button.MaterialButton
android:id="@+id/buttonDebugDp3tSync"
style="@style/AppTheme.Button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constrainedWidth="true"
android:layout_gravity="center_horizontal"
android:layout_marginTop="@dimen/size_24"
android:layout_marginBottom="@dimen/size_24"
android:text="@string/debug_state_button_dp3t_sync"
app:layout_constraintTop_toBottomOf="@id/sdk_errors"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@id/guide_end"
app:layout_constraintStart_toStartOf="@id/guide_start" />
</androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView>
......
......@@ -224,4 +224,5 @@ Aitäh, et hoiad lähedasi."</string>
<string name="settings_cross_country_description_blue_part">"Tutvu riikide nimekirja ja tööpõhimõttega siin."</string>
<string name="contacts_detected_text_health_board_thanks_you">"Terviseamet tänab sind panuse eest!"</string>
<string name="debug_state_show_share_screen_success">"Eduka võtmete jagamise ekraan"</string>
<string name="debug_state_button_dp3t_sync">"Sünkroniseeri DP-3Tga"</string>
</resources>
......@@ -219,4 +219,5 @@ Thank you for keeping people close to you safe."</string>
<string name="settings_cross_country_description_blue_part">"See this for more information and the list of supported countries."</string>
<string name="contacts_detected_text_health_board_thanks_you">"The Estonian Health Board thanks you for your contribution!"</string>
<string name="debug_state_show_share_screen_success">"Share keys success screen"</string>
<string name="debug_state_button_dp3t_sync">"Synchronize with DP-3T"</string>
</resources>
......@@ -263,7 +263,8 @@
<item name="android:paddingStart">@dimen/size_24</item>
<item name="android:paddingEnd">@dimen/size_24</item>
<item name="android:textSize">@dimen/text_size_12</item>
<item name="backgroundTint">@color/blue</item>
<item name="backgroundTint">@color/color_background_primary_button</item>
<item name="android:textColor">@color/color_text_primary_button</item>
</style>
<style name="AppTheme.Button.Short">
......
......@@ -9,7 +9,7 @@ ext.androidVersions = [
def versions = [
// DP-3T
// See https://repo.tehik.ee/artifactory/contact-tracing-maven/org/dpppt/dp3t-sdk-android/{VERSION}/dp3t-sdk-android-{VERSION}.pom
dp3tSDKAndroidEE : '2.2.0.b1-EE-PRODUCTION',
dp3tSDKAndroidEE : '2.3.1.b1-EE-PRODUCTION',
// BuildScript
kotlin : '1.5.0',
......@@ -60,6 +60,7 @@ def versions = [
rxAndroid : '3.0.0',
securityCrypto : '1.1.0-alpha03',
playServicesBase : '17.6.0',
playServicesTasks : '17.2.1',
dagger : '2.35.1',
eventBus : '3.2.0',
jsonwebtoken : '0.11.2',
......@@ -121,6 +122,7 @@ ext.deps = [
workRuntime : "androidx.work:work-runtime:${versions.workRuntime}",
securityCrypto : "androidx.security:security-crypto:${versions.securityCrypto}",
playServicesBase : "com.google.android.gms:play-services-base:${versions.playServicesBase}",
playServicesTasks : "com.google.android.gms:play-services-tasks:${versions.playServicesTasks}",
eventBus : "org.greenrobot:eventbus:${versions.eventBus}",
jsonwebtokenAPI : "io.jsonwebtoken:jjwt-api:${versions.jsonwebtoken}",
jsonwebtokenImpl : "io.jsonwebtoken:jjwt-impl:${versions.jsonwebtoken}",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment