Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#!/usr/bin/env bash

# Copy this file from ".env.sample" to ".env", then fill in these values
# A Ditto AppID and Playground token can be obtained from https://portal.ditto.live
DITTO_APP_ID=""
DITTO_PLAYGROUND_TOKEN=""
DITTO_AUTH_URL=""
DITTO_WEBSOCKET_URL=""
# A Ditto Database ID and development token can be obtained from https://portal.ditto.live
DITTO_DATABASE_ID=""
DITTO_DEVELOPMENT_TOKEN=""
DITTO_SERVER_URL=""
19 changes: 19 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Line-ending policy for the published Quickstart apps.
#
# The publish step (scripts/ci/quickstart/publish_quickstart.sh) exports this
# subtree with `git archive HEAD:quickstart`, which resolves .gitattributes
# relative to THIS directory. Without a .gitattributes here, the monorepo-root
# .gitattributes EOL rules are not applied to the published output, so every
# file is exported with LF -- dropping the CRLF that Windows batch files
# require. These rules are a stricter LF-forcing variant of the root policy
# (a blanket `eol=lf` rather than the root's platform-dependent `text=auto`,
# plus an explicit `*.cmd` rule) so the published getditto/quickstart repo
# (and this subtree) get deterministic, convention-correct line endings.

# Normalize all text to LF in the repository and on checkout/export
# (matches the repo-root .editorconfig `end_of_line = lf`).
* text=auto eol=lf

# Windows batch/command scripts require CRLF for cmd.exe.
*.bat text eol=crlf
*.cmd text eol=crlf
27 changes: 17 additions & 10 deletions .github/actions/seed-ditto-document/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@ description: 'Creates a test document in Ditto Cloud with inverted timestamp for
author: 'Ditto'

inputs:
ditto-api-key:
description: 'Ditto API key for authentication'
ditto-app-id:
description: 'Ditto App ID'
required: true
ditto-api-url:
description: 'Ditto API URL (e.g., cloud.ditto.live)'
ditto-development-token:
description: 'Ditto Development Token for authentication'
required: true
Comment on lines +6 to 11

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#2seed-ditto-document action inputs were renamed, but its 5 CI callers were not updated.

This action now requires ditto-app-id and ditto-development-token (and made ditto-api-url optional), but the following workflow steps still pass the removed ditto-api-key: input and never supply the new required ones:

  • .github/workflows/cpp-tui-ci.yml:95
  • .github/workflows/dotnet-tui-ci.yml:99
  • .github/workflows/dotnet-winforms-ci.yml:95
  • .github/workflows/javascript-tui-ci.yml:104
  • .github/workflows/rust-tui-ci.yml:121

Composite actions fail hard on missing required inputs, so each of these integration-test jobs will fail at this step regardless of the broader env-var rename (see general PR comment on the env-var mismatch).

Posted via /pr-post-review-findings, from the review above.

ditto-api-url:
description: 'Ditto Cloud URL Endpoint host (no scheme), e.g. <app-id>.cloud.ditto.live. Overrides the default {app-id}.cloud.ditto.live host when set.'
required: false
default: ''
app-name:
description: 'Name of the app/platform being tested (e.g., android-kotlin, swift, etc.)'
required: true
Expand All @@ -31,6 +35,7 @@ runs:
id: seed
shell: bash
run: |
set -euo pipefail
# Generate inverted timestamp for top position in list
TIMESTAMP=$(date +%s)
INVERTED_TIMESTAMP=$((9999999999 - TIMESTAMP))
Expand All @@ -45,9 +50,11 @@ runs:
echo "📝 Timestamp: ${TIMESTAMP} → Inverted: ${INVERTED_TIMESTAMP}"

# Insert document using Ditto API v4
RESPONSE=$(curl -s -w "\n%{http_code}" -X POST \
DITTO_HOST="${{ inputs.ditto-api-url }}"
DITTO_HOST="${DITTO_HOST:-${{ inputs.ditto-app-id }}.cloud.ditto.live}"
RESPONSE=$(curl -sS -w "\n%{http_code}" -X POST \
-H 'Content-type: application/json' \
-H "Authorization: Bearer ${{ inputs.ditto-api-key }}" \
-H "Authorization: Bearer ${{ inputs.ditto-development-token }}" \
-d "{
\"statement\": \"INSERT INTO tasks DOCUMENTS (:newTask) ON ID CONFLICT DO UPDATE\",
\"args\": {
Expand All @@ -59,7 +66,7 @@ runs:
}
}
}" \
"https://${{ inputs.ditto-api-url }}/api/v4/store/execute")
"https://${DITTO_HOST}/api/v4/store/execute")

