Skip to content
Closed
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
16 changes: 8 additions & 8 deletions flutter_app/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
PODS:
- ditto_live (4.13.1):
- DittoFlutter (= 4.13.1)
- ditto_live (5.0.0-experimental-flutter-publish-fixes.2):
- DittoFlutter (= 5.0.0-experimental-flutter-publish-fixes.2)
- Flutter
- DittoFlutter (4.13.1)
- DittoFlutter (5.0.0-experimental-flutter-publish-fixes.2)
- Flutter (1.0.0)
- integration_test (0.0.1):
- Flutter
Expand Down Expand Up @@ -36,12 +36,12 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/permission_handler_apple/ios"

SPEC CHECKSUMS:
ditto_live: 93459c7d7c067ba16d4104925ea80c54dd13bf67
DittoFlutter: 26e21d5665e9bcc11660c4eceb1ec66b8ba64667
ditto_live: 94fc63c78e29048e62d47f9e24e09eec5812ea00
DittoFlutter: b4d9d0da05ff81972d7471b5e7f67d1931dbd1c3
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
integration_test: 252f60fa39af5e17c3aa9899d35d908a0721b573
path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46
permission_handler_apple: 9878588469a2b0d0fc1e048d9f43605f92e6cec2
integration_test: 4a889634ef21a45d28d50d622cf412dc6d9f586e
path_provider_foundation: 080d55be775b7414fd5a5ef3ac137b97b097e564
permission_handler_apple: 4ed2196e43d0651e8ff7ca3483a069d469701f2d

PODFILE CHECKSUM: 1959d098c91d8a792531a723c4a9d7e9f6a01e38

