This repository has been archived by the owner on Jun 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 495
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Setup `Eol` * Add Settings * Dev Settings * Home Screen proofing * Stats * Analytics * Lint * Cwa App stop inits * Restart * Notifications * FAQ card * Cancel worker * Card in Home * Tests * Lint * Fix stats * fix tests * Notification * EOL - Recycle Bin (EXPOSUREAPP-14793) (#5846) * EOL - certificates (EXPOSUREAPP-14790) (#5849) * add eol config * add eol config * Travel Validity Button toggle for certificate details * EOL - Background Work (EXPOSUREAPP-14794) (#5852) * Stop Dcc Wallet info * App starter * Update AppStarterTest.kt * EOL - onboarding (EXPOSUREAPP-14788) (#5851) * Skip onboarding screens for EOL. * Fix test * Check eol directly in vm. * Eol bottom bar (EXPOSUREAPP-14791) (#5853) * add eol bottom navigation menu * hide / show flags * Update MainActivity.kt --------- Co-authored-by: Mohamed <[email protected]> * EOL - Battery optimization / tracing dialogs * EOL - Disable deep-links (#5855) * EOL - error logs (EXPOSUREAPP-14837) (#5857) * Disable ENF / Logger * lint * EOL - notifications (EXPOSUREAPP-14795) (#5854) * Stop Dcc Wallet info * App starter * Update AppStarterTest.kt * Person badges * Remove unwanted trigger * Block notifications * Revert "Block notifications" This reverts commit 30f91d6. * Hide badges * Badge in person * Trigger only if not EOL * Lint * Hide options in menu and app information. (#5858) * EOL - Shortcuts (EXPOSUREAPP-14804) (#5859) * EOL- shortcuts * Setup bottom nav early * Lint * Test * Update AppEolTest.kt --------- Co-authored-by: Nikolaus Schauersberger <[email protected]> Co-authored-by: Alex Paulescu <[email protected]>
- Loading branch information
1 parent
5fd61d8
commit 7c70a4d
Showing
64 changed files
with
1,168 additions
and
215 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
101 changes: 101 additions & 0 deletions
101
Corona-Warn-App/src/deviceForTesters/java/de/rki/coronawarnapp/test/eol/EolTestFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
package de.rki.coronawarnapp.test.eol | ||
|
||
import android.os.Bundle | ||
import android.text.format.DateFormat | ||
import android.view.View | ||
import androidx.fragment.app.Fragment | ||
import com.google.android.material.datepicker.MaterialDatePicker | ||
import com.google.android.material.timepicker.MaterialTimePicker | ||
import com.google.android.material.timepicker.TimeFormat | ||
import com.jakewharton.processphoenix.ProcessPhoenix | ||
import de.rki.coronawarnapp.R | ||
import de.rki.coronawarnapp.databinding.FragmentTestEolBinding | ||
import de.rki.coronawarnapp.test.menu.ui.TestMenuItem | ||
import de.rki.coronawarnapp.ui.dialog.displayDialog | ||
import de.rki.coronawarnapp.util.di.AutoInject | ||
import de.rki.coronawarnapp.util.ui.viewBinding | ||
import de.rki.coronawarnapp.util.viewmodel.CWAViewModelFactoryProvider | ||
import de.rki.coronawarnapp.util.viewmodel.cwaViewModels | ||
import java.time.Instant | ||
import java.time.LocalTime | ||
import java.time.ZoneId | ||
import javax.inject.Inject | ||
|
||
class EolTestFragment : Fragment(R.layout.fragment_test_eol), AutoInject { | ||
|
||
@Inject lateinit var viewModelFactory: CWAViewModelFactoryProvider.Factory | ||
|
||
private val viewModel: EolTestViewModel by cwaViewModels { viewModelFactory } | ||
private val binding: FragmentTestEolBinding by viewBinding() | ||
|
||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||
super.onViewCreated(view, savedInstanceState) | ||
|
||
viewModel.dateTime.observe(viewLifecycleOwner) { | ||
binding.dateTime.text = it.toString() | ||
} | ||
|
||
viewModel.restart.observe(viewLifecycleOwner) { | ||
displayDialog { | ||
title("Restarting ↻") | ||
message("EOL will be fully effective after restart") | ||
setCancelable(false) | ||
} | ||
ProcessPhoenix.triggerRebirth(context) | ||
} | ||
|
||
binding.openPicket.setOnClickListener { showDatePicker() } | ||
} | ||
|
||
private fun showDatePicker() { | ||
MaterialDatePicker | ||
.Builder | ||
.datePicker() | ||
.setSelection(Instant.now().toEpochMilli()) | ||
.build() | ||
.apply { | ||
addOnPositiveButtonClickListener { date -> | ||
showTimePicker { time -> | ||
viewModel.updateEolDateTime( | ||
Instant.ofEpochMilli(date) | ||
.atZone(ZoneId.systemDefault()) | ||
.toLocalDate() | ||
.atTime(time.hour, time.minute) | ||
.atZone(ZoneId.of("CET")) | ||
) | ||
} | ||
} | ||
} | ||
.show(childFragmentManager, "eol.test.date.picker") | ||
} | ||
|
||
private fun showTimePicker( | ||
defaultValue: LocalTime = LocalTime.now(), | ||
callback: (LocalTime) -> Unit | ||
) { | ||
MaterialTimePicker | ||
.Builder() | ||
.setTimeFormat( | ||
if (DateFormat.is24HourFormat(requireContext())) TimeFormat.CLOCK_24H else TimeFormat.CLOCK_12H | ||
) | ||
.apply { | ||
setHour(defaultValue.hour) | ||
setMinute(defaultValue.minute) | ||
} | ||
.build() | ||
.apply { | ||
addOnPositiveButtonClickListener { | ||
callback(LocalTime.of(hour, minute)) | ||
} | ||
} | ||
.show(childFragmentManager, "eol.test.time.picker") | ||
} | ||
|
||
companion object { | ||
val MENU_ITEM = TestMenuItem( | ||
title = "EOl Date Time", | ||
description = "End of Life Dev Settings", | ||
targetId = R.id.eolTestFragment | ||
) | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
Corona-Warn-App/src/deviceForTesters/java/de/rki/coronawarnapp/test/eol/EolTestModule.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package de.rki.coronawarnapp.test.eol | ||
|
||
import dagger.Binds | ||
import dagger.Module | ||
import dagger.multibindings.IntoMap | ||
import de.rki.coronawarnapp.util.viewmodel.CWAViewModel | ||
import de.rki.coronawarnapp.util.viewmodel.CWAViewModelFactory | ||
import de.rki.coronawarnapp.util.viewmodel.CWAViewModelKey | ||
|
||
@Module | ||
abstract class EolTestModule { | ||
@Binds | ||
@IntoMap | ||
@CWAViewModelKey(EolTestViewModel::class) | ||
abstract fun eolTest(factory: EolTestViewModel.Factory): CWAViewModelFactory<out CWAViewModel> | ||
} |
25 changes: 25 additions & 0 deletions
25
Corona-Warn-App/src/deviceForTesters/java/de/rki/coronawarnapp/test/eol/EolTestViewModel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package de.rki.coronawarnapp.test.eol | ||
|
||
import dagger.assisted.AssistedFactory | ||
import dagger.assisted.AssistedInject | ||
import de.rki.coronawarnapp.eol.EolSetting | ||
import de.rki.coronawarnapp.util.ui.SingleLiveEvent | ||
import de.rki.coronawarnapp.util.viewmodel.CWAViewModel | ||
import de.rki.coronawarnapp.util.viewmodel.SimpleCWAViewModelFactory | ||
import java.time.ZonedDateTime | ||
|
||
class EolTestViewModel @AssistedInject constructor( | ||
private val eolSetting: EolSetting | ||
) : CWAViewModel() { | ||
|
||
val dateTime = eolSetting.eolDateTime.asLiveData2() | ||
val restart = SingleLiveEvent<Unit>() | ||
|
||
fun updateEolDateTime(dateTime: ZonedDateTime) = launch { | ||
eolSetting.setEolDateTime(dateTime.toString()) | ||
restart.postValue(Unit) | ||
} | ||
|
||
@AssistedFactory | ||
interface Factory : SimpleCWAViewModelFactory<EolTestViewModel> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
Corona-Warn-App/src/deviceForTesters/res/layout/fragment_test_eol.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
|
||
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
tools:ignore="HardcodedText"> | ||
|
||
<LinearLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:layout_margin="@dimen/margin_8" | ||
android:orientation="vertical"> | ||
|
||
<LinearLayout | ||
style="@style/Card" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_margin="@dimen/margin_8" | ||
android:orientation="vertical"> | ||
|
||
<TextView | ||
style="@style/headline6" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:text="EOL Date Time" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" /> | ||
|
||
|
||
<TextView | ||
android:id="@+id/date_time" | ||
style="@style/body1Medium" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_marginVertical="10dp" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" /> | ||
|
||
<Button | ||
android:id="@+id/open_picket" | ||
style="@style/buttonPrimary" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="@dimen/margin_16" | ||
android:text="Open Picker" /> | ||
|
||
</LinearLayout> | ||
|
||
</LinearLayout> | ||
</androidx.core.widget.NestedScrollView> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.