# Extract HTTP status code and response body (portable version)
HTTP_CODE=$(echo "$RESPONSE" | tail -n1)
Expand All @@ -68,9 +75,9 @@ runs:
# Check if insertion was successful
if [ "$HTTP_CODE" -eq 200 ] || [ "$HTTP_CODE" -eq 201 ]; then
echo "✅ Successfully inserted test document"
echo "document_id=${DOC_ID}" >> $GITHUB_OUTPUT
echo "document_title=${DOC_TITLE}" >> $GITHUB_OUTPUT
echo "inverted_timestamp=${INVERTED_TIMESTAMP}" >> $GITHUB_OUTPUT
echo "document_id=${DOC_ID}" >> "$GITHUB_OUTPUT"
echo "document_title=${DOC_TITLE}" >> "$GITHUB_OUTPUT"
echo "inverted_timestamp=${INVERTED_TIMESTAMP}" >> "$GITHUB_OUTPUT"
else
echo "❌ Failed to insert document. HTTP Status: $HTTP_CODE"
echo "Response: $BODY"
Expand Down
82 changes: 41 additions & 41 deletions .github/browserstack-devices.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,95 +16,95 @@
# Android Java QuickStart
android-java:
devices:
- "Google Pixel 8-14.0" # Latest Android 14
- "Samsung Galaxy S23-13.0" # Popular flagship, Android 13
- "Google Pixel 6-12.0" # Android 12 support
- "OnePlus 9-11.0" # Android 11 minimum baseline
- 'Google Pixel 8-14.0' # Latest Android 14
- 'Samsung Galaxy S23-13.0' # Popular flagship, Android 13
- 'Google Pixel 6-12.0' # Android 12 support
- 'OnePlus 9-11.0' # Android 11 minimum baseline

# Android Kotlin QuickStart
android-kotlin:
devices:
- "Google Pixel 8-14.0" # Latest Android 14
- "Samsung Galaxy S23-13.0" # Popular flagship, Android 13
- "Google Pixel 6-12.0" # Android 12 support
- "OnePlus 9-11.0" # Android 11 minimum baseline
- 'Google Pixel 8-14.0' # Latest Android 14
- 'Samsung Galaxy S23-13.0' # Popular flagship, Android 13
- 'Google Pixel 6-12.0' # Android 12 support
- 'OnePlus 9-11.0' # Android 11 minimum baseline

# Flutter QuickStart (multi-platform)
flutter:
android:
devices:
- "Google Pixel 7-13.0" # Android 13 baseline
- "Samsung Galaxy S23-13.0" # Popular flagship
- "Google Pixel 6-12.0" # Android 12 support
- 'Google Pixel 7-13.0' # Android 13 baseline
- 'Samsung Galaxy S23-13.0' # Popular flagship
- 'Google Pixel 6-12.0' # Android 12 support
ios:
devices:
- "iPhone 13-16" # iOS 16 support (min deployment target is 15.6)
- "iPhone 14-16" # iOS 16 current
- "iPhone 12-17" # iOS 17 latest
- 'iPhone 13-16' # iOS 16 support (min deployment target is 15.6)
- 'iPhone 14-16' # iOS 16 current
- 'iPhone 12-17' # iOS 17 latest

# Kotlin Multiplatform QuickStart
kotlin-multiplatform:
android:
devices:
- "Google Pixel 8-14.0" # Latest Android 14
- "Samsung Galaxy S23-13.0" # Popular flagship
- 'Google Pixel 8-14.0' # Latest Android 14
- 'Samsung Galaxy S23-13.0' # Popular flagship

# React Native QuickStart
react-native:
android:
devices:
- "Samsung Galaxy S22-12.0" # Android 12
- "Google Pixel 7-13.0" # Android 13
- 'Samsung Galaxy S22-12.0' # Android 12
- 'Google Pixel 7-13.0' # Android 13
ios:
devices:
- "iPhone 15-17.0" # Latest iOS 17
- "iPhone 14-16.0" # iOS 16 support
- 'iPhone 15-17.0' # Latest iOS 17
- 'iPhone 14-16.0' # iOS 16 support

