Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: [ANDROAPP-6676] Updates compose, kotlin, gradle, and dependencies versions #340

Merged
merged 11 commits into from
Dec 18, 2024
Merged
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ kotlin {
sourceSets {
androidMain.dependencies {
implementation(project(":common"))
implementation("androidx.activity:activity-compose:1.8.2")
implementation("androidx.activity:activity-compose:1.9.3")
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ fun SetStatusBarColor() {
WindowCompat.getInsetsController(it, it.decorView).apply {
isAppearanceLightStatusBars = true
}
it.statusBarColor = 0xFFE2F2FF.toInt()
}
}
}
10 changes: 6 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

version = "0.4.1-SNAPSHOT"
group = "org.hisp.dhis.mobile"

Expand All @@ -8,7 +8,7 @@ plugins {
id("com.android.application") apply false
id("com.android.library") apply false
id("org.jetbrains.compose") apply false
id("org.jlleitschuh.gradle.ktlint") version "11.5.1"
id("org.jlleitschuh.gradle.ktlint") version "12.1.2"
id("org.jetbrains.dokka") version "1.9.20"
id("io.github.gradle-nexus.publish-plugin") version "1.3.0"
alias(libs.plugins.compose.compiler)
Expand All @@ -33,8 +33,10 @@ allprojects {
}
}

tasks.withType<KotlinCompile>().all {
kotlinOptions { freeCompilerArgs += "-Xexpect-actual-classes" }
tasks.withType<KotlinCompilationTask<*>>().all {
compilerOptions {
freeCompilerArgs.add("-Xexpect-actual-classes")
}
}
}

Expand Down
8 changes: 4 additions & 4 deletions common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ kotlin {
implementation(kotlin("test"))
}
androidMain.dependencies {
api("androidx.appcompat:appcompat:1.6.1")
api("androidx.core:core-ktx:1.12.0")
api("androidx.appcompat:appcompat:1.7.0")
api("androidx.core:core-ktx:1.15.0")
}
val androidUnitTest by getting {
dependencies {
Expand All @@ -46,8 +46,8 @@ android {
namespace = "org.hisp.dhis.mobile.ui.common"

sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
sourceSets["main"].res.srcDirs("src/androidMain/res", "src/commonMain/resources")
sourceSets["main"].resources.srcDirs("src/commonMain/resources")
sourceSets["main"].res.srcDirs("src/androidMain/res", "src/commonMain/composeResources")
sourceSets["main"].resources.srcDirs("src/commonMain/composeResources")

defaultConfig {
minSdk = (findProperty("android.minSdk") as String).toInt()
Expand Down
12 changes: 6 additions & 6 deletions designsystem/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {
id("org.jetbrains.compose")
id("com.android.library")
id("convention.publication")
id("app.cash.paparazzi").version("1.3.3")
id("app.cash.paparazzi").version("1.3.5")
alias(libs.plugins.compose.compiler)
}

Expand All @@ -34,9 +34,9 @@ kotlin {

val androidMain by getting {
dependencies {
api("androidx.activity:activity-compose:1.8.2")
api("androidx.appcompat:appcompat:1.6.1")
api("androidx.core:core-ktx:1.12.0")
api("androidx.activity:activity-compose:1.9.3")
api("androidx.appcompat:appcompat:1.7.0")
api("androidx.core:core-ktx:1.15.0")
implementation("com.google.zxing:core:3.5.2")
implementation("se.warting.signature:signature-pad:0.1.2")
}
Expand Down Expand Up @@ -69,8 +69,8 @@ android {
namespace = "org.hisp.dhis.mobile.ui.designsystem"

sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
sourceSets["main"].res.srcDirs("src/androidMain/res", "src/commonMain/resources")
sourceSets["main"].resources.srcDirs("src/commonMain/resources")
sourceSets["main"].res.srcDirs("src/androidMain/res", "src/commonMain/composeResources")
sourceSets["main"].resources.srcDirs("src/commonMain/composeResources")

defaultConfig {
minSdk = (findProperty("android.minSdk") as String).toInt()
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.outlined.Sync
import androidx.compose.material.icons.outlined.SyncDisabled
import androidx.compose.material3.Icon
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.platform.LocalInspectionMode
import org.hisp.dhis.mobile.ui.designsystem.component.AdditionalInfoItem
import org.hisp.dhis.mobile.ui.designsystem.component.Avatar
import org.hisp.dhis.mobile.ui.designsystem.component.AvatarStyleData
Expand All @@ -23,21 +25,35 @@ import org.hisp.dhis.mobile.ui.designsystem.component.state.rememberAdditionalIn
import org.hisp.dhis.mobile.ui.designsystem.component.state.rememberListCardState
import org.hisp.dhis.mobile.ui.designsystem.theme.SurfaceColor
import org.hisp.dhis.mobile.ui.designsystem.theme.TextColor
import org.jetbrains.compose.resources.ExperimentalResourceApi
import org.jetbrains.compose.resources.PreviewContextConfigurationEffect
import org.junit.Ignore
import org.junit.Rule
import org.junit.Test

class ExpandableItemColumnSnapshotTest {
@get:Rule
val paparazzi = paparazzi()

@Ignore(
"This screen is performing layout calculations and does an 'animation effect'" +
"causing the screenshot to be taken before the final layout is displayed." +
"Paparazzi has an issue but as of version 1.3.5 it is not fixed." +
"https://github.com/cashapp/paparazzi/issues/1757",
)
@OptIn(ExperimentalResourceApi::class)
@Test
fun launchAvatarTest() {
paparazzi.snapshot {
CompositionLocalProvider(LocalInspectionMode provides true) {
PreviewContextConfigurationEffect()
}
val items = listOf("Program number 1", "Program number 2")
ExpandableItemColumn(
modifier = Modifier.fillMaxSize().graphicsLayer { clip = false },
itemList = items,
) { item, verticalPadding, onSizeChanged ->
print("itemVerticalPadding: $verticalPadding")
val index = items.indexOf(item)
VerticalInfoListCard(
listCardState = rememberListCardState(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.hisp.dhis.mobile.ui.designsystem

import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.platform.LocalInspectionMode
import androidx.compose.ui.text.input.TextFieldValue
import org.hisp.dhis.mobile.ui.designsystem.component.AgeInputType
import org.hisp.dhis.mobile.ui.designsystem.component.ColumnScreenContainer
Expand All @@ -9,6 +11,8 @@ import org.hisp.dhis.mobile.ui.designsystem.component.SubTitle
import org.hisp.dhis.mobile.ui.designsystem.component.TimeUnitValues
import org.hisp.dhis.mobile.ui.designsystem.component.state.InputAgeData
import org.hisp.dhis.mobile.ui.designsystem.component.state.rememberInputAgeState
import org.jetbrains.compose.resources.ExperimentalResourceApi
import org.jetbrains.compose.resources.PreviewContextConfigurationEffect
import org.junit.Rule
import org.junit.Test

Expand All @@ -17,9 +21,13 @@ class InputAgeSnapshotTest {
@get:Rule
val paparazzi = paparazzi()

@OptIn(ExperimentalResourceApi::class)
@Test
fun launchInputAgeSnapshot() {
paparazzi.snapshot {
CompositionLocalProvider(LocalInspectionMode provides true) {
PreviewContextConfigurationEffect()
}
ColumnScreenContainer {
SubTitle("Input Age Component - Idle")
InputAge(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package org.hisp.dhis.mobile.ui.designsystem

import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.size
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
Expand All @@ -10,6 +11,7 @@ import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.focus.FocusRequester
import androidx.compose.ui.focus.focusRequester
import androidx.compose.ui.platform.LocalInspectionMode
import org.hisp.dhis.mobile.ui.designsystem.component.ColumnScreenContainer
import org.hisp.dhis.mobile.ui.designsystem.component.DropdownItem
import org.hisp.dhis.mobile.ui.designsystem.component.InputDropDown
Expand All @@ -19,6 +21,8 @@ import org.hisp.dhis.mobile.ui.designsystem.component.SubTitle
import org.hisp.dhis.mobile.ui.designsystem.component.Title
import org.hisp.dhis.mobile.ui.designsystem.theme.Spacing
import org.hisp.dhis.mobile.ui.designsystem.theme.TextColor
import org.jetbrains.compose.resources.ExperimentalResourceApi
import org.jetbrains.compose.resources.PreviewContextConfigurationEffect
import org.junit.Rule
import org.junit.Test

Expand All @@ -27,9 +31,13 @@ class InputDropDownSnapshotTest {
@get:Rule
val paparazzi = paparazzi()

@OptIn(ExperimentalResourceApi::class)
@Test
fun launchInputDropDown() {
paparazzi.snapshot {
CompositionLocalProvider(LocalInspectionMode provides true) {
PreviewContextConfigurationEffect()
}
ColumnScreenContainer {
val options = listOf(
DropdownItem("Option 1"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,21 @@ package org.hisp.dhis.mobile.ui.designsystem

import android.graphics.Bitmap
import android.graphics.BitmapFactory
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.mutableStateListOf
import androidx.compose.runtime.remember
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.asImageBitmap
import androidx.compose.ui.graphics.painter.BitmapPainter
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalInspectionMode
import org.hisp.dhis.mobile.ui.designsystem.component.ColumnScreenContainer
import org.hisp.dhis.mobile.ui.designsystem.component.ImageCardData
import org.hisp.dhis.mobile.ui.designsystem.component.InputSequential
import org.hisp.dhis.mobile.ui.designsystem.component.InputShellState
import org.hisp.dhis.mobile.ui.designsystem.theme.SurfaceColor
import org.jetbrains.compose.resources.ExperimentalResourceApi
import org.jetbrains.compose.resources.PreviewContextConfigurationEffect
import org.junit.Rule
import org.junit.Test

Expand All @@ -21,9 +25,13 @@ class InputSequentialSnapshotTest {
@get:Rule
val paparazzi = paparazzi()

@OptIn(ExperimentalResourceApi::class)
@Test
fun launchMatrix() {
paparazzi.snapshot {
CompositionLocalProvider(LocalInspectionMode provides true) {
PreviewContextConfigurationEffect()
}
val res = LocalContext.current.resources

val image = BitmapFactory.decodeResource(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.outlined.Sync
import androidx.compose.material3.Icon
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalInspectionMode
import org.hisp.dhis.mobile.ui.designsystem.component.AdditionalInfoItem
import org.hisp.dhis.mobile.ui.designsystem.component.Avatar
import org.hisp.dhis.mobile.ui.designsystem.component.AvatarStyleData
Expand All @@ -18,6 +20,8 @@ import org.hisp.dhis.mobile.ui.designsystem.component.state.rememberListCardStat
import org.hisp.dhis.mobile.ui.designsystem.resource.provideDHIS2Icon
import org.hisp.dhis.mobile.ui.designsystem.theme.Spacing
import org.hisp.dhis.mobile.ui.designsystem.theme.SurfaceColor
import org.jetbrains.compose.resources.ExperimentalResourceApi
import org.jetbrains.compose.resources.PreviewContextConfigurationEffect
import org.junit.Rule
import org.junit.Test

Expand All @@ -26,9 +30,13 @@ class ListCardSelectableSnapshotTest {
@get:Rule
val paparazzi = paparazzi()

@OptIn(ExperimentalResourceApi::class)
@Test
fun launchListCard() {
paparazzi.snapshot {
CompositionLocalProvider(LocalInspectionMode provides true) {
PreviewContextConfigurationEffect()
}
Column(
verticalArrangement = Arrangement.spacedBy(Spacing.Spacing4),
modifier = Modifier.padding(horizontal = Spacing.Spacing8),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,26 @@
package org.hisp.dhis.mobile.ui.designsystem

import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.platform.LocalInspectionMode
import org.hisp.dhis.mobile.ui.designsystem.component.LocationBar
import org.hisp.dhis.mobile.ui.designsystem.component.SearchBarMode
import org.hisp.dhis.mobile.ui.designsystem.component.model.LocationItemModel
import org.jetbrains.compose.resources.ExperimentalResourceApi
import org.jetbrains.compose.resources.PreviewContextConfigurationEffect
import org.junit.Rule
import org.junit.Test

class LocationBarSearchSnapshotTest {
@get:Rule
val paparazzi = paparazzi()

@OptIn(ExperimentalResourceApi::class)
@Test
fun launchSearchBarButtonTest() {
paparazzi.snapshot {
CompositionLocalProvider(LocalInspectionMode provides true) {
PreviewContextConfigurationEffect()
}
LocationBar(
currentResults = listOf(
LocationItemModel.StoredResult(
Expand Down
Loading
Loading