Expand Down
50 changes: 23 additions & 27 deletions flutter_app/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class DittoExample extends StatefulWidget {

class _DittoExampleState extends State<DittoExample> {
Ditto? _ditto;
final appID =
final databaseID =
dotenv.env['DITTO_APP_ID'] ?? (throw Exception("env not found"));
final token = dotenv.env['DITTO_PLAYGROUND_TOKEN'] ??
(throw Exception("env not found"));
Expand All @@ -46,11 +46,10 @@ class _DittoExampleState extends State<DittoExample> {
/// This function:
/// 1. Requests required Bluetooth and WiFi permissions on mobile platforms (Android/iOS)
/// 2. Initializes the Ditto SDK
/// 3. Sets up online playground identity with the provided app ID and token
/// 4. Enables peer-to-peer communication on non-web platforms
/// 5. Configures WebSocket connection to Ditto cloud
/// 6. Disables DQL strict mode
/// 7. Starts sync and updates the app state with the configured Ditto instance
/// 3. Creates a DittoConfig with the database ID and connect server URL
/// 4. Opens a Ditto peer with the provided database ID and auth URL
/// 5. Sets up an authentication expiration handler that authenticates the peer periodically
/// 6. Starts sync and updates the app state with the configured Ditto instance
Future<void> _initDitto() async {
// Skip permissions in test mode - they block integration tests
const isTestMode =
Expand All @@ -70,26 +69,23 @@ class _DittoExampleState extends State<DittoExample> {

await Ditto.init();

final identity = OnlinePlaygroundIdentity(
appID: appID,
token: token,
enableDittoCloudSync:
false, // This is required to be set to false to use the correct URLs
customAuthUrl: authUrl);

final ditto = await Ditto.open(identity: identity);
final config = DittoConfig(
databaseID: databaseID,
connect: DittoConfigConnectServer(
url: authUrl!,
),
);
final ditto = await Ditto.open(config);

ditto.updateTransportConfig((config) {
// Note: this will not enable peer-to-peer sync on the web platform
config.setAllPeerToPeerEnabled(true);
config.connect.webSocketUrls.add(websocketUrl);
ditto.auth.setExpirationHandler((ditto, secondsRemaining) {
ditto.auth.login(
token: token,
// FIXME: Should be a çonstant (see SDKS-2594)
provider: "__playgroundProvider",
);
});

// Disable DQL strict mode
// https://docs.ditto.live/dql/strict-mode
await ditto.store.execute("ALTER SYSTEM SET DQL_STRICT_MODE = false");

ditto.startSync();
ditto.sync.start();

if (mounted) {
setState(() => _ditto = ditto);
Expand Down Expand Up @@ -161,18 +157,18 @@ class _DittoExampleState extends State<DittoExample> {
);

Widget get _portalInfo => Column(children: [
Text("AppID: $appID"),
Text("DatabaseID: $databaseID"),
Text("Token: $token"),
]);

Widget get _syncTile => SwitchListTile(
title: const Text("Sync Active"),
value: _ditto!.isSyncActive,
value: _ditto!.sync.isActive,
onChanged: (value) {
if (value) {
setState(() => _ditto!.startSync());
setState(() => _ditto!.sync.start());
} else {
setState(() => _ditto!.stopSync());
setState(() => _ditto!.sync.stop());
}
},
);
Expand Down
12 changes: 6 additions & 6 deletions flutter_app/macos/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
PODS:
- ditto_live (4.13.1):
- DittoFlutter (= 4.13.1)
- ditto_live (5.0.0-experimental-flutter-publish-fixes.2):
- DittoFlutter (= 5.0.0-experimental-flutter-publish-fixes.2)
- FlutterMacOS
- DittoFlutter (4.13.1)
- DittoFlutter (5.0.0-experimental-flutter-publish-fixes.2)
- FlutterMacOS (1.0.0)
- path_provider_foundation (0.0.1):
- Flutter
Expand All @@ -26,10 +26,10 @@ EXTERNAL SOURCES:
:path: Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin

SPEC CHECKSUMS:
ditto_live: a46b3eba63227c95adffe6094d3153a74c060d0c
DittoFlutter: 26e21d5665e9bcc11660c4eceb1ec66b8ba64667
ditto_live: 28fc7573ba3213d0188de06bd03643e6b640008c
DittoFlutter: b4d9d0da05ff81972d7471b5e7f67d1931dbd1c3
FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24
path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46
path_provider_foundation: 080d55be775b7414fd5a5ef3ac137b97b097e564

PODFILE CHECKSUM: 7eb978b976557c8c1cd717d8185ec483fd090a82

Expand Down
4 changes: 2 additions & 2 deletions flutter_app/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ packages:
dependency: "direct main"
description:
name: ditto_live
sha256: f095d52ec464e0c50323a4c37717a4e4727c00c035be8e11c0120b5bac927103
sha256: "589c5f4be8f394e1525eef24d8881774a017c21c6bec2ffd0c81d02c2b8edad2"
url: "https://pub.dev"
source: hosted
version: "4.13.1"
version: "5.0.0-experimental-flutter-publish-fixes.2"
equatable:
dependency: "direct main"
description:
Expand Down
2 changes: 1 addition & 1 deletion flutter_app/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ dependencies:
flutter:
sdk: flutter

ditto_live: 4.13.1
ditto_live: 5.0.0-experimental-flutter-publish-fixes.2

# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
Expand Down
26 changes: 13 additions & 13 deletions scripts/bump-versions.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const log = {
// Configuration for each app directory
const APP_CONFIGS = {
"react-native": {
skip: false,
skip: true,
files: [
{
path: "package.json",
Expand All @@ -57,7 +57,7 @@ const APP_CONFIGS = {
},

"react-native-expo": {
skip: false,
skip: true,
files: [
{
path: "package.json",
Expand All @@ -70,7 +70,7 @@ const APP_CONFIGS = {
},

"javascript-tui": {
skip: false,
skip: true,
files: [
{
path: "package.json",
Expand All @@ -83,7 +83,7 @@ const APP_CONFIGS = {
},

"javascript-web": {
skip: false,
skip: true,
files: [
{
path: "package.json",
Expand All @@ -96,7 +96,7 @@ const APP_CONFIGS = {
},

"android-kotlin": {
skip: false,
skip: true,
files: [
{
path: "QuickStartTasks/gradle/libs.versions.toml",
Expand All @@ -108,7 +108,7 @@ const APP_CONFIGS = {
},

"android-java": {
skip: false,
skip: true,
files: [
{
path: "gradle/libs.versions.toml",
Expand All @@ -120,7 +120,7 @@ const APP_CONFIGS = {
},

"android-cpp": {
skip: false,
skip: true,
files: [
{
path: "QuickStartTasksCPP/app/build.gradle.kts",
Expand All @@ -135,7 +135,7 @@ const APP_CONFIGS = {
},

"cpp-tui": {
skip: false,
skip: true,
files: [
{
path: "taskscpp/Makefile",
Expand All @@ -148,7 +148,7 @@ const APP_CONFIGS = {
},

swift: {
skip: false,
skip: true,
files: [
{
path: "Tasks.xcodeproj/project.pbxproj",
Expand Down Expand Up @@ -183,7 +183,7 @@ const APP_CONFIGS = {
},

"rust-tui": {
skip: false,
skip: true,
files: [
{
path: "Cargo.toml",
Expand All @@ -196,7 +196,7 @@ const APP_CONFIGS = {
},

"dotnet-tui": {
skip: false,
skip: true,
files: [
{
path: "DittoDotNetTasksConsole/DittoDotNetTasksConsole.csproj",
Expand All @@ -215,7 +215,7 @@ const APP_CONFIGS = {
},

"dotnet-maui": {
skip: false,
skip: true,
files: [
{
path: "DittoMauiTasksApp/DittoMauiTasksApp.csproj",
Expand All @@ -228,7 +228,7 @@ const APP_CONFIGS = {
},

"dotnet-winforms": {
skip: false,
skip: true,
files: [
{
path: "TasksApp/DittoTasksApp.csproj",
Expand Down
Loading