Skip to content

Commit

Permalink
Updated from pipeline, Version : 16.24.0
Browse files Browse the repository at this point in the history
  • Loading branch information
AccelByte-Build committed Aug 12, 2024
1 parent deee8ff commit fab9f8c
Show file tree
Hide file tree
Showing 115 changed files with 2,335 additions and 742 deletions.
27 changes: 27 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,33 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [16.24.0](https://github.com/AccelByte/accelbyte-unity-sdk/branches/compare/16.24.0%0D16.23.1) (2024-08-12)


### Features

* add AppleExtension as InternalsVisibleTo ([2451d23](https://github.com/AccelByte/accelbyte-unity-sdk/commits/2451d2377b5b2d888e5f0510c0629c247d48d287))
* add flight id and device type into telemetry data ([5377697](https://github.com/AccelByte/accelbyte-unity-sdk/commits/5377697ba001a6c00a044072c4325074cd8e07c8))
* add friend related error code ([fd7e2c0](https://github.com/AccelByte/accelbyte-unity-sdk/commits/fd7e2c0889fec897734b15ae62907977e00837c4))
* add login with apple ([6cb3805](https://github.com/AccelByte/accelbyte-unity-sdk/commits/6cb38053ed4802568576ed396b282ef6805fdf5c))
* add optional service label param ([8dab5b5](https://github.com/AccelByte/accelbyte-unity-sdk/commits/8dab5b56f09f26bc08538761fabaa8eac5dee096))
* add server misc service ([2aa2b21](https://github.com/AccelByte/accelbyte-unity-sdk/commits/2aa2b21c3b1f7cc712aabc519abbb9e4b8d8fc59))
* add StatisticCodePredicate and Code field for purchasing requirement ([45171c5](https://github.com/AccelByte/accelbyte-unity-sdk/commits/45171c58847785860ba19c485070ee9affaf76c5))
* add support for GooglePlayGames authentication ([a33f131](https://github.com/AccelByte/accelbyte-unity-sdk/commits/a33f1318fdbd699b30ecab3d6e746e75f88f0179))
* add unity switch token expired time ([bce2407](https://github.com/AccelByte/accelbyte-unity-sdk/commits/bce24071d8a29cd16b2777f0bc940583479416ed))
* implement BulkGetUserByOtherPlatformUserIdsV4 ([1c8b1e9](https://github.com/AccelByte/accelbyte-unity-sdk/commits/1c8b1e9dfe331f75273f5ac13d6605d8d7e87a5f))
* set telemetry client timestamp with server time reference ([b0ad854](https://github.com/AccelByte/accelbyte-unity-sdk/commits/b0ad854b6128384f2e1bf8aa5de3b8849cbef9cf))


### Bug Fixes

* fixed incorrect chat and server user account endpoints ([8ca8097](https://github.com/AccelByte/accelbyte-unity-sdk/commits/8ca80975617426bd27967cebfdf875730a132484))


### Refactors

* refactor qos get latencies implementation ([0b6c597](https://github.com/AccelByte/accelbyte-unity-sdk/commits/0b6c5977a626259508a19dca009f82fc36ea54c3))

### [16.23.1](https://github.com/AccelByte/accelbyte-unity-sdk/branches/compare/16.23.1%0D16.23.0) (2024-07-31)


Expand Down
1 change: 1 addition & 0 deletions Editor/AccelByteServerSettingsEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ private void OnGUI()
EditorCommon.CreateToggleInput((newValue) => generateServiceUrl = newValue, generateServiceUrl, "Auto Generate Service Url", indentLevel: 1);

EditorCommon.CreateTextInput((newValue) => editedServerConfig.IamServerUrl = newValue, editedServerConfig.IamServerUrl, "IAM Server Url", false, generateServiceUrl, indentLevel: 1);
EditorCommon.CreateTextInput((newValue) => editedServerConfig.BasicServerUrl = newValue, editedServerConfig.BasicServerUrl, "Basic Server Url", false, generateServiceUrl, indentLevel: 1);
EditorCommon.CreateTextInput(
(newValue) => editedServerConfig.AMSServerUrl = newValue
, defaultValue: editedServerConfig.AMSServerUrl
Expand Down
2 changes: 1 addition & 1 deletion Runtime/AccelBytePlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public static Config Config

static AccelBytePlugin()
{
const string deprecatedWarning = "AccelBytePlugin is deprecated and will be removed on July release. Please migrate to AccelByteSDK.GetClientRegistry.\nGuideline how to migrate: https://docs.accelbyte.io/gaming-services/developers/sdk-tools/sdk-guides/multiple-registries/migrate-to-multiple-registry-unity/";
const string deprecatedWarning = "AccelBytePlugin is deprecated and will be sunset on 3.79 release. Please migrate to AccelByteSDK.GetClientRegistry.\nGuideline how to migrate: https://docs.accelbyte.io/gaming-services/developers/sdk-tools/sdk-guides/multiple-registries/migrate-to-multiple-registry-unity/";
UnityEngine.Debug.LogWarning(deprecatedWarning);

if (!initialized)
Expand Down
2 changes: 1 addition & 1 deletion Runtime/AccelByteServerPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public static ServerConfig Config

static AccelByteServerPlugin()
{
const string deprecatedWarning = "AccelByteServerPlugin is deprecated and will be removed on July release. Please migrate to AccelByteSDK.GetServerRegistry.\nGuideline how to migrate: https://docs.accelbyte.io/gaming-services/developers/sdk-tools/sdk-guides/multiple-registries/migrate-to-multiple-registry-unity/";
const string deprecatedWarning = "AccelByteServerPlugin is deprecated and will be sunset on 3.79 release. Please migrate to AccelByteSDK.GetServerRegistry.\nGuideline how to migrate: https://docs.accelbyte.io/gaming-services/developers/sdk-tools/sdk-guides/multiple-registries/migrate-to-multiple-registry-unity/";
UnityEngine.Debug.LogWarning(deprecatedWarning);
AccelByteSDK.Environment.OnEnvironmentChanged += environmentChanged;
}
Expand Down
37 changes: 5 additions & 32 deletions Runtime/Api/Analytics/AnalyticsApi.cs
Original file line number Diff line number Diff line change
@@ -1,47 +1,20 @@
// Copyright (c) 2023 AccelByte Inc. All Rights Reserved.
// Copyright (c) 2023 - 2024 AccelByte Inc. All Rights Reserved.
// This is licensed software from AccelByte Inc, for limitations
// and restrictions contact your company contract manager.

using AccelByte.Core;
using AccelByte.Models;
using System.Collections.Generic;
using System;

namespace AccelByte.Api
{
public class AnalyticsApi : ApiBase
[Obsolete("Please use ClientGameTelemetryApi api, will be removed on September release")]
public class AnalyticsApi : ClientGameTelemetryApi
{
private readonly string gameTelemetryUrl;

internal AnalyticsApi(IHttpClient inHttpClient,
Config inConfig,
ISession inSession)
: base(inHttpClient, inConfig, inConfig.GameTelemetryServerUrl, inSession)
: base(inHttpClient, inConfig, inSession)
{
gameTelemetryUrl = inConfig.GameTelemetryServerUrl + "/v1/protected/events";
}

public async void SendData(List<TelemetryBody> telemetryBodies
, ResultCallback callback)
{
if (telemetryBodies == null)
{
AccelByteDebug.LogError(nameof(telemetryBodies) + " is null.");
callback.TryError(ErrorCode.InvalidArgument);
return;
}

var request = HttpRequestBuilder
.CreatePost(gameTelemetryUrl)
.WithContentType(MediaType.ApplicationJson)
.WithBody(telemetryBodies.ToUtf8Json())
.WithBearerAuth(AuthToken)
.Accepts(MediaType.ApplicationJson)
.GetResult();

HttpSendResult sendResult = await HttpClient.SendRequestAsync(request);
IHttpResponse response = sendResult.CallbackResponse;
var result = response.TryParse();
callback.Try(result);
}
}
}
66 changes: 59 additions & 7 deletions Runtime/Api/Analytics/AnalyticsService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,19 @@

using AccelByte.Core;
using AccelByte.Models;
using System;
using System.Collections.Generic;
using UnityEngine.Assertions;

namespace AccelByte.Api
{
public class AnalyticsService : WrapperBase, IAccelByteAnalyticsWrapper
{
private readonly AnalyticsApi api = null;
private readonly ClientGameTelemetryApi api = null;
private readonly ISession session = null;

[UnityEngine.Scripting.Preserve]
public AnalyticsService(AnalyticsApi inApi,
public AnalyticsService(ClientGameTelemetryApi inApi,
ISession inSession,
CoroutineRunner runner)
{
Expand All @@ -27,23 +28,74 @@ public AnalyticsService(AnalyticsApi inApi,

public void SendData(List<TelemetryBody> data, ResultCallback callback)
{
if (session.IsValid())
AccelByteTimeManager timeManager = SharedMemory?.TimeManager;

if (timeManager != null)
{
foreach (var telemetryBody in data)
{
if (!telemetryBody.IsTimeStampSet && telemetryBody.CreatedElapsedTime == null)
{
telemetryBody.SetTimeReference(timeManager.TimelapseSinceSessionStart.Elapsed);
}
}
}

api.SendData(data, callback);
if (timeManager != null)
{
System.Action sendTelemetryAfterFetchingServerTime = () =>
{
foreach (var telemetryBody in data)
{
if (!telemetryBody.IsTimeStampSet)
{
telemetryBody.ClientTimestamp = telemetryBody.CalculateClientTimestampFromServerTime(timeManager.GetCachedServerTime());
}
}
ApiSend(data, callback);
};

if (timeManager.GetCachedServerTime() == null)
{
Action<bool> onFetchingServerTimeDone = null;
onFetchingServerTimeDone = success =>
{
if (success)
{
timeManager.OnFetchServerTimeComplete -= onFetchingServerTimeDone;
sendTelemetryAfterFetchingServerTime?.Invoke();
}
else
{
ApiSend(data, callback);
}
};
timeManager.OnFetchServerTimeComplete += onFetchingServerTimeDone;

api.FetchServerTime(ref timeManager);
}
else
{
sendTelemetryAfterFetchingServerTime?.Invoke();
}
}
else
{
callback.TryError(ErrorCode.InvalidRequest, "User is not logged in.");
ApiSend(data, callback);
}
}

public void SendData(TelemetryBody data, ResultCallback callback)
{
List<TelemetryBody> dataList = new List<TelemetryBody>() { data };
SendData(dataList, callback);
}

private void ApiSend(List<TelemetryBody> data, ResultCallback callback)
{
if (session.IsValid())
{
List<TelemetryBody> dataList = new List<TelemetryBody>() { data };
api.SendData(dataList, callback);
api.SendData(data, callback);
}
else
{
Expand Down
14 changes: 11 additions & 3 deletions Runtime/Api/Analytics/ClientAnalyticsService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ public class ClientAnalyticsService
private ClientAnalyticsEventScheduler analyticsControllerEventScheduler;
private IHttpClient httpClient;
AccelByteAnalyticsSettings analyticsSettings;

public ClientAnalyticsService(IHttpClient httpClient = null)
private ApiSharedMemory sharedMemory;

public ClientAnalyticsService(IHttpClient httpClient = null, AccelByteTimeManager timeManager = null)
{
if (httpClient == null)
{
Expand All @@ -30,6 +31,11 @@ public ClientAnalyticsService(IHttpClient httpClient = null)
}

analyticsSettings = new AccelByteAnalyticsSettings();

sharedMemory = new ApiSharedMemory()
{
TimeManager = timeManager
};
}

/// <summary>
Expand Down Expand Up @@ -160,7 +166,7 @@ private bool Initialize(string platform, SettingsEnvironment environment, out Er
httpClient,
taskRunner);

AnalyticsApi analyticsApi = new AnalyticsApi(
var analyticsApi = new ClientGameTelemetryApi(
httpClient,
clientConfig,
analyticsControllerSession);
Expand All @@ -169,6 +175,7 @@ private bool Initialize(string platform, SettingsEnvironment environment, out Er
analyticsApi,
analyticsControllerSession,
taskRunner);
analyticsService.SetSharedMemory(sharedMemory);

CreateAnalyticsControllerEventScheduler(analyticsControllerSession, analyticsService, clientConfig.ClientAnalyticsEventInterval);
}
Expand Down Expand Up @@ -210,6 +217,7 @@ private SettingsEnvironment GetEnvironment()
private void CreateAnalyticsControllerEventScheduler(Server.ServerOauthLoginSession analyticsControllerSession, AnalyticsService analyticsService, float intervalInMs)
{
analyticsControllerEventScheduler = new ClientAnalyticsEventScheduler(analyticsService);
analyticsControllerEventScheduler.SetSharedMemory(ref sharedMemory);
analyticsControllerEventScheduler.SetInterval(intervalInMs);
analyticsControllerEventScheduler.SetEventEnabled(true);
System.Action<ResultCallback<TokenData>> onAutoLoginDelegate = (callback) =>
Expand Down
33 changes: 33 additions & 0 deletions Runtime/Api/Analytics/ClientGameTelemetryApi.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Copyright (c) 2023 - 2024 AccelByte Inc. All Rights Reserved.
// This is licensed software from AccelByte Inc, for limitations
// and restrictions contact your company contract manager.

using AccelByte.Core;
using AccelByte.Models;
using System.Collections.Generic;
using UnityEngine.Assertions;

namespace AccelByte.Api
{
public class ClientGameTelemetryApi : ApiBase
{
internal ClientGameTelemetryApi(IHttpClient inHttpClient,
Config inConfig,
ISession inSession)
: base(inHttpClient, inConfig, inConfig.GameTelemetryServerUrl, inSession)
{
}

public void SendData(List<TelemetryBody> telemetryBodies
, ResultCallback callback)
{
AccelByteGameTelemetryApi.SendProtectedEventV1(telemetryBodies,httpOperator, BaseUrl, AuthToken, callback);
}

internal void FetchServerTime(ref AccelByteTimeManager timeManager)
{
Assert.IsNotNull(timeManager, "Time manager can't be null");
timeManager.FetchServerTime(httpOperator, Config.Namespace, Config.BasicServerUrl);
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public void SendTelemetryBatch(ResultCallback callback)
return;
}

Scheduler.SendQueuedEvent(callback);
Scheduler.ImmediateBatchSend(callback);
}

internal void Initialize(TAnalyticsWrapper inApi)
Expand Down
Loading

0 comments on commit fab9f8c

Please sign in to comment.