# React Native Expo QuickStart
react-native-expo:
android:
devices:
- "Samsung Galaxy S22-12.0" # Android 12
- "Google Pixel 7-13.0" # Android 13
- 'Samsung Galaxy S22-12.0' # Android 12
- 'Google Pixel 7-13.0' # Android 13
ios:
devices:
- "iPhone 15-17.0" # Latest iOS 17
- "iPhone 14-16.0" # iOS 16 support
- 'iPhone 15-17.0' # Latest iOS 17
- 'iPhone 14-16.0' # iOS 16 support

# .NET MAUI QuickStart (multi-platform)
dotnet-maui:
android:
devices:
- "Google Pixel 8-14.0" # Latest Android 14
- "Samsung Galaxy S23-13.0" # Popular flagship
- 'Google Pixel 8-14.0' # Latest Android 14
- 'Samsung Galaxy S23-13.0' # Popular flagship
ios:
devices:
- "iPhone 15-17.0" # Latest iOS 17
- "iPhone 14-16.0" # iOS 16 support
- 'iPhone 15-17.0' # Latest iOS 17
- 'iPhone 14-16.0' # iOS 16 support

# Swift/iOS QuickStart
swift:
devices:
- "iPhone 15 Pro-17" # Latest flagship with iOS 17
- 'iPhone 15 Pro-17' # Latest flagship with iOS 17

# Java Spring (web application)
# Tests web app in desktop browsers using Selenium WebDriver
java-spring:
platforms:
- os: "Windows"
osVersion: "11"
browserName: "Chrome"
browserVersion: "latest" # Always test latest Chrome
- os: 'Windows'
osVersion: '11'
browserName: 'Chrome'
browserVersion: 'latest' # Always test latest Chrome

# JavaScript Web (React web application)
# Tests web app in multiple desktop browsers
javascript-web:
browsers:
- browser: "Chrome"
browser_version: "120.0"
os: "Windows"
os_version: "11"
- browser: "Firefox"
browser_version: "121.0"
os: "Windows"
os_version: "11"
- browser: 'Chrome'
browser_version: '120.0'
os: 'Windows'
os_version: '11'
- browser: 'Firefox'
browser_version: '121.0'
os: 'Windows'
os_version: '11'
1 change: 1 addition & 0 deletions AGENTS.md
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright ©️ 2024 DittoLive, Inc.
Copyright ©️ 2026 DittoLive, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ For support, please contact Ditto Support (<support@ditto.com>).

