diff --git a/flutter_app/ios/Podfile.lock b/flutter_app/ios/Podfile.lock index 5c8331588..863c90df9 100644 --- a/flutter_app/ios/Podfile.lock +++ b/flutter_app/ios/Podfile.lock @@ -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 @@ -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 diff --git a/flutter_app/lib/main.dart b/flutter_app/lib/main.dart index 4f2b1b8dd..1c86699d9 100644 --- a/flutter_app/lib/main.dart +++ b/flutter_app/lib/main.dart @@ -25,7 +25,7 @@ class DittoExample extends StatefulWidget { class _DittoExampleState extends State { 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")); @@ -46,11 +46,10 @@ class _DittoExampleState extends State { /// 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 _initDitto() async { // Skip permissions in test mode - they block integration tests const isTestMode = @@ -70,26 +69,23 @@ class _DittoExampleState extends State { 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); @@ -161,18 +157,18 @@ class _DittoExampleState extends State { ); 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()); } }, ); diff --git a/flutter_app/macos/Podfile.lock b/flutter_app/macos/Podfile.lock index ffbf53676..b35c615dc 100644 --- a/flutter_app/macos/Podfile.lock +++ b/flutter_app/macos/Podfile.lock @@ -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 @@ -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 diff --git a/flutter_app/pubspec.lock b/flutter_app/pubspec.lock index 563838639..34cddcc86 100644 --- a/flutter_app/pubspec.lock +++ b/flutter_app/pubspec.lock @@ -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: diff --git a/flutter_app/pubspec.yaml b/flutter_app/pubspec.yaml index 0f2d5011e..a526ba117 100644 --- a/flutter_app/pubspec.yaml +++ b/flutter_app/pubspec.yaml @@ -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. diff --git a/scripts/bump-versions.js b/scripts/bump-versions.js index fa1ef5dad..a65a3b767 100755 --- a/scripts/bump-versions.js +++ b/scripts/bump-versions.js @@ -39,7 +39,7 @@ const log = { // Configuration for each app directory const APP_CONFIGS = { "react-native": { - skip: false, + skip: true, files: [ { path: "package.json", @@ -57,7 +57,7 @@ const APP_CONFIGS = { }, "react-native-expo": { - skip: false, + skip: true, files: [ { path: "package.json", @@ -70,7 +70,7 @@ const APP_CONFIGS = { }, "javascript-tui": { - skip: false, + skip: true, files: [ { path: "package.json", @@ -83,7 +83,7 @@ const APP_CONFIGS = { }, "javascript-web": { - skip: false, + skip: true, files: [ { path: "package.json", @@ -96,7 +96,7 @@ const APP_CONFIGS = { }, "android-kotlin": { - skip: false, + skip: true, files: [ { path: "QuickStartTasks/gradle/libs.versions.toml", @@ -108,7 +108,7 @@ const APP_CONFIGS = { }, "android-java": { - skip: false, + skip: true, files: [ { path: "gradle/libs.versions.toml", @@ -120,7 +120,7 @@ const APP_CONFIGS = { }, "android-cpp": { - skip: false, + skip: true, files: [ { path: "QuickStartTasksCPP/app/build.gradle.kts", @@ -135,7 +135,7 @@ const APP_CONFIGS = { }, "cpp-tui": { - skip: false, + skip: true, files: [ { path: "taskscpp/Makefile", @@ -148,7 +148,7 @@ const APP_CONFIGS = { }, swift: { - skip: false, + skip: true, files: [ { path: "Tasks.xcodeproj/project.pbxproj", @@ -183,7 +183,7 @@ const APP_CONFIGS = { }, "rust-tui": { - skip: false, + skip: true, files: [ { path: "Cargo.toml", @@ -196,7 +196,7 @@ const APP_CONFIGS = { }, "dotnet-tui": { - skip: false, + skip: true, files: [ { path: "DittoDotNetTasksConsole/DittoDotNetTasksConsole.csproj", @@ -215,7 +215,7 @@ const APP_CONFIGS = { }, "dotnet-maui": { - skip: false, + skip: true, files: [ { path: "DittoMauiTasksApp/DittoMauiTasksApp.csproj", @@ -228,7 +228,7 @@ const APP_CONFIGS = { }, "dotnet-winforms": { - skip: false, + skip: true, files: [ { path: "TasksApp/DittoTasksApp.csproj",