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
18 changes: 18 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# 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 mirror the root policy 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-playground-token:
Comment on lines 5 to +9
description: 'Ditto Playground Token for authentication'
required: true
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' \
Comment on lines 52 to 56
-H "Authorization: Bearer ${{ inputs.ditto-api-key }}" \
-H "Authorization: Bearer ${{ inputs.ditto-playground-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'
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
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion android-java/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[versions]
ditto = "5.0.0"
ditto = "5.0.2"
agp = "8.7.3"
kotlin = "2.0.0"
coreKtx = "1.10.1"
Expand Down
2 changes: 1 addition & 1 deletion android-kotlin/QuickStartTasks/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ appcompat = "1.7.1"
datastorePreferences = "1.2.1"
koin-bom = "4.2.1"
coroutines-tests = "1.10.2"
ditto = "5.0.0"
ditto = "5.0.2"
monitor = "1.8.0"
json = "20240303"

Expand Down
2 changes: 1 addition & 1 deletion cpp-tui/taskscpp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
BUILD_TYPE ?= Debug

# Ditto SDK version and platform detection
DITTO_SDK_VERSION ?= 4.14.3
DITTO_SDK_VERSION ?= 5.0.2
PLATFORM := $(shell uname -s | tr '[:upper:]' '[:lower:]')
ARCH := $(shell uname -m)

Expand Down
20 changes: 3 additions & 17 deletions cpp-tui/taskscpp/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,8 @@ int main(int argc, const char *argv[]) {
cxxopts::value<string>(), "APP_ID")
("online-playground-token", "Ditto Online Playground token",
cxxopts::value<string>(), "TOKEN")
("websocket-url", "Ditto WebSocket URL",
cxxopts::value<string>(), "WEBSOCKET_URL")
("auth-url", "Ditto Auth URL",
cxxopts::value<string>(), "AUTH_URL")
("enable-cloud-sync", "Enable cloud synchronization");
cxxopts::value<string>(), "AUTH_URL");

options.add_options("Logging")
("q,quiet", "Disable non-logging output")
Expand All @@ -107,8 +104,6 @@ int main(int argc, const char *argv[]) {
("info", "Info-level logging")
("debug", "Debug-level logging")
("v,verbose","Trace-level logging")
("log","Log file output path",
cxxopts::value<string>(), "PATH")
("export", "Export-log file path",
cxxopts::value<string>(), "PATH")
("ditto-sdk-version", "Print the Ditto SDK version");
Expand Down Expand Up @@ -169,10 +164,6 @@ int main(int argc, const char *argv[]) {
}
set_minimum_log_level(log_level);

if (opt_parse.count("log") > 0) {
set_log_file(opt_parse["log"].as<string>());
}

if (opt_parse.count("export") > 0) {
export_log_path = opt_parse["export"].as<string>();
}
Expand All @@ -191,24 +182,19 @@ int main(int argc, const char *argv[]) {
opt_parse.count("online-playground-token") > 0
? opt_parse["online-playground-token"].as<string>()
: DITTO_PLAYGROUND_TOKEN;
const auto websocket_url = opt_parse.count("websocket-url") > 0
? opt_parse["websocket-url"].as<string>()
: DITTO_WEBSOCKET_URL;
const auto auth_url = opt_parse.count("auth-url") > 0
? opt_parse["auth-url"].as<string>()
: DITTO_AUTH_URL;

const auto enable_cloud_sync = opt_parse.count("enable-cloud-sync") > 0;

const auto quiet = opt_parse["quiet"].as<bool>();

// Set this true if we make modifications and need to allow post-sync time.
bool need_post_sync = false;

// The peer is destroyed at the end of this scope
{
TasksPeer peer(app_id, online_playground_token, websocket_url, auth_url,
enable_cloud_sync, persistence_dir);
TasksPeer peer(app_id, online_playground_token, auth_url,
persistence_dir);
peer.insert_initial_tasks();
peer.start_sync();

Expand Down
30 changes: 13 additions & 17 deletions cpp-tui/taskscpp/src/tasks_log.cpp
Original file line number Diff line number Diff line change
@@ -1,37 +1,33 @@
#include "tasks_log.h"

// These functions are all thin wrappers over the ditto::Log() API. Application
// code should call these rather than the ditto::Log() API to make it easy to
// change or extend the logging implementation.
// These functions are all thin wrappers over the ditto::Logger API.
// Application code should call these rather than the ditto::Logger API to make
// it easy to change or extend the logging implementation.

void log_error(const std::string &msg) { ditto::Log::e(msg); }
void log_error(const std::string &msg) { ditto::Logger::e(msg); }

void log_warning(const std::string &msg) { ditto::Log::w(msg); }
void log_warning(const std::string &msg) { ditto::Logger::w(msg); }

void log_info(const std::string &msg) { ditto::Log::i(msg); }
void log_info(const std::string &msg) { ditto::Logger::i(msg); }

void log_debug(const std::string &msg) { ditto::Log::d(msg); }
void log_debug(const std::string &msg) { ditto::Logger::d(msg); }

void log_verbose(const std::string &msg) { ditto::Log::v(msg); }
void log_verbose(const std::string &msg) { ditto::Logger::v(msg); }

bool get_logging_enabled() { return ditto::Log::get_logging_enabled(); }
bool get_logging_enabled() { return ditto::Logger::get_logging_enabled(); }

void set_logging_enabled(bool enabled) {
ditto::Log::set_logging_enabled(enabled);
ditto::Logger::set_logging_enabled(enabled);
}

ditto::LogLevel get_minimum_log_level() {
return ditto::Log::get_minimum_log_level();
return ditto::Logger::get_minimum_log_level();
}

void set_minimum_log_level(ditto::LogLevel level) {
ditto::Log::set_minimum_log_level(level);
ditto::Logger::set_minimum_log_level(level);
}

void set_log_file(const std::string &path) { ditto::Log::set_log_file(path); }

void disable_log_file() { ditto::Log::disable_log_file(); }

void export_log(const std::string &path) {
ditto::Log::export_to_file(path).get();
ditto::Logger::export_to_file(path).get();
}
3 changes: 0 additions & 3 deletions cpp-tui/taskscpp/src/tasks_log.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ void set_logging_enabled(bool enabled);
ditto::LogLevel get_minimum_log_level();
void set_minimum_log_level(ditto::LogLevel level);

void set_log_file(const std::string &path);
void disable_log_file();

void export_log(const std::string &path);

#endif // DITTO_QUICKSTART_TASKS_LOG_H
Loading
Loading