The Ditto SDK requires you to provide an identity for your application, which may be
generated using the [Ditto Portal](https://portal.ditto.live/). For the purposes of these
quickstart applications, we'll be using the "Online Playground" identity type.
quickstart applications, we'll be using the "Development" identity type.

![Ditto Portal](.github/assets/ditto-portal.png)

> [!IMPORTANT]
> The Online Playground identity type is _not_ suitable for production use. It is intended
> The Development identity type is _not_ suitable for production use. It is intended
> only for development and testing purposes.

To obtain your Ditto identity and configure the quickstart apps with it, follow these steps:
Expand All @@ -27,7 +27,7 @@ To obtain your Ditto identity and configure the quickstart apps with it, follow
1. Copy the `.env.sample` file to `.env`.
- in a terminal: `cp .env.sample .env`.
- in a macOS Finder window, press `⇧⌘.` (SHIFT+CMD+period) to show hidden files.
1. Save your App ID, Online Playground Token, Auth URL, and WebSocket URL in the `.env` file.
1. Save your Database ID, Development Token, and Server URL in the `.env` file.

Please see the app-specific README files for details on the tools necessary to
build and run them.
Expand All @@ -36,13 +36,16 @@ build and run them.

- [Android Kotlin](android-kotlin/README.md)
- [Android Java](android-java/README.md)
- [Kotlin Multiplatform](kotlin-multiplatform/README.md)
- [Java Server](java-server/README.md)
- [C++ TUI](cpp-tui/README.md)
- [C# .NET MAUI](dotnet-maui/README.md)
- [C# .NET TUI](dotnet-tui/README.md)
- [C# .NET Win Forms](dotnet-winforms/README.md)
- [C# .NET Win Forms (.NET Framework 4.8)](dotnet-winforms-net48/README.md)
- [Electron](electron/README.md)
- [Flutter](flutter_quickstart/README.md)
- [Flutter](flutter_app/README.md)
- [Go TUI](go-tui/README.md)
- [Javascript TUI](javascript-tui/README.md)
- [Javascript Web](javascript-web/README.md)
- [React Native](react-native/README.md)
Expand Down
15 changes: 3 additions & 12 deletions android-java/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ After you have completed the [common prerequisites] you will need the following:
## Documentation

- [Install Guide](https://docs.ditto.live/sdk/latest/install-guides/java/android)
- [API Reference](https://software.ditto.live/android/Ditto/5.0.0/api-reference/)
- [API Reference](https://docs.ditto.live/sdk/latest/api-reference/kotlin)
- [SDK Release Notes](https://docs.ditto.live/sdk/latest/release-notes/java)

[common prerequisites]: https://github.com/getditto/quickstart#common-prerequisites
Expand All @@ -23,8 +23,8 @@ After you have completed the [common prerequisites] you will need the following:
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 <https://portal.ditto.live/>. Make note of the database ID (used to be called app ID) and online playground token.
2. Copy the `.env.sample` file at the top level of the `quickstart` repo to `.env` and add your Database ID (used to be called AppId), Online Playground Token, and Auth URL.
1. Create an application at <https://portal.ditto.live/>. Make note of the database ID and development token.
2. Copy the `.env.sample` file at the top level of the `quickstart` repo to `.env` and add your Database ID, Development Token, and Server URL.
3. Launch Android Studio and open the `quickstart/android-java` 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.

Expand All @@ -50,12 +50,3 @@ to download the Ditto SDK from Maven Central and add it to the project:
```kotlin
implementation(libs.ditto)
```

This line in `gradle/libs.versions.toml` specifies which version of the Ditto
SDK to use:

```kotlin
ditto = "5.0.0"
```

To use a newer version of the SDK, change the version number on this line.
28 changes: 14 additions & 14 deletions android-java/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ fun loadEnvProperties(): Properties {
FileInputStream(envFile).use { properties.load(it) }
} else {
val requiredEnvVars = listOf(
"DITTO_APP_ID",
"DITTO_PLAYGROUND_TOKEN",
"DITTO_AUTH_URL"
"DITTO_DATABASE_ID",
"DITTO_DEVELOPMENT_TOKEN",
"DITTO_SERVER_URL"
)

for (envVar in requiredEnvVars) {
Expand All @@ -30,8 +30,8 @@ fun loadEnvProperties(): Properties {
return properties
}

// Define BuildConfig.DITTO_APP_ID, BuildConfig.DITTO_PLAYGROUND_TOKEN,
// and BuildConfig.DITTO_AUTH_URL based on values in the .env file
// Define BuildConfig.DITTO_DATABASE_ID, BuildConfig.DITTO_DEVELOPMENT_TOKEN,
// and BuildConfig.DITTO_SERVER_URL based on values in the .env file
//
// More information can be found here:
// https://docs.ditto.live/sdk/latest/install-guides/java/android#integrating-and-initializing
Expand All @@ -43,28 +43,28 @@ androidComponents {
onVariants {
val prop = loadEnvProperties()
it.buildConfigFields.put(
"DITTO_APP_ID",
"DITTO_DATABASE_ID",
BuildConfigField(
"String",
"\"${envValue(prop, "DITTO_APP_ID")}\"",
"Ditto application ID"
"\"${envValue(prop, "DITTO_DATABASE_ID")}\"",
"Ditto database ID"
)
)
it.buildConfigFields.put(
"DITTO_PLAYGROUND_TOKEN",
"DITTO_DEVELOPMENT_TOKEN",
BuildConfigField(
"String",
"\"${envValue(prop, "DITTO_PLAYGROUND_TOKEN")}\"",
"Ditto online playground authentication token"
"\"${envValue(prop, "DITTO_DEVELOPMENT_TOKEN")}\"",
"Ditto development authentication token"
)
)

it.buildConfigFields.put(
"DITTO_AUTH_URL",
"DITTO_SERVER_URL",
BuildConfigField(
"String",
"\"${envValue(prop, "DITTO_AUTH_URL")}\"",
"Ditto Auth URL"
"\"${envValue(prop, "DITTO_SERVER_URL")}\"",
"Ditto Server URL"
)
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ import java.util.function.Consumer
object DittoHelper {

@JvmStatic
fun createDitto(appId: String, serverUrl: String): Ditto {
fun createDitto(databaseId: String, serverUrl: String): Ditto {
val config = DittoConfig(
databaseId = appId,
databaseId = databaseId,
connect = DittoConfig.Connect.Server(serverUrl)
)
return DittoFactory.create(config)
Expand Down
Loading
Loading