Skip to content

Commit 002b8d1

Browse files
committed
.NET TUI + WinForms | Make sure ditto.TransportConfig is updated via the UpdateTransportConfig helper
1 parent 40b1545 commit 002b8d1

File tree

4 files changed

+21
-17
lines changed

4 files changed

+21
-17
lines changed

dotnet-tui/DittoDotNetTasksConsole/DittoDotNetTasksConsole.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
</PropertyGroup>
99

1010
<ItemGroup>
11-
<PackageReference Include="Ditto" Version="4.10.0" />
11+
<PackageReference Include="Ditto" Version="4.11.0-preview.4" />
1212
<PackageReference Include="Terminal.Gui" Version="1.17.1" />
1313
</ItemGroup>
1414

dotnet-tui/DittoDotNetTasksConsole/TasksPeer.cs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,15 @@ public TasksPeer(string appId, string playgroundToken, string authUrl, string we
7373
authUrl);
7474

7575
ditto = new Ditto(identity, tempDir);
76-
77-
// Optionally enable all P2P transports if using P2P Sync
78-
// Do not call this if only using Ditto Cloud Sync
79-
ditto.TransportConfig.EnableAllPeerToPeer();
80-
81-
// Add the websocket URL to the transport configuration.
82-
ditto.TransportConfig.Connect.WebsocketUrls.Add(websocketUrl);
76+
77+
ditto.UpdateTransportConfig(config => {
78+
// Optionally enable all P2P transports if using P2P Sync
79+
// Do not call this if only using Ditto Cloud Sync
80+
config.EnableAllPeerToPeer();
81+
82+
// Add the websocket URL to the transport configuration.
83+
config.Connect.WebsocketUrls.Add(websocketUrl);
84+
});
8385

8486
// disable sync with v3 peers, required for DQL
8587
ditto.DisableSyncWithV3();

dotnet-winforms/TasksApp/DittoTasksApp.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
</PropertyGroup>
1010

1111
<ItemGroup>
12-
<PackageReference Include="Ditto" Version="4.10.2" />
12+
<PackageReference Include="Ditto" Version="4.11.0-preview.4" />
1313
<PackageReference Include="System.Text.Json" Version="9.0.4" />
1414
</ItemGroup>
1515

@@ -48,4 +48,4 @@
4848
</None>
4949
</ItemGroup>
5050

51-
</Project>
51+
</Project>

dotnet-winforms/TasksApp/TasksPeer.cs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,15 @@ public TasksPeer(string appId, string playgroundToken, string authUrl, string we
7070
authUrl);
7171

7272
ditto = new Ditto(identity, dir);
73-
74-
// Optionally enable all P2P transports if using P2P Sync
75-
// Do not call this if only using Ditto Cloud Sync
76-
ditto.TransportConfig.EnableAllPeerToPeer();
77-
78-
// Add the websocket URL to the transport configuration.
79-
ditto.TransportConfig.Connect.WebsocketUrls.Add(websocketUrl);
73+
74+
ditto.UpdateTransportConfig(config => {
75+
// Optionally enable all P2P transports if using P2P Sync
76+
// Do not call this if only using Ditto Cloud Sync
77+
ditto.TransportConfig.EnableAllPeerToPeer();
78+
79+
// Add the websocket URL to the transport configuration.
80+
ditto.TransportConfig.Connect.WebsocketUrls.Add(websocketUrl);
81+
});
8082

8183
// disable sync with v3 peers, required for DQL
8284
ditto.DisableSyncWithV3();

0 commit comments

Comments
 (0)