Skip to content

Commit

Permalink
Merge pull request #326 from dhis2/release/0.4.0-SNAPSHOT
Browse files Browse the repository at this point in the history
Release 0.4.0
  • Loading branch information
xavimolloy authored Nov 19, 2024
2 parents 51ba73a + 0ce9216 commit 1b2dc0e
Show file tree
Hide file tree
Showing 58 changed files with 4,604 additions and 303 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/github-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ on:
branches:
- main
- develop
- release/*
pull_request:
branches:
- main
- develop

- release/*
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/rebuild-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: 'Rebuild developer docs'

on:
push:
branches:
- main
paths:
- 'docs/**'

concurrency:
group: ${{ github.workflow}}-${{ github.ref }}
cancel-in-progress: true

jobs:
rebuild-docs:
runs-on: ubuntu-latest
steps:
- run: curl -X POST -d {} https://api.netlify.com/build_hooks/${{ secrets.NETLIFY_DEVELOPER_DOCS_TOKEN }}
4 changes: 2 additions & 2 deletions .github/workflows/release-start.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
run: git checkout -b release/${{ inputs.release_version_name }}

- name: Run Python script to update release branch version
run: python scripts/updateVersionName.py ${{ inputs.release_version_name }}
run: python .github/workflows/scripts/updateVersionName.py ${{ inputs.release_version_name }}

- name: Push
run: |
Expand Down Expand Up @@ -73,7 +73,7 @@ jobs:
run: git checkout -b update_version_to${{ inputs.development_version_name }}

- name: Run Python script to update base branch version
run: python scripts/updateVersionName.py ${{ inputs.development_version_name }}
run: python .github/workflows/scripts/updateVersionName.py ${{ inputs.development_version_name }}

- name: Commit and Push Changes
run: |
Expand Down
21 changes: 21 additions & 0 deletions android/src/main/java/org/hisp/dhis/android/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import androidx.compose.ui.graphics.asImageBitmap
import androidx.compose.ui.platform.LocalContext
import androidx.core.view.WindowCompat
import org.hisp.dhis.common.App
import org.hisp.dhis.mobile.ui.designsystem.component.model.LocationItemModel

class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
Expand All @@ -28,6 +29,26 @@ class MainActivity : AppCompatActivity() {
.also { it.inPreferredConfig = Bitmap.Config.ARGB_8888 },
).asImageBitmap()
},
onLocationRequest = { locationQuery, locationSearchCallback ->

if (locationQuery.isNotBlank()) {
val fakeList = buildList<LocationItemModel> {
repeat(20) {
add(
LocationItemModel.SearchResult(
"Fake Location Title #$it",
"Fake Location Address, Fake Country, Fake City",
0.0,
0.0,
),
)
}
}
locationSearchCallback(fakeList)
} else {
locationSearchCallback(emptyList())
}
},
)
}
}
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
version = "0.3.0-SNAPSHOT"
version = "0.4.0-SNAPSHOT"
group = "org.hisp.dhis.mobile"

plugins {
Expand Down
2 changes: 1 addition & 1 deletion common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ kotlin {
implementation(compose.material3)
@OptIn(org.jetbrains.compose.ExperimentalComposeLibrary::class)
implementation(compose.components.resources)
implementation(project(":designsystem"))
api(project(":designsystem"))
}
commonTest.dependencies {
implementation(kotlin("test"))
Expand Down
30 changes: 27 additions & 3 deletions common/src/commonMain/kotlin/org/hisp/dhis/common/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import org.hisp.dhis.common.screens.basicTextInputs.BasicTextInputsScreen
import org.hisp.dhis.common.screens.bottomSheets.BottomSheetsScreen
import org.hisp.dhis.common.screens.buttons.ButtonsScreen
import org.hisp.dhis.common.screens.cards.CardsScreen
import org.hisp.dhis.common.screens.location.LocationSearchBarScreen
import org.hisp.dhis.common.screens.menu.MenuScreen
import org.hisp.dhis.common.screens.others.BadgesScreen
import org.hisp.dhis.common.screens.others.ChipsScreen
import org.hisp.dhis.common.screens.others.IndicatorScreen
Expand All @@ -29,28 +31,44 @@ import org.hisp.dhis.common.screens.others.ProgressScreen
import org.hisp.dhis.common.screens.others.SearchBarScreen
import org.hisp.dhis.common.screens.others.SectionScreen
import org.hisp.dhis.common.screens.others.TagsScreen
import org.hisp.dhis.common.screens.others.TopBarScreen
import org.hisp.dhis.common.screens.parameter.ParameterSelectorScreen
import org.hisp.dhis.common.screens.toggleableInputs.ToggleableInputsScreen
import org.hisp.dhis.mobile.ui.designsystem.component.DropdownItem
import org.hisp.dhis.mobile.ui.designsystem.component.InputDropDown
import org.hisp.dhis.mobile.ui.designsystem.component.InputShellState
import org.hisp.dhis.mobile.ui.designsystem.component.InputStyle
import org.hisp.dhis.mobile.ui.designsystem.component.MetadataAvatarSize
import org.hisp.dhis.mobile.ui.designsystem.component.model.LocationItemModel
import org.hisp.dhis.mobile.ui.designsystem.theme.DHIS2Theme
import org.hisp.dhis.mobile.ui.designsystem.theme.Shape
import org.hisp.dhis.mobile.ui.designsystem.theme.Spacing
import org.hisp.dhis.mobile.ui.designsystem.theme.SurfaceColor

@Composable
fun App(imageBitmapLoader: (() -> ImageBitmap)? = null) {
fun App(
imageBitmapLoader: (() -> ImageBitmap)? = null,
onLocationRequest: (
(
locationQuery: String,
locationSearchCallback: (List<LocationItemModel>) -> Unit,
) -> Unit
)? = null,
) {
DHIS2Theme {
Main(imageBitmapLoader)
Main(imageBitmapLoader, onLocationRequest)
}
}

@Composable
fun Main(
imageBitmapLoader: (() -> ImageBitmap)?,
onLocationRequest: (
(
locationQuery: String,
locationSearchCallback: (List<LocationItemModel>) -> Unit,
) -> Unit
)?,
) {
val currentScreen = remember { mutableStateOf(Groups.NO_GROUP_SELECTED) }
var isComponentSelected by remember { mutableStateOf(false) }
Expand Down Expand Up @@ -79,7 +97,8 @@ fun Main(
state = InputShellState.UNFOCUSED,
expanded = true,
selectedItem = DropdownItem(currentScreen.value.label),
inputStyle = InputStyle.DataInputStyle().apply { backGroundColor = SurfaceColor.SurfaceBright },
inputStyle = InputStyle.DataInputStyle()
.apply { backGroundColor = SurfaceColor.SurfaceBright },
)

when (currentScreen.value) {
Expand All @@ -100,7 +119,12 @@ fun Main(
Groups.TAGS -> TagsScreen()
Groups.SEARCH_BAR -> SearchBarScreen()
Groups.NAVIGATION_BAR -> NavigationBarScreen()
Groups.MENU -> MenuScreen()
Groups.NO_GROUP_SELECTED -> NoComponentSelectedScreen()
Groups.TOP_BAR -> TopBarScreen()
Groups.LOCATION_SEARCH_BAR -> LocationSearchBarScreen { locationQuery, locationCallback ->
onLocationRequest?.invoke(locationQuery, locationCallback)
}
}
} else {
NoComponentSelectedScreen(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,8 @@ enum class Groups(val label: String) {
INDICATOR("Indicators"),
PARAMETER_SELECTOR("Parameter selector"),
NAVIGATION_BAR("Navigation Bar"),
TOP_BAR("Top Bar"),
MENU("Menu"),
NO_GROUP_SELECTED("No group selected"),
LOCATION_SEARCH_BAR("Location Search Bar"),
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ import org.hisp.dhis.mobile.ui.designsystem.component.AgeInputType
import org.hisp.dhis.mobile.ui.designsystem.component.ColumnComponentContainer
import org.hisp.dhis.mobile.ui.designsystem.component.ColumnScreenContainer
import org.hisp.dhis.mobile.ui.designsystem.component.InputAge
import org.hisp.dhis.mobile.ui.designsystem.component.InputAgeModel
import org.hisp.dhis.mobile.ui.designsystem.component.InputShellState
import org.hisp.dhis.mobile.ui.designsystem.component.LegendData
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.hisp.dhis.mobile.ui.designsystem.theme.SurfaceColor

@Composable
Expand All @@ -24,100 +25,108 @@ fun InputAgeScreen() {

ColumnComponentContainer("Input Age Component - Idle") {
InputAge(
InputAgeModel(
title = "Label",
state = rememberInputAgeState(
inputAgeData = InputAgeData(
title = "Label",
),
inputType = inputType,
onValueChanged = { newInputType ->
inputType = newInputType
},
),
onValueChanged = { newInputType ->
inputType = newInputType ?: AgeInputType.None
},
)
}

ColumnComponentContainer("Input Age Component - Idle Disabled") {
InputAge(
InputAgeModel(
title = "Label",
inputType = AgeInputType.None,
state = InputShellState.DISABLED,
onValueChanged = { newInputType ->
inputType = newInputType
},
state = rememberInputAgeState(
inputAgeData = InputAgeData(
title = "Label",
),
inputState = InputShellState.DISABLED,
),
onValueChanged = { newInputType ->
inputType = newInputType ?: AgeInputType.None
},
)
}

ColumnComponentContainer("Input Age Component - Date Of Birth") {
InputAge(
InputAgeModel(
title = "Label",
state = rememberInputAgeState(
inputAgeData = InputAgeData(
title = "Label",
),
inputType = AgeInputType.DateOfBirth(TextFieldValue("01011985")),
state = InputShellState.DISABLED,

onValueChanged = { newInputType ->
inputType = newInputType
},
inputState = InputShellState.DISABLED,
),
onValueChanged = { newInputType ->
inputType = newInputType ?: AgeInputType.None
},
)
}

ColumnComponentContainer("Input Age Component - Date Of Birth Required Error") {
InputAge(
InputAgeModel(
title = "Label",
state = rememberInputAgeState(
inputAgeData = InputAgeData(
title = "Label",
isRequired = true,
),
inputType = AgeInputType.DateOfBirth(TextFieldValue("010")),
state = InputShellState.ERROR,
isRequired = true,

onValueChanged = {
// no-op
},
inputState = InputShellState.ERROR,
),
onValueChanged = {
// no-op
},
)
}

ColumnComponentContainer("Input Age Component - Age Disabled") {
InputAge(
InputAgeModel(
title = "Label",
state = rememberInputAgeState(
inputAgeData = InputAgeData(
title = "Label",
),
inputType = AgeInputType.Age(value = TextFieldValue("56"), unit = TimeUnitValues.YEARS),
state = InputShellState.DISABLED,

onValueChanged = { newInputType ->
inputType = newInputType
},
inputState = InputShellState.DISABLED,
),
onValueChanged = { newInputType ->
inputType = newInputType ?: AgeInputType.None
},
)
}

ColumnComponentContainer("Input Age Component - Age Required Error") {
InputAge(
InputAgeModel(
title = "Label",
state = rememberInputAgeState(
inputAgeData = InputAgeData(
title = "Label",
isRequired = true,
),
inputType = AgeInputType.Age(value = TextFieldValue("56"), unit = TimeUnitValues.YEARS),
state = InputShellState.ERROR,
isRequired = true,

onValueChanged = {
// no-op
},
inputState = InputShellState.ERROR,
),
onValueChanged = {
// no-op
},
)
}

ColumnComponentContainer("Input Age Component - Legend") {
InputAge(
InputAgeModel(
title = "Label",
state = rememberInputAgeState(
inputAgeData = InputAgeData(
title = "Label",
isRequired = true,
),
inputType = AgeInputType.Age(value = TextFieldValue("56"), unit = TimeUnitValues.YEARS),
state = InputShellState.ERROR,
isRequired = true,

onValueChanged = {
// no-op
},
inputState = InputShellState.ERROR,
legendData = LegendData(SurfaceColor.CustomGreen, "Legend", popUpLegendDescriptionData = regularLegendList),
),
onValueChanged = {
// no-op
},
)
}
}
Expand Down
Loading

0 comments on commit 1b2dc0e

Please sign in to comment.