Skip to content

Commit 9cc1c1f

Browse files
authored
Bump Core Deps to 2.20 (#120)
* Bump Sdk * Fixed compiler errors
1 parent 2da9c91 commit 9cc1c1f

File tree

11 files changed

+614
-326
lines changed

11 files changed

+614
-326
lines changed

Assets/Extra/ManualReceive.cs

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using Speckle.ConnectorUnity;
44
using Speckle.ConnectorUnity.Components;
55
using Speckle.Core.Api;
6+
using Speckle.Core.Api.GraphQL.Models;
67
using Speckle.Core.Credentials;
78
using Speckle.Core.Models;
89
using Speckle.Core.Transports;

Packages/systems.speckle.speckle-unity/Editor/Components/StreamManagerEditor.cs

+6-10
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using System.Collections.Generic;
33
using System.Linq;
44
using System.Threading.Tasks;
5-
using Sentry;
65
using Speckle.Core.Api;
76
using Speckle.Core.Credentials;
87
using Speckle.Core.Kits;
@@ -234,18 +233,15 @@ await Client.CommitReceived(
234233
new CommitReceivedInput
235234
{
236235
streamId = SelectedStream.id,
237-
commitId = Branches[SelectedBranchIndex].commits.items[
238-
SelectedCommitIndex
239-
].id,
236+
commitId = Branches[SelectedBranchIndex]
237+
.commits
238+
.items[SelectedCommitIndex]
239+
.id,
240240
message = $"received commit from {HostApplications.Unity.Name} Editor",
241241
sourceApplication = HostApplications.Unity.Name
242242
}
243243
);
244244
}
245-
catch (Exception e)
246-
{
247-
throw new SpeckleException(e.Message, e, true, SentryLevel.Error);
248-
}
249245
finally
250246
{
251247
EditorApplication.delayCall += EditorUtility.ClearProgressBar;
@@ -384,8 +380,8 @@ public override async void OnInspectorGUI()
384380
SelectedCommitIndex = EditorGUILayout.Popup(
385381
"Commits",
386382
SelectedCommitIndex,
387-
Branches[SelectedBranchIndex].commits.items
388-
.Select(x => $"{x.message} - {x.id}")
383+
Branches[SelectedBranchIndex]
384+
.commits.items.Select(x => $"{x.message} - {x.id}")
389385
.ToArray(),
390386
GUILayout.Height(20),
391387
GUILayout.ExpandWidth(true)

Packages/systems.speckle.speckle-unity/Runtime/Components/Deprecated/Receiver.cs

+54-71
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
using Speckle.Core.Api;
2-
using Speckle.Core.Api.SubscriptionModels;
3-
using Speckle.Core.Credentials;
4-
using Speckle.Core.Logging;
5-
using Speckle.Core.Transports;
6-
using System;
1+
using System;
72
using System.Collections.Concurrent;
83
using System.Collections.Generic;
94
using System.Linq;
105
using System.Threading.Tasks;
116
using Sentry;
127
using Speckle.ConnectorUnity.Components;
138
using Speckle.ConnectorUnity.Utils;
9+
using Speckle.Core.Api;
10+
using Speckle.Core.Api.SubscriptionModels;
11+
using Speckle.Core.Credentials;
1412
using Speckle.Core.Kits;
13+
using Speckle.Core.Logging;
14+
using Speckle.Core.Transports;
1515
using UnityEngine;
1616

1717
namespace Speckle.ConnectorUnity
@@ -91,23 +91,16 @@ public void Receive()
9191

9292
Task.Run(async () =>
9393
{
94-
try
95-
{
96-
var mainBranch = await Client.BranchGet(StreamId, BranchName, 1);
97-
if (!mainBranch.commits.items.Any())
98-
throw new Exception("This branch has no commits");
99-
var commit = mainBranch.commits.items[0];
100-
GetAndConvertObject(
101-
commit.referencedObject,
102-
commit.id,
103-
commit.sourceApplication,
104-
commit.authorId
105-
);
106-
}
107-
catch (Exception e)
108-
{
109-
throw new SpeckleException(e.Message, e, true, SentryLevel.Error);
110-
}
94+
var mainBranch = await Client.BranchGet(StreamId, BranchName, 1);
95+
if (!mainBranch.commits.items.Any())
96+
throw new Exception("This branch has no commits");
97+
var commit = mainBranch.commits.items[0];
98+
GetAndConvertObject(
99+
commit.referencedObject,
100+
commit.id,
101+
commit.sourceApplication,
102+
commit.authorId
103+
);
111104
});
112105
}
113106

@@ -135,56 +128,46 @@ private async void GetAndConvertObject(
135128
string authorId
136129
)
137130
{
138-
try
139-
{
140-
var transport = new ServerTransport(Client.Account, StreamId);
141-
var @base = await Operations.Receive(
142-
objectId,
143-
remoteTransport: transport,
144-
onErrorAction: OnErrorAction,
145-
onProgressAction: OnProgressAction,
146-
onTotalChildrenCountKnown: OnTotalChildrenCountKnown,
147-
disposeTransports: true
148-
);
149-
150-
Analytics.TrackEvent(
151-
Client.Account,
152-
Analytics.Events.Receive,
153-
new Dictionary<string, object>()
131+
var transport = new ServerTransport(Client.Account, StreamId);
132+
var @base = await Operations.Receive(
133+
objectId,
134+
remoteTransport: transport,
135+
onErrorAction: OnErrorAction,
136+
onProgressAction: OnProgressAction,
137+
onTotalChildrenCountKnown: OnTotalChildrenCountKnown,
138+
disposeTransports: true
139+
);
140+
141+
Analytics.TrackEvent(
142+
Client.Account,
143+
Analytics.Events.Receive,
144+
new Dictionary<string, object>()
145+
{
146+
{ "mode", nameof(Receiver) },
154147
{
155-
{ "mode", nameof(Receiver) },
156-
{
157-
"sourceHostApp",
158-
HostApplications.GetHostAppFromString(sourceApplication).Slug
159-
},
160-
{ "sourceHostAppVersion", sourceApplication ?? "" },
161-
{ "hostPlatform", Application.platform.ToString() },
162-
{
163-
"isMultiplayer",
164-
authorId != null && authorId != Client.Account.userInfo.id
165-
},
166-
}
167-
);
148+
"sourceHostApp",
149+
HostApplications.GetHostAppFromString(sourceApplication).Slug
150+
},
151+
{ "sourceHostAppVersion", sourceApplication ?? "" },
152+
{ "hostPlatform", Application.platform.ToString() },
153+
{ "isMultiplayer", authorId != null && authorId != Client.Account.userInfo.id },
154+
}
155+
);
168156

169-
Dispatcher
170-
.Instance()
171-
.Enqueue(() =>
172-
{
173-
var root = new GameObject() { name = commitId, };
174-
175-
var rc = GetComponent<RecursiveConverter>();
176-
var go = rc.RecursivelyConvertToNative(@base, root.transform);
177-
//remove previously received object
178-
if (DeleteOld && ReceivedData != null)
179-
Destroy(ReceivedData);
180-
ReceivedData = root;
181-
OnDataReceivedAction?.Invoke(root);
182-
});
183-
}
184-
catch (Exception e)
185-
{
186-
throw new SpeckleException(e.Message, e, true, SentryLevel.Error);
187-
}
157+
Dispatcher
158+
.Instance()
159+
.Enqueue(() =>
160+
{
161+
var root = new GameObject() { name = commitId, };
162+
163+
var rc = GetComponent<RecursiveConverter>();
164+
var go = rc.RecursivelyConvertToNative(@base, root.transform);
165+
//remove previously received object
166+
if (DeleteOld && ReceivedData != null)
167+
Destroy(ReceivedData);
168+
ReceivedData = root;
169+
OnDataReceivedAction?.Invoke(root);
170+
});
188171

189172
try
190173
{

Packages/systems.speckle.speckle-unity/Runtime/Components/Deprecated/Sender.cs

+34-42
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
using Speckle.Core.Api;
2-
using Speckle.Core.Credentials;
3-
using Speckle.Core.Logging;
4-
using Speckle.Core.Models;
5-
using Speckle.Core.Transports;
6-
using System;
1+
using System;
72
using System.Collections.Concurrent;
83
using System.Collections.Generic;
94
using System.Threading;
105
using System.Threading.Tasks;
116
using Sentry;
127
using Speckle.ConnectorUnity.Components;
8+
using Speckle.Core.Api;
9+
using Speckle.Core.Credentials;
1310
using Speckle.Core.Kits;
11+
using Speckle.Core.Logging;
12+
using Speckle.Core.Models;
13+
using Speckle.Core.Transports;
1414
using UnityEngine;
1515
using UnityEngine.SceneManagement;
1616

@@ -46,7 +46,6 @@ private void Awake()
4646
/// <param name="onDataSentAction">Action to run after the data has been sent</param>
4747
/// <param name="onProgressAction">Action to run when there is download/conversion progress</param>
4848
/// <param name="onErrorAction">Action to run on error</param>
49-
/// <exception cref="SpeckleException"></exception>
5049
public void Send(
5150
string streamId,
5251
ISet<GameObject> gameObjects,
@@ -58,39 +57,32 @@ public void Send(
5857
Action<string, Exception>? onErrorAction = null
5958
)
6059
{
61-
try
62-
{
63-
CancelOperations();
64-
65-
cancellationTokenSource = new CancellationTokenSource();
66-
67-
var client = new Client(account ?? AccountManager.GetDefaultAccount()!);
68-
transport = new ServerTransport(client.Account, streamId);
69-
transport.CancellationToken = cancellationTokenSource.Token;
70-
71-
var rootObjects = SceneManager.GetActiveScene().GetRootGameObjects();
72-
73-
var data = converter.RecursivelyConvertToSpeckle(
74-
rootObjects,
75-
o => gameObjects.Contains(o)
76-
);
77-
78-
SendData(
79-
transport,
80-
data,
81-
client,
82-
branchName,
83-
createCommit,
84-
cancellationTokenSource.Token,
85-
onDataSentAction,
86-
onProgressAction,
87-
onErrorAction
88-
);
89-
}
90-
catch (Exception e)
91-
{
92-
throw new SpeckleException(e.ToString(), e, true, SentryLevel.Error);
93-
}
60+
CancelOperations();
61+
62+
cancellationTokenSource = new CancellationTokenSource();
63+
64+
var client = new Client(account ?? AccountManager.GetDefaultAccount()!);
65+
transport = new ServerTransport(client.Account, streamId);
66+
transport.CancellationToken = cancellationTokenSource.Token;
67+
68+
var rootObjects = SceneManager.GetActiveScene().GetRootGameObjects();
69+
70+
var data = converter.RecursivelyConvertToSpeckle(
71+
rootObjects,
72+
o => gameObjects.Contains(o)
73+
);
74+
75+
SendData(
76+
transport,
77+
data,
78+
client,
79+
branchName,
80+
createCommit,
81+
cancellationTokenSource.Token,
82+
onDataSentAction,
83+
onProgressAction,
84+
onErrorAction
85+
);
9486
}
9587

9688
public static void SendData(
@@ -125,7 +117,6 @@ public static void SendData(
125117
long count = data.GetTotalChildrenCount();
126118

127119
await client.CommitCreate(
128-
cancellationToken,
129120
new CommitCreateInput
130121
{
131122
streamId = remoteTransport.StreamId,
@@ -134,7 +125,8 @@ await client.CommitCreate(
134125
message = $"Sent {count} objects from Unity",
135126
sourceApplication = HostApplications.Unity.Name,
136127
totalChildrenCount = (int)count,
137-
}
128+
},
129+
cancellationToken
138130
);
139131
}
140132

Packages/systems.speckle.speckle-unity/Runtime/Components/ReceiveFromURL.cs

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System.Threading;
55
using System.Threading.Tasks;
66
using Speckle.Core.Api;
7+
using Speckle.Core.Api.GraphQL.Models;
78
using Speckle.Core.Credentials;
89
using Speckle.Core.Logging;
910
using Speckle.Core.Models;
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)