0.3.0: sync Rudder.Core 0.3.0, prod default URLs, drop editor artifacts, CI publish
This commit is contained in:
Binary file not shown.
@@ -15,7 +15,6 @@ namespace RudderSdk.Unity
|
||||
ProjectKey = options.ProjectKey,
|
||||
Logger = new UnityLoggerAdapter(options.LoggerSink ?? new UnityDebugLoggerSink()),
|
||||
Transport = new UnityTransportAdapter(options.BaseUrl, executor),
|
||||
UploadTransport = new UnityUploadTransport(options.TimeoutSeconds),
|
||||
TokenStore = new UnityTokenStoreAdapter(options.KeyValueStore),
|
||||
DeviceIdProvider = new UnityDeviceIdProvider(),
|
||||
Clock = new UnityClock(),
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using RudderSdk.Core;
|
||||
using RudderSdk.Core.Abstractions;
|
||||
using UnityEngine.Networking;
|
||||
|
||||
namespace RudderSdk.Unity
|
||||
{
|
||||
internal sealed class UnityUploadTransport : IUploadTransport
|
||||
{
|
||||
private const int DefaultTimeoutSeconds = 10;
|
||||
|
||||
private readonly int _timeoutSeconds;
|
||||
|
||||
public UnityUploadTransport(int timeoutSeconds = DefaultTimeoutSeconds)
|
||||
{
|
||||
_timeoutSeconds = timeoutSeconds > 0 ? timeoutSeconds : DefaultTimeoutSeconds;
|
||||
}
|
||||
|
||||
public async Task PutAsync(string url, byte[] data, string contentType, CancellationToken cancellationToken = default)
|
||||
{
|
||||
using (var request = UnityWebRequest.Put(url, data ?? System.Array.Empty<byte>()))
|
||||
{
|
||||
if (!string.IsNullOrEmpty(contentType))
|
||||
request.SetRequestHeader("Content-Type", contentType);
|
||||
|
||||
request.timeout = _timeoutSeconds;
|
||||
|
||||
var operation = request.SendWebRequest();
|
||||
var completion = new TaskCompletionSource<bool>(TaskCreationOptions.RunContinuationsAsynchronously);
|
||||
operation.completed += _ => completion.TrySetResult(true);
|
||||
|
||||
using (cancellationToken.Register(() =>
|
||||
{
|
||||
request.Abort();
|
||||
completion.TrySetCanceled(cancellationToken);
|
||||
}))
|
||||
{
|
||||
await completion.Task.ConfigureAwait(false);
|
||||
}
|
||||
|
||||
if (request.result == UnityWebRequest.Result.ConnectionError)
|
||||
{
|
||||
throw new RudderNetworkException(request.error);
|
||||
}
|
||||
|
||||
if (request.result == UnityWebRequest.Result.ProtocolError)
|
||||
{
|
||||
throw new RudderApiException(
|
||||
(int)request.responseCode,
|
||||
string.Empty,
|
||||
request.error + ": " + request.downloadHandler?.text);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 415e95ebea4594057990efb6707f3ebc
|
||||
@@ -9,10 +9,10 @@ namespace RudderSdk.Unity
|
||||
public string ProjectKey;
|
||||
|
||||
[Tooltip("API base URL, e.g. https://api.rudder.build.")]
|
||||
public string BaseUrl = "http://localhost:8082";
|
||||
public string BaseUrl = "https://api.rudder.build";
|
||||
|
||||
[Tooltip("Realtime websocket URL.")]
|
||||
public string RealtimeUrl = "ws://localhost:8090/api/realtime/ws";
|
||||
[Tooltip("Realtime websocket URL. The relay is not deployed yet; set this only once it is.")]
|
||||
public string RealtimeUrl = "wss://api.rudder.build/api/realtime/ws";
|
||||
|
||||
[Tooltip("HTTP request timeout in seconds.")]
|
||||
[Min(1)]
|
||||
|
||||
Reference in New Issue
Block a user