From ed227bf2b666d8488b4eccd236f1ac644c487d62 Mon Sep 17 00:00:00 2001 From: Ben Martin Date: Tue, 21 Jan 2025 14:49:02 +0000 Subject: [PATCH] docs: add README.md and update form submission logic (#21) This commit updates the README.md with project details, including features, technologies, installation instructions, and project structure. - It also includes a description of the app, features like free-text input, sentiment selection, submitting content to a server, and displaying a Snackbar. - It updates the form submission logic in `App.kt` to delay showing the "Feedback sent" Snackbar by 1 second. Closes #2 Reviewed-on: https://git.brmartin.co.uk/bob/mobile-application/pulls/21 Co-authored-by: Ben Martin Co-committed-by: Ben Martin --- README.md | 45 ++++++++++++++----- .../kotlin/uk/sky/bob/application/App.kt | 6 ++- 2 files changed, 40 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 1ba257b..6a09ff1 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,39 @@ -This is a Kotlin Multiplatform project targeting Android, iOS. +# Bob -- The Handy Feedback App -* `/composeApp` is for code that will be shared across your Compose Multiplatform applications. - It contains several subfolders: - - `commonMain` is for code that’s common for all targets. - - Other folders are for Kotlin code that will be compiled for only the platform indicated in the folder name. - For example, if you want to use Apple’s CoreCrypto for the iOS part of your Kotlin app, - `iosMain` would be the right folder for such calls. +This project is a simple Kotlin Multiplatform Application that allows users to enter free-text and +submit the content to a server over HTTP. It also includes a form with sentiment selection and +displays a Snackbar whenever the submit button is pressed. -* `/iosApp` contains iOS applications. Even if you’re sharing your UI with Compose Multiplatform, - you need this entry point for your iOS app. This is also where you should add SwiftUI code for your project. +## Features +- Free-text input form +- Sentiment selection using FilterChips +- Submit content to a server using Retrofit +- Display Snackbar on form submission -Learn more about [Kotlin Multiplatform](https://www.jetbrains.com/help/kotlin-multiplatform-dev/get-started.html)… \ No newline at end of file +## Technologies Used + +- Kotlin +- Jetpack Compose +- Retrofit +- Gradle + +## Getting Started + +### Installation + +1. Download the latest release from + the [releases page](https://git.brmartin.co.uk/bob/mobile-application/releases) +2. Install the application following the on-screen instructions. + +### Usage + +1. Run the application on an Android emulator or a physical device. +2. Select a sentiment using the FilterChips. +3. Enter your text in the provided text field. +4. Press the submit button to send the content to the server. + +### Project Structure + +- `composeApp/src/commonMain/kotlin/uk/sky/bob/application/App.kt`: Main Compose UI and form + submission logic. diff --git a/composeApp/src/commonMain/kotlin/uk/sky/bob/application/App.kt b/composeApp/src/commonMain/kotlin/uk/sky/bob/application/App.kt index 407cdd3..4793c10 100644 --- a/composeApp/src/commonMain/kotlin/uk/sky/bob/application/App.kt +++ b/composeApp/src/commonMain/kotlin/uk/sky/bob/application/App.kt @@ -31,6 +31,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.text.input.TextFieldValue import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp +import kotlinx.coroutines.delay import kotlinx.coroutines.launch import org.jetbrains.compose.ui.tooling.preview.Preview @@ -85,7 +86,10 @@ fun App() { Button(onClick = { sentiment.value = Sentiment.HAPPY comment = TextFieldValue("") - scope.launch { scaffoldState.snackbarHostState.showSnackbar("Feedback sent") } + scope.launch { + delay(1000) + scaffoldState.snackbarHostState.showSnackbar("Feedback sent") + } }, modifier = Modifier.padding(8.dp)) { Icon(Icons.AutoMirrored.Filled.Send, contentDescription = "Send") }