An open API service indexing awesome lists of open source software.

https://github.com/dhis2/dhis2-mobile-ui

Compose Multiplatfform DHIS2 Mobile UI components library
https://github.com/dhis2/dhis2-mobile-ui

Last synced: 11 months ago
JSON representation

Compose Multiplatfform DHIS2 Mobile UI components library

Awesome Lists containing this project

README

          

# DHIS2 Mobile UI

Dhis2 Mobile UI library documentation, installation and usage is explained in [DHIS2 Developer portal](https://developers.dhis2.org/docs/mobile/mobile-ui/overview)

## Compose Compiler Reports

The Compose Compiler plugin can generate reports / metrics around certain compose-specific concepts
that can be useful to understand what is happening with some of your compose code at a fine-grained
level.
You can read more about
it [here](https://github.com/androidx/androidx/blob/androidx-main/compose/compiler/design/compiler-metrics.md).

To generate the reports / metrics, run the following Gradle command

```shell
./gradlew assembleDebug -PenableComposeCompilerReports=true
```

This would generate the output at `/build/compose_metrics`

## Screenshot Testing

We are using [Paparazzi](https://cashapp.github.io/paparazzi/) for screenshot testing.

### Screenshot testing

```kotlin
class InputChipSnapshotTest {

@get:Rule
val paparazzi = paparazzi()

@Test
fun launchChip() {
paparazzi.snapshot {
ColumnComponentContainer {
InputChip(label = "Label", selected = false, badge = "3")
InputChip(label = "Label", selected = true, badge = "3")
}
}
}
}
```

### Running tests

`./gradlew designsystem:testDebugUnitTest`

Runs tests and generates an HTML report at `/build/reports/paparazzi/` showing all test runs
and snapshots.

### Saving golden images to repo

`./gradlew designsystem:recordPaparazziDebug`

Saves snapshots as golden values to a predefined source-controlled location (defaults to
`/src/test/snapshots`).

### Verifying

`./gradlew designsystem:verifyPaparazziDebug`

Runs tests and verifies against previously-recorded golden values. Failures generate diffs at
`/build/paparazzi/failures`.

# Documentation

The Mobile UI documentation is integrated in the [developer portal](https://developers.dhis2.org/). It
uses [Docusaurus](https://docusaurus.io), a modern tool to build documentation pages.

The documentation is written in Markdown. The sidebar is automatically generated based on the metadata
of the different files. It follows the rules explained in the [autogenerated sidebar docs](https://docusaurus.io/docs/next/sidebar/autogenerated#autogenerated-sidebar-metadata).
In short, every file must have a `sidebar_position` label at the beginning of the document, which
defines the position of the document relative to its folder. Then, each folder has a `_category_.yml`
file, which has a `position` property defining the position of that folder relative to its parent folder.

It is possible to nest as many folders as desired following that pattern.

## Testing

It is possible to build the Developers portal documentation to test your changes.

Steps to test:
1. Do the changes in the Mobile UI docs and push them to a branch in github.
2. Download the [Deverlopers portal repository](https://github.com/dhis2/developer-portal).
3. Change the branch in the Mobile UI block in the file `docs-migrate.js` to point to your branch.
4. Follow the instructions in [CONTRIBUTING](https://github.com/dhis2/developer-portal/blob/main/CONTRIBUTING.md)
to build the docs.