-
Notifications
You must be signed in to change notification settings - Fork 2
refactor(java,kotlin): use updateTransportConfig lambda to configure transports #78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the Quickstart apps in Swift, Java, Kotlin, and C# to use the new ditto.updateTransportConfig() API for configuring transports.
- Replaces direct transport configuration assignments with closure/lambda-based configuration
- Updates package references to the new Ditto version for .NET/C# and other platforms
- Standardizes transport configuration syntax across multiple language implementations
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
swift/tasks/tasks/DittoManager.swift | Converted to use updateTransportConfig closure for Swift transport configuration |
java-spring/src/main/java/com/ditto/example/spring/quickstart/service/DittoService.java | Refactored transport configuration to use a lambda syntax |
dotnet-winforms/TasksApp/TasksPeer.cs | Updated transport configuration using a lambda in Windows Forms app |
dotnet-winforms/TasksApp/DittoTasksApp.csproj | Updated Ditto package version to a new preview release |
dotnet-tui/DittoDotNetTasksConsole/TasksPeer.cs | Refactored to use lambda for transport configuration |
dotnet-tui/DittoDotNetTasksConsole/DittoDotNetTasksConsole.csproj | Updated Ditto package version to a new preview release |
dotnet-maui/DittoMauiTasksApp/MauiProgram.cs | Updated Maui app to employ the new transport configuration lambda |
dotnet-maui/DittoMauiTasksApp/DittoMauiTasksApp.csproj | Updated Ditto package reference to match new version |
android-kotlin/QuickStartTasks/app/src/main/java/live/ditto/quickstart/tasks/TasksApplication.kt | Migrated transport configuration to lambda style in Kotlin app |
android-java/app/src/main/java/com/example/dittotasks/MainActivity.java | Refactored Java transport configuration to use a lambda with a return statement |
// Enable all P2P transports | ||
config.enableAllPeerToPeer(); | ||
|
||
return null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ensure that returning null in the lambda is required by the API design; if the lambda is expected to have a void return type, consider removing the return statement.
Copilot uses AI. Check for mistakes.
Rust quickstart build is failing with a dup symbol linker error
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missed the dotnet
changes 🤦 . We already have a PR for those. #75 Same for Swift.
3929c87
to
ed008a4
Compare
…ports refactor: use updateTransportConfig closure/lambda to configure transports
ed008a4
to
312a7f7
Compare
PR updated to just modify java & kotlin apps. .NET changes are in #74 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the configuration of transports in the Java and Kotlin quickstart apps by switching from manual transport configuration to the updateTransportConfig lambda/closure API. This change streamlines the transport configuration process in the Java Spring, Android Kotlin, and Android Java projects.
- Updated Java Spring service to configure transports using a lambda.
- Simplified Android Kotlin configuration by removing the manual transport configuration.
- Refactored Android Java configuration to use a lambda, with an explicit return.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
java-spring/src/main/java/com/ditto/example/spring/quickstart/service/DittoService.java | Replaced manual config builder with updateTransportConfig lambda and updated logging. |
android-kotlin/QuickStartTasks/app/src/main/java/live/ditto/quickstart/tasks/TasksApplication.kt | Simplified transport config by using a lambda; removed explicit enabling of all P2P transports. |
android-java/app/src/main/java/com/example/dittotasks/MainActivity.java | Converted transport config to use a lambda with an explicit return. |
Comments suppressed due to low confidence (1)
android-kotlin/QuickStartTasks/app/src/main/java/live/ditto/quickstart/tasks/TasksApplication.kt:56
- The explicit call to enable all peer-to-peer transports was removed in this diff. Please confirm that updateTransportConfig now handles enabling P2P transports as intended, or add the necessary configuration if it is still required.
ditto.updateTransportConfig { config ->
// Enable all P2P transports | ||
config.enableAllPeerToPeer(); | ||
ditto.setTransportConfig(config); | ||
return null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The lambda returns null, which may be unnecessary if updateTransportConfig does not require a return value. Consider removing the return statement or adding a comment to clarify its purpose.
Copilot uses AI. Check for mistakes.
connect.websocketUrls().add(DittoSecretsConfiguration.DITTO_WEBSOCKET_URL); | ||
}); | ||
|
||
logger.info("Transport config: {}", config); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Consider adding a comment or further context on what aspects of the transport config are logged to improve the clarity and usefulness of the debug information.
Copilot uses AI. Check for mistakes.
Updated the Java and Kotlin Quickstart apps to use the
ditto.updateTransportConfig()
API to configure transports.