diff --git a/flutter_app/README.md b/flutter_app/README.md index b67691eca..2068b58d0 100644 --- a/flutter_app/README.md +++ b/flutter_app/README.md @@ -15,6 +15,14 @@ This is a basic task application that demonstrates how to use Ditto's peer-to-pe - Android SDK installed - IDE of choice (Android Studio, VS Code, etc) +### MacOS Development +This has been tested with XCode 26.2 on MacOS 26.6 with Flutter 3.29.3. + +### Windows Development +To build the Windows version of this Flutter app requires Visual Studio 2022 specifically be +installed and configured with C++ and cmake installed from the Visual Studio Installer. This has +been tested with Flutter version 3.29.3 on Windows. + ## Getting Started ### 1. Clone the Repository @@ -78,7 +86,7 @@ Please choose one (or "q" to quit): > If you are going to use a physical iPhone, you will need to update the Team under Signing & Capabilities in XCode. You can open the ios/Runner.xcodeproj file in XCode and then set your team from the Runner Target -> Signing & Capabilities tab. > -- Ensure that cocoapods is up to date +- Ensure that cocoapods is up to date (or you can use Homebrew with `brew install cocoapods`) ```bash gem install cocoapods diff --git a/flutter_app/ios/Podfile.lock b/flutter_app/ios/Podfile.lock index 5c8331588..087b92486 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-dev-weekly.20260126.180): + - DittoFlutter (= 5.0.0-dev-weekly.20260126.180) - Flutter - - DittoFlutter (4.13.1) + - DittoFlutter (5.0.0-dev-weekly.20260126.180) - 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: 73f44820c4eba49dc680be36f3b3eb966a0f5036 + DittoFlutter: ffc0d73eafbe5655d186613b9c1c1c3eefee2e09 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/ios/Runner.xcodeproj/project.pbxproj b/flutter_app/ios/Runner.xcodeproj/project.pbxproj index 8ebdad35c..1345e7d89 100644 --- a/flutter_app/ios/Runner.xcodeproj/project.pbxproj +++ b/flutter_app/ios/Runner.xcodeproj/project.pbxproj @@ -494,6 +494,7 @@ DEVELOPMENT_TEAM = 3T2VMFZPPQ; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 15.6; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -685,6 +686,7 @@ DEVELOPMENT_TEAM = 3T2VMFZPPQ; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 15.6; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -710,6 +712,7 @@ DEVELOPMENT_TEAM = 3T2VMFZPPQ; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 15.6; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", diff --git a/flutter_app/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/flutter_app/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index 1728d1042..15cada483 100644 --- a/flutter_app/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/flutter_app/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -51,7 +51,7 @@ { dotenv.env['DITTO_APP_ID'] ?? (throw Exception("env not found")); final token = dotenv.env['DITTO_PLAYGROUND_TOKEN'] ?? (throw Exception("env not found")); - final authUrl = dotenv.env['DITTO_AUTH_URL']; + final authUrl = + dotenv.env['DITTO_AUTH_URL'] ?? (throw Exception("env not found")); final websocketUrl = dotenv.env['DITTO_WEBSOCKET_URL'] ?? (throw Exception("env not found")); @@ -70,26 +71,22 @@ 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); - - ditto.updateTransportConfig((config) { - // Note: this will not enable peer-to-peer sync on the web platform - config.setAllPeerToPeerEnabled(true); - config.connect.webSocketUrls.add(websocketUrl); + DittoLogger.isEnabled = true; + DittoLogger.minimumLogLevel = LogLevel.debug; + + //new configuration - https://docs.ditto.live/sdk/latest/ditto-config + final config = DittoConfig( + databaseID: appID, connect: DittoConfigConnectServer(url: authUrl)); + final ditto = await Ditto.open(config); + await ditto.auth.setExpirationHandler((ditto, timeUntilExpiration) async { + final authResult = await ditto.auth + .login(token: token, provider: Authenticator.developmentProvider); + if (authResult.exception != null) { + throw authResult.exception!; + } }); - // 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); @@ -167,19 +164,20 @@ class _DittoExampleState extends State { 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()); } }, ); + //TODO review to see if we want to add in the order by title asc back in by making the dql builder use two queries. Widget get _tasksList => DqlBuilder( ditto: _ditto!, - query: "SELECT * FROM tasks WHERE deleted = false ORDER BY title ASC", + query: "SELECT * FROM tasks WHERE deleted = false", builder: (context, result) { final tasks = result.items.map((r) => r.value).map(Task.fromJson); return ListView( diff --git a/flutter_app/macos/Podfile.lock b/flutter_app/macos/Podfile.lock index ffbf53676..5a0850fe4 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-dev-weekly.20260126.180): + - DittoFlutter (= 5.0.0-dev-weekly.20260126.180) - FlutterMacOS - - DittoFlutter (4.13.1) + - DittoFlutter (5.0.0-dev-weekly.20260126.180) - 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: 488af92a7482f27bcae748002fd9db4c413850fa + DittoFlutter: ffc0d73eafbe5655d186613b9c1c1c3eefee2e09 FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24 - path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46 + path_provider_foundation: 080d55be775b7414fd5a5ef3ac137b97b097e564 PODFILE CHECKSUM: 7eb978b976557c8c1cd717d8185ec483fd090a82 diff --git a/flutter_app/macos/Runner/DebugProfile.entitlements b/flutter_app/macos/Runner/DebugProfile.entitlements index dddb8a30c..c946719a1 100644 --- a/flutter_app/macos/Runner/DebugProfile.entitlements +++ b/flutter_app/macos/Runner/DebugProfile.entitlements @@ -8,5 +8,7 @@ com.apple.security.network.server + com.apple.security.network.client + diff --git a/flutter_app/pubspec.lock b/flutter_app/pubspec.lock index 563838639..4b029dcfc 100644 --- a/flutter_app/pubspec.lock +++ b/flutter_app/pubspec.lock @@ -5,18 +5,18 @@ packages: dependency: transitive description: name: async - sha256: "758e6d74e971c3e5aceb4110bfd6698efc7f501675bcfe0c775459a8140750eb" + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" url: "https://pub.dev" source: hosted - version: "2.13.0" + version: "2.11.0" boolean_selector: dependency: transitive description: name: boolean_selector - sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea" + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "2.1.1" cbor: dependency: transitive description: @@ -29,26 +29,26 @@ packages: dependency: transitive description: name: characters - sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803 + sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" url: "https://pub.dev" source: hosted - version: "1.4.0" + version: "1.3.0" clock: dependency: transitive description: name: clock - sha256: fddb70d9b5277016c77a80201021d40a2247104d9f4aa7bab7157b7e3f05b84b + sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf url: "https://pub.dev" source: hosted - version: "1.1.2" + version: "1.1.1" collection: dependency: transitive description: name: collection - sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a url: "https://pub.dev" source: hosted - version: "1.19.1" + version: "1.18.0" convert: dependency: transitive description: @@ -69,10 +69,10 @@ packages: dependency: "direct main" description: name: ditto_live - sha256: f095d52ec464e0c50323a4c37717a4e4727c00c035be8e11c0120b5bac927103 + sha256: dc3ba1561d198657c540b278a78e221e191fba632e6f76d381582339d5c7b84e url: "https://pub.dev" source: hosted - version: "4.13.1" + version: "5.0.0-preview.4" equatable: dependency: "direct main" description: @@ -85,10 +85,10 @@ packages: dependency: transitive description: name: fake_async - sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44" + sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" url: "https://pub.dev" source: hosted - version: "1.3.3" + version: "1.3.1" ffi: dependency: transitive description: @@ -101,10 +101,10 @@ packages: dependency: transitive description: name: file - sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4 + sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c" url: "https://pub.dev" source: hosted - version: "7.0.1" + version: "7.0.0" flutter: dependency: "direct main" description: flutter @@ -179,18 +179,18 @@ packages: dependency: transitive description: name: leak_tracker - sha256: "6bb818ecbdffe216e81182c2f0714a2e62b593f4a4f13098713ff1685dfb6ab0" + sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05" url: "https://pub.dev" source: hosted - version: "10.0.9" + version: "10.0.5" leak_tracker_flutter_testing: dependency: transitive description: name: leak_tracker_flutter_testing - sha256: f8b613e7e6a13ec79cfdc0e97638fddb3ab848452eff057653abd3edba760573 + sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806" url: "https://pub.dev" source: hosted - version: "3.0.9" + version: "3.0.5" leak_tracker_testing: dependency: transitive description: @@ -219,10 +219,10 @@ packages: dependency: transitive description: name: matcher - sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2 + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb url: "https://pub.dev" source: hosted - version: "0.12.17" + version: "0.12.16+1" material_color_utilities: dependency: transitive description: @@ -235,18 +235,18 @@ packages: dependency: transitive description: name: meta - sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c + sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 url: "https://pub.dev" source: hosted - version: "1.16.0" + version: "1.15.0" path: dependency: transitive description: name: path - sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" url: "https://pub.dev" source: hosted - version: "1.9.1" + version: "1.9.0" path_provider: dependency: transitive description: @@ -347,10 +347,10 @@ packages: dependency: transitive description: name: platform - sha256: "5d6b1b0036a5f331ebc77c850ebc8506cbc1e9416c27e59b439f917a902a4984" + sha256: "9b71283fc13df574056616011fb138fd3b793ea47cc509c189a6c3fa5f8a1a65" url: "https://pub.dev" source: hosted - version: "3.1.6" + version: "3.1.5" plugin_platform_interface: dependency: transitive description: @@ -363,47 +363,47 @@ packages: dependency: transitive description: name: process - sha256: "107d8be718f120bbba9dcd1e95e3bd325b1b4a4f07db64154635ba03f2567a0d" + sha256: "21e54fd2faf1b5bdd5102afd25012184a6793927648ea81eea80552ac9405b32" url: "https://pub.dev" source: hosted - version: "5.0.3" + version: "5.0.2" sky_engine: dependency: transitive description: flutter source: sdk - version: "0.0.0" + version: "0.0.99" source_span: dependency: transitive description: name: source_span - sha256: "254ee5351d6cb365c859e20ee823c3bb479bf4a293c22d17a9f1bf144ce86f7c" + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" url: "https://pub.dev" source: hosted - version: "1.10.1" + version: "1.10.0" stack_trace: dependency: transitive description: name: stack_trace - sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1" + sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" url: "https://pub.dev" source: hosted - version: "1.12.1" + version: "1.11.1" stream_channel: dependency: transitive description: name: stream_channel - sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 url: "https://pub.dev" source: hosted - version: "2.1.4" + version: "2.1.2" string_scanner: dependency: transitive description: name: string_scanner - sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43" + sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" url: "https://pub.dev" source: hosted - version: "1.4.1" + version: "1.2.0" sync_http: dependency: transitive description: @@ -416,18 +416,18 @@ packages: dependency: transitive description: name: term_glyph - sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e" + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 url: "https://pub.dev" source: hosted - version: "1.2.2" + version: "1.2.1" test_api: dependency: transitive description: name: test_api - sha256: fb31f383e2ee25fbbfe06b40fe21e1e458d14080e3c67e7ba0acfde4df4e0bbd + sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb" url: "https://pub.dev" source: hosted - version: "0.7.4" + version: "0.7.2" typed_data: dependency: transitive description: @@ -448,10 +448,10 @@ packages: dependency: transitive description: name: vm_service - sha256: ddfa8d30d89985b96407efce8acbdd124701f96741f2d981ca860662f1c0dc02 + sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d" url: "https://pub.dev" source: hosted - version: "15.0.0" + version: "14.2.5" web: dependency: transitive description: @@ -464,10 +464,10 @@ packages: dependency: transitive description: name: webdriver - sha256: "2f3a14ca026957870cfd9c635b83507e0e51d8091568e90129fbf805aba7cade" + sha256: "003d7da9519e1e5f329422b36c4dcdf18d7d2978d1ba099ea4e45ba490ed845e" url: "https://pub.dev" source: hosted - version: "3.1.0" + version: "3.0.3" xdg_directories: dependency: transitive description: @@ -477,5 +477,5 @@ packages: source: hosted version: "1.1.0" sdks: - dart: ">=3.7.0-0 <4.0.0" + dart: ">=3.5.0 <4.0.0" flutter: ">=3.24.0" diff --git a/flutter_app/pubspec.yaml b/flutter_app/pubspec.yaml index 0f2d5011e..c19bed632 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-preview.4 # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. diff --git a/flutter_app/windows/CMakeLists.txt b/flutter_app/windows/CMakeLists.txt index 6c87c1c44..8943541fe 100644 --- a/flutter_app/windows/CMakeLists.txt +++ b/flutter_app/windows/CMakeLists.txt @@ -39,9 +39,9 @@ add_definitions(-DUNICODE -D_UNICODE) # of modifying this function. function(APPLY_STANDARD_SETTINGS TARGET) target_compile_features(${TARGET} PUBLIC cxx_std_17) - target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100") + target_compile_options(${TARGET} PRIVATE /W5 /WX /wd"4100") target_compile_options(${TARGET} PRIVATE /EHsc) - target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0") + target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=1") target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>") endfunction() @@ -64,7 +64,7 @@ include(flutter/generated_plugins.cmake) # so that building and running from within Visual Studio will work. set(BUILD_BUNDLE_DIR "$") # Make the "install" step default, as it's required to run. -set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) +set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 2) if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) endif()