Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ ktlint_standard_blank-line-before-declaration=disabled
ktlint_standard_multiline-expression-wrapping = disabled
ktlint_standard_string-template-indent = disabled
ktlint_function_signature_body_expression_wrapping = default
ktlint_function_naming_ignore_when_annotated_with = Composable
14 changes: 8 additions & 6 deletions buildSrc/src/main/java/Dependency.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
object BuildPlugin {
object Version {
const val gradlePlugin = "8.10.1"
const val kotlin = "1.9.22"
const val kotlin = "1.9.25"
const val googleServices = "4.4.2"
const val crashlytics = "2.9.9"
}
Expand Down Expand Up @@ -136,7 +136,7 @@ object Firebase {

object Kotlin {
object Version {
const val kotlin = "1.9.22"
const val kotlin = "1.9.25"
}

const val test = "org.jetbrains.kotlin:kotlin-test-junit:${Version.kotlin}"
Expand Down Expand Up @@ -180,17 +180,19 @@ object Hilt {

object Compose {
object Version {
const val core = "1.6.7"
const val core = "1.10.0"
const val materialIcons = "1.7.8"
const val lifecycleRuntime = "2.7.0"
const val activity = "1.9.0"
const val compiler = "1.5.10"
const val compiler = "1.5.15"
}

const val ui = "androidx.compose.ui:ui:${Version.core}"
const val material = "androidx.compose.material:material:${Version.core}"
const val materialIconsExtended = "androidx.compose.material:material-icons-extended:${Version.materialIcons}"
const val uiToolingPreview = "androidx.compose.ui:ui-tooling-preview:${Version.core}"
const val lifecycleRuntimeKtx = "androidx.lifecycle:lifecycle-runtime-ktx:${Version.lifecycleRuntime}"
const val activity = "androidx.activity:activity-compose:${Version.activity}"
const val uiTestJunit4 = "androidx.compose.ui:ui-test-junit4:${Version.core}"
const val runtimeLiveData = "androidx.compose.runtime:runtime-livedata:${Version.core}"
}

object Desugar {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ internal class TaskDetailsViewModel(
private val dispatcherProvider: DispatcherProvider = DefaultDispatcherProvider,
) : BaseViewModel<TaskDetailsViewState, TaskDetailsViewIntent>() {
private var selectedProgressRange = TaskProgressRange.LAST_YEAR
private var shouldShowProgress = false
private var shouldShowProgressGrid = false
private var shouldShowMetrics = false
private var currentAlarm: Alarm? = null
private var progressJob: Job? = null
private val progressCache: MutableMap<TaskProgressRange, List<TaskProgressDay>> = mutableMapOf()
Expand Down Expand Up @@ -94,15 +95,21 @@ internal class TaskDetailsViewModel(

viewState.taskDetails.postValue(taskDetails)

shouldShowProgress = false
shouldShowProgressGrid = false
shouldShowMetrics = false
val taskMetrics: TaskMetrics? =
task.alarm?.run {
shouldShowProgress = RepeatType.isAlarmRepeating(this)
if (shouldShowProgress) {
val repeatType = repeatType
shouldShowMetrics = RepeatType.isAlarmRepeating(this)
shouldShowProgressGrid =
shouldShowMetrics && repeatType != RepeatType.MONTH && repeatType != RepeatType.YEAR

if (shouldShowMetrics) {
val taskMetrics = getTaskMetricsUseCase(historyFilterForRange())
return@run taskMetrics.getOrNull()
}
shouldShowProgress = false
shouldShowMetrics = false
shouldShowProgressGrid = false
return@run null
}

Expand All @@ -129,7 +136,7 @@ internal class TaskDetailsViewModel(
}

private fun loadProgress(force: Boolean = false) {
val shouldFetch = force || shouldShowProgress
val shouldFetch = force || shouldShowProgressGrid
if (shouldFetch.not()) {
viewState.taskProgressDays.postValue(emptyList())
viewState.taskProgressLoading.postValue(false)
Expand Down Expand Up @@ -173,7 +180,7 @@ internal class TaskDetailsViewModel(
}

private fun loadTaskMetrics() = viewModelScope.launch {
if (shouldShowProgress.not()) {
if (shouldShowMetrics.not()) {
viewState.taskMetrics.postValue(null)
return@launch
}
Expand Down Expand Up @@ -225,7 +232,7 @@ internal class TaskDetailsViewModel(
}

private fun filterProgressForAlarm(progress: List<TaskProgressDay>): List<TaskProgressDay> {
if (shouldShowProgress.not()) {
if (shouldShowProgressGrid.not()) {
return progress
}

Expand Down
11 changes: 10 additions & 1 deletion feature/task-list/impl/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ android {
jvmTarget = "17"
}
buildFeatures {
viewBinding = true
compose = true
viewBinding = false
}
composeOptions {
kotlinCompilerExtensionVersion = Compose.Version.compiler
}
testOptions {
unitTests.all {
Expand Down Expand Up @@ -66,6 +70,11 @@ dependencies {
implementation(AndroidX.recyclerview)
implementation(AndroidX.constraintLayout)
implementation(AndroidX.materialDesign)
implementation(Compose.material)
implementation(Compose.ui)
implementation(Compose.uiToolingPreview)
implementation(Compose.runtimeLiveData)
implementation(Compose.materialIconsExtended)

testImplementation(Junit.junit)
testImplementation(MockK.core)
Expand Down

This file was deleted.

Loading