diff --git a/.gitignore b/.gitignore
index e2a159f99..ae4646666 100644
--- a/.gitignore
+++ b/.gitignore
@@ -28,3 +28,5 @@ obj/
packages/
target/
xcuserdata
+.env
+
diff --git a/android/QuickStartTasks/.gitignore b/android/QuickStartTasks/.gitignore
new file mode 100644
index 000000000..aa724b770
--- /dev/null
+++ b/android/QuickStartTasks/.gitignore
@@ -0,0 +1,15 @@
+*.iml
+.gradle
+/local.properties
+/.idea/caches
+/.idea/libraries
+/.idea/modules.xml
+/.idea/workspace.xml
+/.idea/navEditor.xml
+/.idea/assetWizardSettings.xml
+.DS_Store
+/build
+/captures
+.externalNativeBuild
+.cxx
+local.properties
diff --git a/android/QuickStartTasks/app/.gitignore b/android/QuickStartTasks/app/.gitignore
new file mode 100644
index 000000000..42afabfd2
--- /dev/null
+++ b/android/QuickStartTasks/app/.gitignore
@@ -0,0 +1 @@
+/build
\ No newline at end of file
diff --git a/android/QuickStartTasks/app/build.gradle.kts b/android/QuickStartTasks/app/build.gradle.kts
new file mode 100644
index 000000000..b73c6f0f6
--- /dev/null
+++ b/android/QuickStartTasks/app/build.gradle.kts
@@ -0,0 +1,120 @@
+import com.android.build.api.variant.BuildConfigField
+import java.io.FileInputStream
+import java.io.FileNotFoundException
+import java.util.Properties
+
+plugins {
+ alias(libs.plugins.android.application)
+ alias(libs.plugins.jetbrains.kotlin.android)
+}
+
+// Load properties from the .env file at the repository root
+fun loadEnvProperties(): Properties {
+ val envFile = rootProject.file("../../.env")
+ val properties = Properties()
+ if (envFile.exists()) {
+ FileInputStream(envFile).use { properties.load(it) }
+ } else {
+ throw FileNotFoundException(".env file not found at: ${envFile.path}")
+ }
+ return properties
+}
+
+// Define BuildConfig.DITTO_APP_ID and BuildConfig.DITTO_PLAYGROUND_TOKEN
+// based on values in the .env file
+androidComponents {
+ onVariants {
+ val prop = loadEnvProperties()
+ it.buildConfigFields.put(
+ "DITTO_APP_ID",
+ BuildConfigField(
+ "String",
+ "\"${prop["DITTO_APP_ID"]}\"",
+ "Ditto application ID"
+ )
+ )
+ it.buildConfigFields.put(
+ "DITTO_PLAYGROUND_TOKEN",
+ BuildConfigField(
+ "String",
+ "\"${prop["DITTO_PLAYGROUND_TOKEN"]}\"",
+ "Ditto online playground authentication token"
+ )
+ )
+ }
+}
+
+android {
+ namespace = "live.ditto.quickstart.tasks"
+ compileSdk = 35
+
+ defaultConfig {
+ applicationId = "live.ditto.quickstart.tasks"
+ minSdk = 23
+ targetSdk = 35
+ versionCode = 1
+ versionName = "1.0"
+
+ testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
+ vectorDrawables {
+ useSupportLibrary = true
+ }
+ }
+
+ buildTypes {
+ release {
+ isMinifyEnabled = false
+ proguardFiles(
+ getDefaultProguardFile("proguard-android-optimize.txt"),
+ "proguard-rules.pro"
+ )
+ }
+ }
+ compileOptions {
+ sourceCompatibility = JavaVersion.VERSION_1_8
+ targetCompatibility = JavaVersion.VERSION_1_8
+ }
+ kotlinOptions {
+ jvmTarget = "1.8"
+ }
+ buildFeatures {
+ buildConfig = true
+ compose = true
+ }
+ composeOptions {
+ kotlinCompilerExtensionVersion = "1.5.14"
+ }
+ packaging {
+ resources {
+ excludes += "/META-INF/{AL2.0,LGPL2.1}"
+ }
+ }
+}
+
+dependencies {
+
+ implementation(libs.androidx.core.ktx)
+ implementation(libs.androidx.lifecycle.runtime.ktx)
+ implementation(libs.androidx.activity.compose)
+ implementation(platform(libs.androidx.compose.bom))
+ implementation(libs.androidx.ui)
+ implementation(libs.androidx.ui.graphics)
+ implementation(libs.androidx.ui.tooling.preview)
+ implementation(libs.androidx.material3)
+ implementation(libs.androidx.navigation.compose)
+ implementation(libs.androidx.runtime.livedata)
+ implementation(libs.androidx.appcompat)
+ implementation(libs.androidx.datastore.preferences)
+
+ testImplementation(libs.junit)
+ androidTestImplementation(libs.androidx.junit)
+ androidTestImplementation(libs.androidx.espresso.core)
+ androidTestImplementation(platform(libs.androidx.compose.bom))
+ androidTestImplementation(libs.androidx.ui.test.junit4)
+
+ debugImplementation(libs.androidx.ui.tooling)
+ debugImplementation(libs.androidx.ui.test.manifest)
+
+ // Ditto SDK
+ implementation("live.ditto:ditto:4.8.2")
+}
diff --git a/android/QuickStartTasks/app/proguard-rules.pro b/android/QuickStartTasks/app/proguard-rules.pro
new file mode 100644
index 000000000..481bb4348
--- /dev/null
+++ b/android/QuickStartTasks/app/proguard-rules.pro
@@ -0,0 +1,21 @@
+# Add project specific ProGuard rules here.
+# You can control the set of applied configuration files using the
+# proguardFiles setting in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile
\ No newline at end of file
diff --git a/android/QuickStartTasks/app/src/androidTest/java/live/ditto/quickstart/tasks/ExampleInstrumentedTest.kt b/android/QuickStartTasks/app/src/androidTest/java/live/ditto/quickstart/tasks/ExampleInstrumentedTest.kt
new file mode 100644
index 000000000..27bfbe7c1
--- /dev/null
+++ b/android/QuickStartTasks/app/src/androidTest/java/live/ditto/quickstart/tasks/ExampleInstrumentedTest.kt
@@ -0,0 +1,24 @@
+package live.ditto.quickstart.tasks
+
+import androidx.test.platform.app.InstrumentationRegistry
+import androidx.test.ext.junit.runners.AndroidJUnit4
+
+import org.junit.Test
+import org.junit.runner.RunWith
+
+import org.junit.Assert.*
+
+/**
+ * Instrumented test, which will execute on an Android device.
+ *
+ * See [testing documentation](http://d.android.com/tools/testing).
+ */
+@RunWith(AndroidJUnit4::class)
+class ExampleInstrumentedTest {
+ @Test
+ fun useAppContext() {
+ // Context of the app under test.
+ val appContext = InstrumentationRegistry.getInstrumentation().targetContext
+ assertEquals("live.ditto.quickstart.tasks", appContext.packageName)
+ }
+}
\ No newline at end of file
diff --git a/android/QuickStartTasks/app/src/main/AndroidManifest.xml b/android/QuickStartTasks/app/src/main/AndroidManifest.xml
new file mode 100644
index 000000000..0be475fd1
--- /dev/null
+++ b/android/QuickStartTasks/app/src/main/AndroidManifest.xml
@@ -0,0 +1,69 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/android/QuickStartTasks/app/src/main/java/live/ditto/quickstart/tasks/DittoHandler.kt b/android/QuickStartTasks/app/src/main/java/live/ditto/quickstart/tasks/DittoHandler.kt
new file mode 100644
index 000000000..40ff8e8b2
--- /dev/null
+++ b/android/QuickStartTasks/app/src/main/java/live/ditto/quickstart/tasks/DittoHandler.kt
@@ -0,0 +1,9 @@
+package live.ditto.quickstart.tasks
+
+import live.ditto.*
+
+class DittoHandler {
+ companion object {
+ lateinit var ditto: Ditto
+ }
+}
diff --git a/android/QuickStartTasks/app/src/main/java/live/ditto/quickstart/tasks/MainActivity.kt b/android/QuickStartTasks/app/src/main/java/live/ditto/quickstart/tasks/MainActivity.kt
new file mode 100644
index 000000000..b8504e0dd
--- /dev/null
+++ b/android/QuickStartTasks/app/src/main/java/live/ditto/quickstart/tasks/MainActivity.kt
@@ -0,0 +1,28 @@
+package live.ditto.quickstart.tasks
+
+import android.os.Bundle
+import androidx.activity.ComponentActivity
+import androidx.activity.compose.setContent
+import live.ditto.transports.DittoSyncPermissions
+
+class MainActivity : ComponentActivity() {
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+
+ setContent {
+ Root()
+ }
+
+ requestMissingPermissions()
+ }
+
+ private fun requestMissingPermissions() {
+ val missingPermissions = DittoSyncPermissions(this).missingPermissions()
+ if (missingPermissions.isNotEmpty()) {
+ this.requestPermissions(missingPermissions, 0)
+ }
+ }
+}
+
+
+
diff --git a/android/QuickStartTasks/app/src/main/java/live/ditto/quickstart/tasks/Root.kt b/android/QuickStartTasks/app/src/main/java/live/ditto/quickstart/tasks/Root.kt
new file mode 100644
index 000000000..86b83f8b5
--- /dev/null
+++ b/android/QuickStartTasks/app/src/main/java/live/ditto/quickstart/tasks/Root.kt
@@ -0,0 +1,32 @@
+package live.ditto.quickstart.tasks
+
+import androidx.compose.material3.MaterialTheme
+import androidx.compose.material3.Surface
+import androidx.compose.runtime.Composable
+import androidx.navigation.compose.NavHost
+import androidx.navigation.compose.composable
+import androidx.navigation.compose.rememberNavController
+import live.ditto.quickstart.tasks.edit.EditScreen
+import live.ditto.quickstart.tasks.list.TasksListScreen
+import live.ditto.quickstart.tasks.ui.theme.QuickStartTasksTheme
+
+@Composable
+fun Root() {
+ val navController = rememberNavController()
+
+ QuickStartTasksTheme {
+ // A surface container using the 'background' color from the theme
+ Surface(color = MaterialTheme.colorScheme.background) {
+ NavHost(navController = navController, startDestination = "tasks") {
+ composable("tasks") { TasksListScreen(navController = navController) }
+ composable("tasks/edit") {
+ EditScreen(navController = navController, taskId = null)
+ }
+ composable("tasks/edit/{taskId}") { backStackEntry ->
+ val taskId: String? = backStackEntry.arguments?.getString("taskId")
+ EditScreen(navController = navController, taskId = taskId)
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/android/QuickStartTasks/app/src/main/java/live/ditto/quickstart/tasks/TasksApplication.kt b/android/QuickStartTasks/app/src/main/java/live/ditto/quickstart/tasks/TasksApplication.kt
new file mode 100644
index 000000000..4beb6a24c
--- /dev/null
+++ b/android/QuickStartTasks/app/src/main/java/live/ditto/quickstart/tasks/TasksApplication.kt
@@ -0,0 +1,50 @@
+package live.ditto.quickstart.tasks
+
+import android.app.Application
+import android.content.Context
+import live.ditto.Ditto
+import live.ditto.DittoIdentity
+import live.ditto.DittoLogLevel
+import live.ditto.DittoLogger
+import live.ditto.android.DefaultAndroidDittoDependencies
+import live.ditto.quickstart.tasks.DittoHandler.Companion.ditto
+
+class TasksApplication : Application() {
+
+ companion object {
+ private var instance: TasksApplication? = null
+
+ fun applicationContext(): Context {
+ return instance!!.applicationContext
+ }
+ }
+
+ init {
+ instance = this
+ }
+
+ override fun onCreate() {
+ super.onCreate()
+ setupDitto()
+ }
+
+ private fun setupDitto() {
+ val androidDependencies = DefaultAndroidDittoDependencies(applicationContext)
+ val appId = BuildConfig.DITTO_APP_ID
+ val token = BuildConfig.DITTO_PLAYGROUND_TOKEN
+ val enableDittoCloudSync = true
+
+ val identity = DittoIdentity.OnlinePlayground(
+ androidDependencies,
+ appId,
+ token,
+ enableDittoCloudSync
+ )
+
+ ditto = Ditto(androidDependencies, identity)
+
+ DittoLogger.minimumLogLevel = DittoLogLevel.DEBUG
+
+ ditto.disableSyncWithV3()
+ }
+}
diff --git a/android/QuickStartTasks/app/src/main/java/live/ditto/quickstart/tasks/data/Task.kt b/android/QuickStartTasks/app/src/main/java/live/ditto/quickstart/tasks/data/Task.kt
new file mode 100644
index 000000000..f6e074ad4
--- /dev/null
+++ b/android/QuickStartTasks/app/src/main/java/live/ditto/quickstart/tasks/data/Task.kt
@@ -0,0 +1,31 @@
+package live.ditto.quickstart.tasks.data
+
+import android.util.Log
+import org.json.JSONObject
+import java.util.UUID
+
+data class Task(
+ val _id: String = UUID.randomUUID().toString(),
+ val title: String,
+ val done: Boolean = false,
+ val deleted: Boolean = false,
+) {
+ companion object {
+ private const val TAG = "Task"
+
+ fun fromJson(jsonString: String): Task {
+ return try {
+ val json = JSONObject(jsonString)
+ Task(
+ _id = json["_id"].toString(),
+ title = json["title"].toString(),
+ done = json["done"] as Boolean,
+ deleted = json["deleted"] as Boolean
+ )
+ } catch (e: Exception) {
+ Log.e(TAG, "Unable to convert JSON to Task", e)
+ Task(title = "", done = false, deleted = false)
+ }
+ }
+ }
+}
diff --git a/android/QuickStartTasks/app/src/main/java/live/ditto/quickstart/tasks/edit/EditForm.kt b/android/QuickStartTasks/app/src/main/java/live/ditto/quickstart/tasks/edit/EditForm.kt
new file mode 100644
index 000000000..4f808905b
--- /dev/null
+++ b/android/QuickStartTasks/app/src/main/java/live/ditto/quickstart/tasks/edit/EditForm.kt
@@ -0,0 +1,80 @@
+package live.ditto.quickstart.tasks.edit
+
+import androidx.compose.foundation.layout.*
+import androidx.compose.material3.*
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.tooling.preview.Devices
+import androidx.compose.ui.tooling.preview.Preview
+import androidx.compose.ui.unit.dp
+
+@Composable
+fun EditForm(
+ canDelete: Boolean,
+ title: String,
+ onTitleTextChange: ((title: String) -> Unit)? = null,
+ done: Boolean = false,
+ onDoneChanged: ((done: Boolean) -> Unit)? = null,
+ onSaveButtonClicked: (() -> Unit)? = null,
+ onDeleteButtonClicked: (() -> Unit)? = null,
+) {
+ Column(modifier = Modifier.padding(16.dp)) {
+ Text(text = "Title:")
+ TextField(
+ value = title,
+ onValueChange = { onTitleTextChange?.invoke(it) },
+ modifier = Modifier
+ .fillMaxWidth()
+ .padding(bottom = 12.dp)
+ )
+ Row(
+ modifier = Modifier
+ .fillMaxWidth()
+ .padding(bottom = 12.dp),
+ Arrangement.SpaceBetween
+ ) {
+ Text(text = "Is Complete:")
+ Switch(checked = done, onCheckedChange = { onDoneChanged?.invoke(it) })
+ }
+ Button(
+ onClick = {
+ onSaveButtonClicked?.invoke()
+ },
+ modifier = Modifier
+ .padding(bottom = 12.dp)
+ .fillMaxWidth(),
+ ) {
+ Text(
+ text = "Save",
+ modifier = Modifier.padding(8.dp)
+ )
+ }
+ if (canDelete) {
+ Button(
+ onClick = {
+ onDeleteButtonClicked?.invoke()
+ },
+ colors = ButtonDefaults.buttonColors(
+ containerColor = Color.Red,
+ contentColor = Color.White),
+ modifier = Modifier
+ .fillMaxWidth(),
+ ) {
+ Text(
+ text = "Delete",
+ modifier = Modifier.padding(8.dp)
+ )
+ }
+ }
+ }
+}
+
+@Preview(
+ showBackground = true,
+ device = Devices.PIXEL_3
+)
+@Composable
+fun EditFormPreview() {
+ EditForm(canDelete = true, "Hello")
+}
diff --git a/android/QuickStartTasks/app/src/main/java/live/ditto/quickstart/tasks/edit/EditScreen.kt b/android/QuickStartTasks/app/src/main/java/live/ditto/quickstart/tasks/edit/EditScreen.kt
new file mode 100644
index 000000000..01d1b3f32
--- /dev/null
+++ b/android/QuickStartTasks/app/src/main/java/live/ditto/quickstart/tasks/edit/EditScreen.kt
@@ -0,0 +1,64 @@
+package live.ditto.quickstart.tasks.edit
+
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.fillMaxSize
+import androidx.compose.foundation.layout.padding
+import androidx.compose.material3.ExperimentalMaterial3Api
+import androidx.compose.material3.Scaffold
+import androidx.compose.material3.Text
+import androidx.compose.material3.TopAppBar
+import androidx.compose.material3.TopAppBarDefaults
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.livedata.observeAsState
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.res.colorResource
+import androidx.lifecycle.viewmodel.compose.viewModel
+import androidx.navigation.NavController
+import live.ditto.quickstart.tasks.R
+
+@OptIn(ExperimentalMaterial3Api::class)
+@Composable
+fun EditScreen(navController: NavController, taskId: String?) {
+ val editScreenViewModel: EditScreenViewModel = viewModel()
+ editScreenViewModel.setupWithTask(id = taskId)
+
+ val topBarTitle = if (taskId == null) "New Task" else "Edit Task"
+
+ val title: String by editScreenViewModel.title.observeAsState("")
+ val done: Boolean by editScreenViewModel.done.observeAsState(initial = false)
+ val canDelete: Boolean by editScreenViewModel.canDelete.observeAsState(initial = false)
+
+ Scaffold(
+ topBar = {
+ TopAppBar(
+ title = { Text(topBarTitle, color = Color.White) },
+ colors = TopAppBarDefaults.topAppBarColors(
+ containerColor = colorResource(id = R.color.blue_700)
+ )
+ )
+ },
+ content = { padding ->
+ Column(modifier = Modifier
+ .fillMaxSize()
+ .padding(padding)) {
+ EditForm(
+ canDelete = canDelete,
+ title = title,
+ onTitleTextChange = { editScreenViewModel.title.value = it },
+ done = done,
+ onDoneChanged = { editScreenViewModel.done.value = it },
+ onSaveButtonClicked = {
+ editScreenViewModel.save()
+ navController.popBackStack()
+ },
+ onDeleteButtonClicked = {
+ editScreenViewModel.delete()
+ navController.popBackStack()
+ }
+ )
+ }
+ }
+ )
+}
diff --git a/android/QuickStartTasks/app/src/main/java/live/ditto/quickstart/tasks/edit/EditScreenViewModel.kt b/android/QuickStartTasks/app/src/main/java/live/ditto/quickstart/tasks/edit/EditScreenViewModel.kt
new file mode 100644
index 000000000..cf1375785
--- /dev/null
+++ b/android/QuickStartTasks/app/src/main/java/live/ditto/quickstart/tasks/edit/EditScreenViewModel.kt
@@ -0,0 +1,97 @@
+package live.ditto.quickstart.tasks.edit
+
+import android.util.Log
+import androidx.lifecycle.MutableLiveData
+import androidx.lifecycle.ViewModel
+import androidx.lifecycle.viewModelScope
+import kotlinx.coroutines.launch
+import live.ditto.quickstart.tasks.DittoHandler.Companion.ditto
+import live.ditto.quickstart.tasks.data.Task
+
+class EditScreenViewModel : ViewModel() {
+
+ companion object {
+ private const val TAG = "EditScreenViewModel"
+ }
+
+ private var _id: String? = null
+
+ var title = MutableLiveData("")
+ var done = MutableLiveData(false)
+ var canDelete = MutableLiveData(false)
+
+ fun setupWithTask(id: String?) {
+ canDelete.postValue(id != null)
+ val taskId: String = id ?: return
+
+ viewModelScope.launch {
+ try {
+ val item = ditto.store.execute(
+ "SELECT * FROM tasks WHERE _id = :_id AND NOT deleted",
+ mapOf("_id" to taskId)
+ ).items.first()
+
+ val task = Task.fromJson(item.jsonString())
+ _id = task._id
+ title.postValue(task.title)
+ done.postValue(task.done)
+ } catch (e: Exception) {
+ Log.e(TAG, "Unable to setup view task data", e)
+ }
+ }
+ }
+
+ fun save() {
+ viewModelScope.launch {
+ try {
+ if (_id == null) {
+ ditto.store.execute(
+ "INSERT INTO tasks DOCUMENTS (:doc)",
+ mapOf(
+ "doc" to mapOf(
+ "title" to title.value,
+ "done" to done.value,
+ "deleted" to false
+ )
+ )
+ )
+ } else {
+ _id?.let { id ->
+ ditto.store.execute(
+ """
+ UPDATE tasks
+ SET
+ title = :title,
+ done = :done
+ WHERE _id = :id
+ AND NOT deleted
+ """,
+ mapOf(
+ "title" to title.value,
+ "done" to done.value,
+ "id" to id
+ )
+ )
+ }
+ }
+ } catch (e: Exception) {
+ Log.e(TAG, "Unable to save task", e)
+ }
+ }
+ }
+
+ fun delete() {
+ viewModelScope.launch {
+ try {
+ _id?.let { id ->
+ ditto.store.execute(
+ "UPDATE tasks SET deleted = true WHERE _id = :id",
+ mapOf("id" to id)
+ )
+ }
+ } catch (e: Exception) {
+ Log.e(TAG, "Unable to set deleted=true", e)
+ }
+ }
+ }
+}
diff --git a/android/QuickStartTasks/app/src/main/java/live/ditto/quickstart/tasks/list/TaskRow.kt b/android/QuickStartTasks/app/src/main/java/live/ditto/quickstart/tasks/list/TaskRow.kt
new file mode 100644
index 000000000..c43885895
--- /dev/null
+++ b/android/QuickStartTasks/app/src/main/java/live/ditto/quickstart/tasks/list/TaskRow.kt
@@ -0,0 +1,88 @@
+package live.ditto.quickstart.tasks.list
+
+import androidx.compose.foundation.Image
+import androidx.compose.foundation.clickable
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.Row
+import androidx.compose.material.icons.Icons
+import androidx.compose.material.icons.filled.Delete
+import androidx.compose.material.icons.outlined.Edit
+import androidx.compose.material3.Icon
+import androidx.compose.material3.IconButton
+import androidx.compose.material3.ListItem
+import androidx.compose.material3.Text
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.graphics.ColorFilter
+import androidx.compose.ui.graphics.vector.ImageVector
+import androidx.compose.ui.res.colorResource
+import androidx.compose.ui.res.vectorResource
+import androidx.compose.ui.text.style.TextDecoration
+import androidx.compose.ui.tooling.preview.Preview
+import live.ditto.quickstart.tasks.R
+import live.ditto.quickstart.tasks.data.Task
+import java.util.UUID
+
+/**
+ * A row in the task list screen
+ */
+@Composable
+fun TaskRow(
+ task: Task,
+ onToggle: ((task: Task) -> Unit)? = null,
+ onClickEdit: ((task: Task) -> Unit)? = null,
+ onClickDelete: ((task: Task) -> Unit)? = null
+) {
+
+ val iconId =
+ if (task.done) R.drawable.ic_baseline_circle_24 else R.drawable.ic_outline_circle_24
+ val color = if (task.done) R.color.blue_200 else R.color.gray
+ val textDecoration = if (task.done) TextDecoration.LineThrough else TextDecoration.None
+ ListItem(
+ headlineContent = {
+ Text(
+ text = task.title,
+ textDecoration = textDecoration
+ )
+ },
+ leadingContent = {
+ Image(
+ ImageVector.vectorResource(
+ id = iconId
+ ),
+ "Toggle",
+ colorFilter = ColorFilter.tint(colorResource(id = color)),
+ modifier = Modifier
+ .clickable { onToggle?.invoke(task) },
+ alignment = Alignment.CenterEnd
+ )
+ },
+ trailingContent = {
+ Row {
+ IconButton(onClick = { onClickEdit?.invoke(task) }) {
+ Icon(
+ imageVector = Icons.Outlined.Edit,
+ contentDescription = "Delete"
+ )
+ }
+ IconButton(onClick = { onClickDelete?.invoke(task) }) {
+ Icon(
+ imageVector = Icons.Filled.Delete,
+ contentDescription = "Delete",
+ )
+ }
+ }
+ }
+ )
+}
+
+@Preview(showBackground = true)
+@Composable
+fun TaskRowPreview() {
+ Column {
+ TaskRow(task = Task(UUID.randomUUID().toString(), "Get Milk", true, false))
+ TaskRow(task = Task(UUID.randomUUID().toString(), "Do Homework", false, false))
+ TaskRow(task = Task(UUID.randomUUID().toString(), "Take out trash", true, false))
+ }
+}
diff --git a/android/QuickStartTasks/app/src/main/java/live/ditto/quickstart/tasks/list/TasksListScreen.kt b/android/QuickStartTasks/app/src/main/java/live/ditto/quickstart/tasks/list/TasksListScreen.kt
new file mode 100644
index 000000000..502156daa
--- /dev/null
+++ b/android/QuickStartTasks/app/src/main/java/live/ditto/quickstart/tasks/list/TasksListScreen.kt
@@ -0,0 +1,209 @@
+package live.ditto.quickstart.tasks.list
+
+import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.Row
+import androidx.compose.foundation.layout.fillMaxSize
+import androidx.compose.foundation.layout.fillMaxWidth
+import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.lazy.LazyColumn
+import androidx.compose.foundation.lazy.items
+import androidx.compose.material.icons.Icons
+import androidx.compose.material.icons.filled.Add
+import androidx.compose.material.icons.filled.Warning
+import androidx.compose.material3.AlertDialog
+import androidx.compose.material3.ExperimentalMaterial3Api
+import androidx.compose.material3.ExtendedFloatingActionButton
+import androidx.compose.material3.FabPosition
+import androidx.compose.material3.FloatingActionButtonDefaults
+import androidx.compose.material3.Icon
+import androidx.compose.material3.MaterialTheme
+import androidx.compose.material3.Scaffold
+import androidx.compose.material3.Switch
+import androidx.compose.material3.Text
+import androidx.compose.material3.TextButton
+import androidx.compose.material3.TopAppBar
+import androidx.compose.material3.TopAppBarDefaults
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.livedata.observeAsState
+import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.remember
+import androidx.compose.runtime.setValue
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.res.colorResource
+import androidx.compose.ui.text.TextStyle
+import androidx.compose.ui.tooling.preview.Devices
+import androidx.compose.ui.tooling.preview.Preview
+import androidx.compose.ui.unit.dp
+import androidx.compose.ui.unit.sp
+import androidx.lifecycle.viewmodel.compose.viewModel
+import androidx.navigation.NavController
+import live.ditto.quickstart.tasks.BuildConfig
+import live.ditto.quickstart.tasks.R
+import live.ditto.quickstart.tasks.data.Task
+import java.util.UUID
+
+@OptIn(ExperimentalMaterial3Api::class)
+@Composable
+fun TasksListScreen(navController: NavController) {
+ val tasksListViewModel: TasksListScreenViewModel = viewModel()
+ val tasks: List by tasksListViewModel.tasks.observeAsState(emptyList())
+ val syncEnabled: Boolean by tasksListViewModel.syncEnabled.observeAsState(true)
+
+ var showDeleteDialog by remember { mutableStateOf(false) }
+ var deleteDialogTaskId by remember { mutableStateOf("") }
+
+ Scaffold(
+ topBar = {
+ TopAppBar(
+ title = {
+ Box(
+ modifier = Modifier
+ .fillMaxWidth()
+ .padding(8.dp)
+ ) {
+ Column {
+ Text(
+ text = "Ditto Tasks",
+ style = MaterialTheme.typography.titleMedium
+ )
+ Text(
+ text = "App ID: ${BuildConfig.DITTO_APP_ID}",
+ style = TextStyle(fontSize = 10.sp)
+ )
+ Text(
+ text = "Token: ${BuildConfig.DITTO_PLAYGROUND_TOKEN}",
+ style = TextStyle(fontSize = 10.sp)
+ )
+ }
+ }
+ },
+ colors = TopAppBarDefaults.topAppBarColors(
+ containerColor = colorResource(id = R.color.blue_700),
+ titleContentColor = Color.White
+ ),
+ actions = {
+ Row(verticalAlignment = Alignment.CenterVertically) {
+ Text(
+ text = "Sync",
+ style = MaterialTheme.typography.bodySmall,
+ modifier = Modifier.padding(end = 10.dp),
+ color = Color.White
+ )
+ Switch(
+ checked = syncEnabled,
+ onCheckedChange = { isChecked ->
+ tasksListViewModel.setSyncEnabled(isChecked)
+ }
+ )
+ }
+ }
+ )
+ },
+ floatingActionButton = {
+ ExtendedFloatingActionButton(
+ icon = { Icon(Icons.Filled.Add, "", tint = Color.White) },
+ text = { Text(text = "New Task", color = Color.White) },
+ onClick = { navController.navigate("tasks/edit") },
+ elevation = FloatingActionButtonDefaults.elevation(8.dp),
+ containerColor = colorResource(id = R.color.blue_500)
+ )
+ },
+ floatingActionButtonPosition = FabPosition.End,
+ content = { padding ->
+ Column(
+ modifier = Modifier
+ .fillMaxSize()
+ .padding(padding)
+ ) {
+ TasksList(
+ tasks = tasks,
+ onToggle = { tasksListViewModel.toggle(it) },
+ onClickEdit = {
+ navController.navigate("tasks/edit/${it}")
+ },
+ onClickDelete = {
+ deleteDialogTaskId = it
+ showDeleteDialog = true
+ }
+ )
+ }
+ }
+ )
+
+ // Alert displayed if user taps a Delete icon for a list item
+ if (showDeleteDialog) {
+ AlertDialog(
+ onDismissRequest = { showDeleteDialog = false },
+ icon = {
+ Icon(
+ imageVector = Icons.Filled.Warning,
+ contentDescription = "Warning",
+ tint = MaterialTheme.colorScheme.error
+ )
+ },
+ title = {
+ Text(
+ text = "Confirm Deletion",
+ style = MaterialTheme.typography.titleLarge
+ )
+ },
+ text = {
+ Text(text = "Are you sure you want to delete this item?")
+ },
+ confirmButton = {
+ TextButton(
+ onClick = {
+ showDeleteDialog = false
+ tasksListViewModel.delete(deleteDialogTaskId)
+ }
+ ) {
+ Text("Delete")
+ }
+ },
+ dismissButton = {
+ TextButton(onClick = { showDeleteDialog = false }) {
+ Text("Cancel")
+ }
+ }
+ )
+ }
+}
+
+@Composable
+fun TasksList(
+ tasks: List,
+ onToggle: ((taskId: String) -> Unit)? = null,
+ onClickEdit: ((taskId: String) -> Unit)? = null,
+ onClickDelete: ((taskId: String) -> Unit)? = null,
+) {
+ LazyColumn {
+ items(tasks) { task ->
+ TaskRow(
+ task = task,
+ onToggle = { onToggle?.invoke(it._id) },
+ onClickEdit = { onClickEdit?.invoke(it._id) },
+ onClickDelete = { onClickDelete?.invoke(it._id) }
+ )
+ }
+ }
+}
+
+@Preview(
+ showBackground = true,
+ showSystemUi = true,
+ device = Devices.PIXEL_3
+)
+@Composable
+fun TasksListPreview() {
+ TasksList(
+ tasks = listOf(
+ Task(UUID.randomUUID().toString(), "Get Milk", true, false),
+ Task(UUID.randomUUID().toString(), "Get Oats", false, false),
+ Task(UUID.randomUUID().toString(), "Get Berries", true, false),
+ )
+ )
+}
diff --git a/android/QuickStartTasks/app/src/main/java/live/ditto/quickstart/tasks/list/TasksListScreenViewModel.kt b/android/QuickStartTasks/app/src/main/java/live/ditto/quickstart/tasks/list/TasksListScreenViewModel.kt
new file mode 100644
index 000000000..57bf657b1
--- /dev/null
+++ b/android/QuickStartTasks/app/src/main/java/live/ditto/quickstart/tasks/list/TasksListScreenViewModel.kt
@@ -0,0 +1,148 @@
+package live.ditto.quickstart.tasks.list
+
+import android.content.Context
+import android.util.Log
+import androidx.datastore.preferences.core.booleanPreferencesKey
+import androidx.datastore.preferences.core.edit
+import androidx.datastore.preferences.preferencesDataStore
+import androidx.lifecycle.LiveData
+import androidx.lifecycle.MutableLiveData
+import androidx.lifecycle.ViewModel
+import androidx.lifecycle.viewModelScope
+import kotlinx.coroutines.flow.first
+import kotlinx.coroutines.flow.map
+import kotlinx.coroutines.launch
+import live.ditto.DittoError
+import live.ditto.DittoSyncSubscription
+import live.ditto.quickstart.tasks.DittoHandler.Companion.ditto
+import live.ditto.quickstart.tasks.TasksApplication
+import live.ditto.quickstart.tasks.data.Task
+
+// The value of the Sync switch is stored in persistent settings
+private val Context.preferencesDataStore by preferencesDataStore("tasks_list_settings")
+private val SYNC_ENABLED_KEY = booleanPreferencesKey("sync_enabled")
+
+class TasksListScreenViewModel : ViewModel() {
+
+ companion object {
+ private const val TAG = "TasksListScreenViewModel"
+
+ private const val QUERY = "SELECT * FROM tasks WHERE NOT deleted ORDER BY _id"
+ }
+
+ private val preferencesDataStore = TasksApplication.applicationContext().preferencesDataStore
+
+ val tasks: MutableLiveData> = MutableLiveData(emptyList())
+
+ private val _syncEnabled = MutableLiveData(true)
+ val syncEnabled: LiveData = _syncEnabled
+
+ private var syncSubscription: DittoSyncSubscription? = null
+
+ fun setSyncEnabled(enabled: Boolean) {
+ viewModelScope.launch {
+ preferencesDataStore.edit { settings ->
+ settings[SYNC_ENABLED_KEY] = enabled
+ }
+ _syncEnabled.value = enabled
+
+ if (enabled && !ditto.isSyncActive) {
+ try {
+ ditto.startSync()
+ syncSubscription = ditto.sync.registerSubscription(QUERY)
+ } catch (e: DittoError) {
+ Log.e(TAG, "Unable to start sync", e)
+ }
+ } else if (ditto.isSyncActive) {
+ try {
+ syncSubscription?.close()
+ syncSubscription = null
+ ditto.stopSync()
+ } catch (e: DittoError) {
+ Log.e(TAG, "Unable to stop sync", e)
+ }
+ }
+ }
+ }
+
+ init {
+ viewModelScope.launch {
+ populateTasksCollection()
+
+ ditto.store.registerObserver(QUERY) { result ->
+ val list = result.items.map { item -> Task.fromJson(item.jsonString()) }
+ tasks.postValue(list)
+ }
+
+ setSyncEnabled(
+ preferencesDataStore.data.map { prefs -> prefs[SYNC_ENABLED_KEY] ?: true }.first()
+ )
+ }
+ }
+
+ // Add initial tasks to the collection if they have not already been added.
+ private fun populateTasksCollection() {
+ viewModelScope.launch {
+ val tasks = listOf(
+ Task("50191411-4C46-4940-8B72-5F8017A04FA7", "Buy groceries"),
+ Task("6DA283DA-8CFE-4526-A6FA-D385089364E5", "Clean the kitchen"),
+ Task("5303DDF8-0E72-4FEB-9E82-4B007E5797F0", "Schedule dentist appointment"),
+ Task("38411F1B-6B49-4346-90C3-0B16CE97E174", "Pay bills")
+ )
+
+ tasks.forEach { task ->
+ try {
+ ditto.store.execute(
+ "INSERT INTO tasks INITIAL DOCUMENTS (:task)",
+ mapOf(
+ "task" to mapOf(
+ "_id" to task._id,
+ "title" to task.title,
+ "done" to task.done,
+ "deleted" to task.deleted,
+ )
+ )
+ )
+ } catch (e: Exception) {
+ Log.e(TAG, "Unable to insert initial document", e)
+ }
+ }
+ }
+ }
+
+ fun toggle(taskId: String) {
+ viewModelScope.launch {
+ try {
+ val doc = ditto.store.execute(
+ "SELECT * FROM tasks WHERE _id = :_id AND NOT deleted",
+ mapOf("_id" to taskId)
+ ).items.first()
+
+ val done = doc.value["done"] as Boolean
+
+ ditto.store.execute(
+ "UPDATE tasks SET done = :toggled WHERE _id = :_id AND NOT deleted",
+ mapOf(
+ "toggled" to !done,
+ "_id" to taskId
+ )
+ )
+ } catch (e: Exception) {
+ Log.e(TAG, "Unable to toggle done state", e)
+ }
+ }
+ }
+
+ fun delete(taskId: String) {
+ viewModelScope.launch {
+ try {
+ ditto.store.execute(
+ "UPDATE tasks SET deleted = true WHERE _id = :id",
+ mapOf("id" to taskId)
+ )
+ } catch (e: Exception) {
+ Log.e(TAG, "Unable to set deleted=true", e)
+ }
+ }
+ }
+}
diff --git a/android/QuickStartTasks/app/src/main/java/live/ditto/quickstart/tasks/ui/theme/Color.kt b/android/QuickStartTasks/app/src/main/java/live/ditto/quickstart/tasks/ui/theme/Color.kt
new file mode 100644
index 000000000..ddfb06fe6
--- /dev/null
+++ b/android/QuickStartTasks/app/src/main/java/live/ditto/quickstart/tasks/ui/theme/Color.kt
@@ -0,0 +1,11 @@
+package live.ditto.quickstart.tasks.ui.theme
+
+import androidx.compose.ui.graphics.Color
+
+val Purple80 = Color(0xFFD0BCFF)
+val PurpleGrey80 = Color(0xFFCCC2DC)
+val Pink80 = Color(0xFFEFB8C8)
+
+val Purple40 = Color(0xFF6650a4)
+val PurpleGrey40 = Color(0xFF625b71)
+val Pink40 = Color(0xFF7D5260)
\ No newline at end of file
diff --git a/android/QuickStartTasks/app/src/main/java/live/ditto/quickstart/tasks/ui/theme/Shape.kt b/android/QuickStartTasks/app/src/main/java/live/ditto/quickstart/tasks/ui/theme/Shape.kt
new file mode 100644
index 000000000..8145e4416
--- /dev/null
+++ b/android/QuickStartTasks/app/src/main/java/live/ditto/quickstart/tasks/ui/theme/Shape.kt
@@ -0,0 +1,11 @@
+package live.ditto.quickstart.tasks.ui.theme
+
+import androidx.compose.foundation.shape.RoundedCornerShape
+import androidx.compose.material3.Shapes
+import androidx.compose.ui.unit.dp
+
+val Shapes = Shapes(
+ small = RoundedCornerShape(4.dp),
+ medium = RoundedCornerShape(4.dp),
+ large = RoundedCornerShape(0.dp)
+)
diff --git a/android/QuickStartTasks/app/src/main/java/live/ditto/quickstart/tasks/ui/theme/Theme.kt b/android/QuickStartTasks/app/src/main/java/live/ditto/quickstart/tasks/ui/theme/Theme.kt
new file mode 100644
index 000000000..f729edf33
--- /dev/null
+++ b/android/QuickStartTasks/app/src/main/java/live/ditto/quickstart/tasks/ui/theme/Theme.kt
@@ -0,0 +1,58 @@
+package live.ditto.quickstart.tasks.ui.theme
+
+import android.app.Activity
+import android.os.Build
+import androidx.compose.foundation.isSystemInDarkTheme
+import androidx.compose.material3.MaterialTheme
+import androidx.compose.material3.darkColorScheme
+import androidx.compose.material3.dynamicDarkColorScheme
+import androidx.compose.material3.dynamicLightColorScheme
+import androidx.compose.material3.lightColorScheme
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.platform.LocalContext
+
+private val DarkColorScheme = darkColorScheme(
+ primary = Purple80,
+ secondary = PurpleGrey80,
+ tertiary = Pink80
+)
+
+private val LightColorScheme = lightColorScheme(
+ primary = Purple40,
+ secondary = PurpleGrey40,
+ tertiary = Pink40
+
+ /* Other default colors to override
+ background = Color(0xFFFFFBFE),
+ surface = Color(0xFFFFFBFE),
+ onPrimary = Color.White,
+ onSecondary = Color.White,
+ onTertiary = Color.White,
+ onBackground = Color(0xFF1C1B1F),
+ onSurface = Color(0xFF1C1B1F),
+ */
+)
+
+@Composable
+fun QuickStartTasksTheme(
+ darkTheme: Boolean = isSystemInDarkTheme(),
+ // Dynamic color is available on Android 12+
+ dynamicColor: Boolean = true,
+ content: @Composable () -> Unit
+) {
+ val colorScheme = when {
+ dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> {
+ val context = LocalContext.current
+ if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context)
+ }
+
+ darkTheme -> DarkColorScheme
+ else -> LightColorScheme
+ }
+
+ MaterialTheme(
+ colorScheme = colorScheme,
+ typography = Typography,
+ content = content
+ )
+}
\ No newline at end of file
diff --git a/android/QuickStartTasks/app/src/main/java/live/ditto/quickstart/tasks/ui/theme/Type.kt b/android/QuickStartTasks/app/src/main/java/live/ditto/quickstart/tasks/ui/theme/Type.kt
new file mode 100644
index 000000000..5f8eb9b7f
--- /dev/null
+++ b/android/QuickStartTasks/app/src/main/java/live/ditto/quickstart/tasks/ui/theme/Type.kt
@@ -0,0 +1,34 @@
+package live.ditto.quickstart.tasks.ui.theme
+
+import androidx.compose.material3.Typography
+import androidx.compose.ui.text.TextStyle
+import androidx.compose.ui.text.font.FontFamily
+import androidx.compose.ui.text.font.FontWeight
+import androidx.compose.ui.unit.sp
+
+// Set of Material typography styles to start with
+val Typography = Typography(
+ bodyLarge = TextStyle(
+ fontFamily = FontFamily.Default,
+ fontWeight = FontWeight.Normal,
+ fontSize = 16.sp,
+ lineHeight = 24.sp,
+ letterSpacing = 0.5.sp
+ )
+ /* Other default text styles to override
+ titleLarge = TextStyle(
+ fontFamily = FontFamily.Default,
+ fontWeight = FontWeight.Normal,
+ fontSize = 22.sp,
+ lineHeight = 28.sp,
+ letterSpacing = 0.sp
+ ),
+ labelSmall = TextStyle(
+ fontFamily = FontFamily.Default,
+ fontWeight = FontWeight.Medium,
+ fontSize = 11.sp,
+ lineHeight = 16.sp,
+ letterSpacing = 0.5.sp
+ )
+ */
+)
\ No newline at end of file
diff --git a/android/QuickStartTasks/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/android/QuickStartTasks/app/src/main/res/drawable-v24/ic_launcher_foreground.xml
new file mode 100644
index 000000000..2b068d114
--- /dev/null
+++ b/android/QuickStartTasks/app/src/main/res/drawable-v24/ic_launcher_foreground.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/android/QuickStartTasks/app/src/main/res/drawable/ic_baseline_add_24.xml b/android/QuickStartTasks/app/src/main/res/drawable/ic_baseline_add_24.xml
new file mode 100644
index 000000000..70046c48f
--- /dev/null
+++ b/android/QuickStartTasks/app/src/main/res/drawable/ic_baseline_add_24.xml
@@ -0,0 +1,5 @@
+
+
+
diff --git a/android/QuickStartTasks/app/src/main/res/drawable/ic_baseline_circle_24.xml b/android/QuickStartTasks/app/src/main/res/drawable/ic_baseline_circle_24.xml
new file mode 100644
index 000000000..a81f853f9
--- /dev/null
+++ b/android/QuickStartTasks/app/src/main/res/drawable/ic_baseline_circle_24.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/android/QuickStartTasks/app/src/main/res/drawable/ic_launcher_background.xml b/android/QuickStartTasks/app/src/main/res/drawable/ic_launcher_background.xml
new file mode 100644
index 000000000..07d5da9cb
--- /dev/null
+++ b/android/QuickStartTasks/app/src/main/res/drawable/ic_launcher_background.xml
@@ -0,0 +1,170 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/android/QuickStartTasks/app/src/main/res/drawable/ic_launcher_foreground.xml b/android/QuickStartTasks/app/src/main/res/drawable/ic_launcher_foreground.xml
new file mode 100644
index 000000000..30599a34e
--- /dev/null
+++ b/android/QuickStartTasks/app/src/main/res/drawable/ic_launcher_foreground.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
diff --git a/android/QuickStartTasks/app/src/main/res/drawable/ic_outline_circle_24.xml b/android/QuickStartTasks/app/src/main/res/drawable/ic_outline_circle_24.xml
new file mode 100644
index 000000000..c53e816c8
--- /dev/null
+++ b/android/QuickStartTasks/app/src/main/res/drawable/ic_outline_circle_24.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/android/QuickStartTasks/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/android/QuickStartTasks/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
new file mode 100644
index 000000000..6f3b755bf
--- /dev/null
+++ b/android/QuickStartTasks/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/android/QuickStartTasks/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/android/QuickStartTasks/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
new file mode 100644
index 000000000..6f3b755bf
--- /dev/null
+++ b/android/QuickStartTasks/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/android/QuickStartTasks/app/src/main/res/mipmap-hdpi/ic_launcher.webp b/android/QuickStartTasks/app/src/main/res/mipmap-hdpi/ic_launcher.webp
new file mode 100644
index 000000000..c209e78ec
Binary files /dev/null and b/android/QuickStartTasks/app/src/main/res/mipmap-hdpi/ic_launcher.webp differ
diff --git a/android/QuickStartTasks/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/android/QuickStartTasks/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp
new file mode 100644
index 000000000..b2dfe3d1b
Binary files /dev/null and b/android/QuickStartTasks/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp differ
diff --git a/android/QuickStartTasks/app/src/main/res/mipmap-mdpi/ic_launcher.webp b/android/QuickStartTasks/app/src/main/res/mipmap-mdpi/ic_launcher.webp
new file mode 100644
index 000000000..4f0f1d64e
Binary files /dev/null and b/android/QuickStartTasks/app/src/main/res/mipmap-mdpi/ic_launcher.webp differ
diff --git a/android/QuickStartTasks/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/android/QuickStartTasks/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp
new file mode 100644
index 000000000..62b611da0
Binary files /dev/null and b/android/QuickStartTasks/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp differ
diff --git a/android/QuickStartTasks/app/src/main/res/mipmap-xhdpi/ic_launcher.webp b/android/QuickStartTasks/app/src/main/res/mipmap-xhdpi/ic_launcher.webp
new file mode 100644
index 000000000..948a3070f
Binary files /dev/null and b/android/QuickStartTasks/app/src/main/res/mipmap-xhdpi/ic_launcher.webp differ
diff --git a/android/QuickStartTasks/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/android/QuickStartTasks/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp
new file mode 100644
index 000000000..1b9a6956b
Binary files /dev/null and b/android/QuickStartTasks/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp differ
diff --git a/android/QuickStartTasks/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/android/QuickStartTasks/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp
new file mode 100644
index 000000000..28d4b77f9
Binary files /dev/null and b/android/QuickStartTasks/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp differ
diff --git a/android/QuickStartTasks/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/android/QuickStartTasks/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp
new file mode 100644
index 000000000..9287f5083
Binary files /dev/null and b/android/QuickStartTasks/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp differ
diff --git a/android/QuickStartTasks/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/android/QuickStartTasks/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
new file mode 100644
index 000000000..aa7d6427e
Binary files /dev/null and b/android/QuickStartTasks/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp differ
diff --git a/android/QuickStartTasks/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/android/QuickStartTasks/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp
new file mode 100644
index 000000000..9126ae37c
Binary files /dev/null and b/android/QuickStartTasks/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp differ
diff --git a/android/QuickStartTasks/app/src/main/res/values/colors.xml b/android/QuickStartTasks/app/src/main/res/values/colors.xml
new file mode 100644
index 000000000..f6bff0fa6
--- /dev/null
+++ b/android/QuickStartTasks/app/src/main/res/values/colors.xml
@@ -0,0 +1,16 @@
+
+
+
+ #FFBB86FC
+ #FF6200EE
+ #FF3700B3
+ #FF03DAC5
+ #FF018786
+ #FF000000
+ #FFFFFFFF
+
+ #93C5FD
+ #3B82F6
+ #3B82F6
+ #95a5a6
+
diff --git a/android/QuickStartTasks/app/src/main/res/values/strings.xml b/android/QuickStartTasks/app/src/main/res/values/strings.xml
new file mode 100644
index 000000000..c27439786
--- /dev/null
+++ b/android/QuickStartTasks/app/src/main/res/values/strings.xml
@@ -0,0 +1,3 @@
+
+ QuickStart Tasks
+
\ No newline at end of file
diff --git a/android/QuickStartTasks/app/src/main/res/values/themes.xml b/android/QuickStartTasks/app/src/main/res/values/themes.xml
new file mode 100644
index 000000000..a3e77bf4d
--- /dev/null
+++ b/android/QuickStartTasks/app/src/main/res/values/themes.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/android/QuickStartTasks/app/src/main/res/xml/backup_rules.xml b/android/QuickStartTasks/app/src/main/res/xml/backup_rules.xml
new file mode 100644
index 000000000..fa0f996d2
--- /dev/null
+++ b/android/QuickStartTasks/app/src/main/res/xml/backup_rules.xml
@@ -0,0 +1,13 @@
+
+
+
+
\ No newline at end of file
diff --git a/android/QuickStartTasks/app/src/main/res/xml/data_extraction_rules.xml b/android/QuickStartTasks/app/src/main/res/xml/data_extraction_rules.xml
new file mode 100644
index 000000000..9ee9997b0
--- /dev/null
+++ b/android/QuickStartTasks/app/src/main/res/xml/data_extraction_rules.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/android/QuickStartTasks/app/src/test/java/live/ditto/quickstart/tasks/ExampleUnitTest.kt b/android/QuickStartTasks/app/src/test/java/live/ditto/quickstart/tasks/ExampleUnitTest.kt
new file mode 100644
index 000000000..b7e96934b
--- /dev/null
+++ b/android/QuickStartTasks/app/src/test/java/live/ditto/quickstart/tasks/ExampleUnitTest.kt
@@ -0,0 +1,17 @@
+package live.ditto.quickstart.tasks
+
+import org.junit.Test
+
+import org.junit.Assert.*
+
+/**
+ * Example local unit test, which will execute on the development machine (host).
+ *
+ * See [testing documentation](http://d.android.com/tools/testing).
+ */
+class ExampleUnitTest {
+ @Test
+ fun addition_isCorrect() {
+ assertEquals(4, 2 + 2)
+ }
+}
\ No newline at end of file
diff --git a/android/QuickStartTasks/build.gradle.kts b/android/QuickStartTasks/build.gradle.kts
new file mode 100644
index 000000000..c1d6f19f9
--- /dev/null
+++ b/android/QuickStartTasks/build.gradle.kts
@@ -0,0 +1,6 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+plugins {
+ alias(libs.plugins.android.application) apply false
+ alias(libs.plugins.jetbrains.kotlin.android) apply false
+}
+
diff --git a/android/QuickStartTasks/gradle.properties b/android/QuickStartTasks/gradle.properties
new file mode 100644
index 000000000..20e2a0152
--- /dev/null
+++ b/android/QuickStartTasks/gradle.properties
@@ -0,0 +1,23 @@
+# Project-wide Gradle settings.
+# IDE (e.g. Android Studio) users:
+# Gradle settings configured through the IDE *will override*
+# any settings specified in this file.
+# For more details on how to configure your build environment visit
+# http://www.gradle.org/docs/current/userguide/build_environment.html
+# Specifies the JVM arguments used for the daemon process.
+# The setting is particularly useful for tweaking memory settings.
+org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
+# When configured, Gradle will run in incubating parallel mode.
+# This option should only be used with decoupled projects. For more details, visit
+# https://developer.android.com/r/tools/gradle-multi-project-decoupled-projects
+# org.gradle.parallel=true
+# AndroidX package structure to make it clearer which packages are bundled with the
+# Android operating system, and which are packaged with your app's APK
+# https://developer.android.com/topic/libraries/support-library/androidx-rn
+android.useAndroidX=true
+# Kotlin code style for this project: "official" or "obsolete":
+kotlin.code.style=official
+# Enables namespacing of each library's R class so that its R class includes only the
+# resources declared in the library itself and none from the library's dependencies,
+# thereby reducing the size of the R class for that library
+android.nonTransitiveRClass=true
\ No newline at end of file
diff --git a/android/QuickStartTasks/gradle/libs.versions.toml b/android/QuickStartTasks/gradle/libs.versions.toml
new file mode 100644
index 000000000..a422bc6ad
--- /dev/null
+++ b/android/QuickStartTasks/gradle/libs.versions.toml
@@ -0,0 +1,39 @@
+[versions]
+agp = "8.5.2"
+kotlin = "1.9.24"
+coreKtx = "1.15.0"
+junit = "4.13.2"
+junitVersion = "1.2.1"
+espressoCore = "3.6.1"
+lifecycleRuntimeKtx = "2.8.7"
+activityCompose = "1.9.3"
+composeBom = "2024.10.01"
+navigationCompose = "2.8.3"
+runtimeLivedata = "1.7.5"
+appcompat = "1.7.0"
+datastorePreferences = "1.1.1"
+
+[libraries]
+androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
+junit = { group = "junit", name = "junit", version.ref = "junit" }
+androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
+androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
+androidx-lifecycle-runtime-ktx = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "lifecycleRuntimeKtx" }
+androidx-activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "activityCompose" }
+androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "composeBom" }
+androidx-ui = { group = "androidx.compose.ui", name = "ui" }
+androidx-ui-graphics = { group = "androidx.compose.ui", name = "ui-graphics" }
+androidx-ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling" }
+androidx-ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview" }
+androidx-ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-manifest" }
+androidx-ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4" }
+androidx-material3 = { group = "androidx.compose.material3", name = "material3" }
+androidx-navigation-compose = { module = "androidx.navigation:navigation-compose", name = "navigation-compose", version.ref = "navigationCompose" }
+androidx-runtime-livedata = { group = "androidx.compose.runtime", name = "runtime-livedata", version.ref = "runtimeLivedata" }
+androidx-appcompat = { module = "androidx.appcompat:appcompat", name = "appcompat", version.ref = "appcompat" }
+androidx-datastore-preferences = { module = "androidx.datastore:datastore-preferences", name = "datastore-preferences", version.ref = "datastorePreferences" }
+
+[plugins]
+android-application = { id = "com.android.application", version.ref = "agp" }
+jetbrains-kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
+
diff --git a/android/QuickStartTasks/gradle/wrapper/gradle-wrapper.jar b/android/QuickStartTasks/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 000000000..e708b1c02
Binary files /dev/null and b/android/QuickStartTasks/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/android/QuickStartTasks/gradle/wrapper/gradle-wrapper.properties b/android/QuickStartTasks/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 000000000..c734e3ecc
--- /dev/null
+++ b/android/QuickStartTasks/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Fri Nov 01 13:13:02 EDT 2024
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
diff --git a/android/QuickStartTasks/gradlew b/android/QuickStartTasks/gradlew
new file mode 100755
index 000000000..4f906e0c8
--- /dev/null
+++ b/android/QuickStartTasks/gradlew
@@ -0,0 +1,185 @@
+#!/usr/bin/env sh
+
+#
+# Copyright 2015 the original author or authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn () {
+ echo "$*"
+}
+
+die () {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+ NONSTOP* )
+ nonstop=true
+ ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin or MSYS, switch paths to Windows format before running java
+if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+
+ JAVACMD=`cygpath --unix "$JAVACMD"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=`expr $i + 1`
+ done
+ case $i in
+ 0) set -- ;;
+ 1) set -- "$args0" ;;
+ 2) set -- "$args0" "$args1" ;;
+ 3) set -- "$args0" "$args1" "$args2" ;;
+ 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Escape application args
+save () {
+ for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
+ echo " "
+}
+APP_ARGS=`save "$@"`
+
+# Collect all arguments for the java command, following the shell quoting and substitution rules
+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
+
+exec "$JAVACMD" "$@"
diff --git a/android/QuickStartTasks/settings.gradle.kts b/android/QuickStartTasks/settings.gradle.kts
new file mode 100644
index 000000000..4625a84ae
--- /dev/null
+++ b/android/QuickStartTasks/settings.gradle.kts
@@ -0,0 +1,24 @@
+pluginManagement {
+ repositories {
+ google {
+ content {
+ includeGroupByRegex("com\\.android.*")
+ includeGroupByRegex("com\\.google.*")
+ includeGroupByRegex("androidx.*")
+ }
+ }
+ mavenCentral()
+ gradlePluginPortal()
+ }
+}
+dependencyResolutionManagement {
+ repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
+ repositories {
+ google()
+ mavenCentral()
+ }
+}
+
+rootProject.name = "QuickStart Tasks"
+include(":app")
+
\ No newline at end of file
diff --git a/android/README.md b/android/README.md
index 3885b07e0..0078d5759 100644
--- a/android/README.md
+++ b/android/README.md
@@ -17,3 +17,85 @@ After you have completed the [common prerequisites] you will need the following:
- [Kotlin SDK Release Notes](https://docs.ditto.live/release-notes/kotlin)
[common prerequisites]: https://github.com/getditto/quickstart#common-prerequisites
+
+## Building and Running the Android Application
+
+Assuming you have Android Studio and other prerequisites installed, you can
+build and run the app by following these steps:
+
+1. Create an application at . Make note of the app ID and online playground token.
+2. Copy the `.env.template` file at the top level of the `quickstart` repo to `.env` and add your app ID and online playground token.
+3. Launch Android Studio and open the `quickstart/android` directory.
+4. In Android Studio, select a connected Android device, or create and launch an Android emulator and select it as the destination, then choose the **Run > Run 'app'** menu item.
+
+The app will build and run on the selected device or emulator. You can add,
+edit, and delete tasks in the app.
+
+If you run the app on additional devices or emulators, the data will be synced
+between them.
+
+## A Guided Tour of the Android App Source Code
+
+The Android app is a simple to-do list app that demonstrates how to use the
+Ditto Android SDK to sync data with other devices.
+It is implemented using [Kotlin](https://kotlinlang.org/) and
+[Jetpack Compose](https://developer.android.com/compose), which is a modern
+toolkit for building native Android UI.
+
+It is assumed that the reader is familiar with Android development and with
+Compose, but needs some guidance on how to use Ditto. The following is a
+summary of the key parts of integration with Ditto.
+
+### Adding the Ditto SDK
+
+At the bottom of `app/build.gradle.kts`, you will see this line that causes
+Android Studio to automatically download the Ditto SDK from Maven Central and
+add it to the project:
+
+```kotlin
+ implementation("live.ditto:ditto:4.8.2")
+```
+
+To use a newer version of the SDK, change the version number in this line.
+
+### Initializing Ditto
+
+In `app/src/main/java/live/ditto/quickstart/tasks/TasksApplication.kt`, you will
+see the `TasksApplication` class. This class is a subclass of `Application`.
+Its `onCreate()` method, which is called by the system when the app is launched,
+calls `setupDitto()`, which gets application ID and online playground token from
+the build configuration and uses it to create an instance of the `Ditto` class
+which is stored in a singleton object of the `DittoHandler` class.
+
+Other classes import `live.ditto.quickstart.tasks.DittoHandler.Companion.ditto`
+to access the singleton `Ditto` instance.
+
+### The Task Data Model
+
+The task data model is implemented as a Kotlin data class in
+`app/src/main/java/live/ditto/quickstart/tasks/data/Task.kt`. This class has
+properties `_id`, `title`, `done`, and `deleted`. The `_id` property is a
+unique identifier for the task, and the `deleted` property is used to mark tasks
+that have been deleted but are still present in the store.
+
+This class has a `fromJson()` method that can be used to convert the JSON data
+returned by the Ditto store into a `Task` object, which can then be used by
+Kotlin code.
+
+### The Tasks List
+
+The main screen is a list of all tasks. This is implemented in
+`app/src/main/java/live/ditto/quickstart/tasks/list/TasksListScreen.kt`. The
+associated view model is in
+`app/src/main/java/live/ditto/quickstart/tasks/list/TasksListScreenViewModel.kt`,
+which is where all the code is for retrieving data from the Ditto store and
+converting it into objects that can be displayed onscreen.
+
+### The Edit Screen
+
+The edit screen allows the user to enter a new task or to edit an existing task.
+It is implemented in
+`app/src/main/java/live/ditto/quickstart/tasks/list/edit/EditScreen.kt`. The
+associated view model is in
+`app/src/main/java/live/ditto/quickstart/tasks/list/edit/EditScreenViewModel.kt`,
+and this contains the associated code for manipulating data in the Ditto store.