From eed021d3cedc09bbd2e07da1f24f817746aa0069 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Dobrza=C5=84ski?= <106665140+MikeDobrzan@users.noreply.github.com> Date: Thu, 12 Oct 2023 15:52:27 +0200 Subject: [PATCH] fix: Unity target (#190) * fix: unity target and global cleanup method * fix: doc comment * fix: added missing project files --- .github/workflows/release/versions.json | 9 +- src/Api/PubnubApi/Pubnub.cs | 28 +- src/Api/PubnubApiUnity/PubnubApiUnity.csproj | 933 +++++++++++++++++++ src/Api/PubnubApiUnity/pubnub.snk | Bin 0 -> 596 bytes src/Pubnub.sln | 35 + 5 files changed, 1003 insertions(+), 2 deletions(-) create mode 100644 src/Api/PubnubApiUnity/PubnubApiUnity.csproj create mode 100644 src/Api/PubnubApiUnity/pubnub.snk diff --git a/.github/workflows/release/versions.json b/.github/workflows/release/versions.json index f6832af9d..f99302d51 100644 --- a/.github/workflows/release/versions.json +++ b/.github/workflows/release/versions.json @@ -39,5 +39,12 @@ "clearedPrefix": true, "clearedSuffix": false } - ] + ], + "src/Api/PubnubApiUnity/PubnubApiUnity.csproj": [ + { + "pattern": "^\\s{2,}(v?(\\d+\\.?){2,}([a-zA-Z0-9-]+(\\.?\\d+)?)?)<\/PackageVersion>$", + "clearedPrefix": true, + "clearedSuffix": false + } + ], } diff --git a/src/Api/PubnubApi/Pubnub.cs b/src/Api/PubnubApi/Pubnub.cs index 3899ed04e..4f2981ae4 100644 --- a/src/Api/PubnubApi/Pubnub.cs +++ b/src/Api/PubnubApi/Pubnub.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Globalization; using System.Reflection; +using PubnubApi.EndPoint; #if !NET35 && !NET40 using System.Collections.Concurrent; #endif @@ -18,6 +19,10 @@ public class Pubnub private readonly EndPoint.TokenManager tokenManager; private object savedSubscribeOperation; private readonly string savedSdkVerion; + + #if UNITY + private static System.Func> OnCleanupCall; + #endif static Pubnub() { @@ -30,6 +35,16 @@ static Pubnub() #endif Version = string.Format(CultureInfo.InvariantCulture, "{0}CSharp{1}", PNPlatform.Get(), assemblyVersion); } + + #if UNITY + /// + /// Call this function to globally clean up all background threads running in the SDK. Note that this will unsubscribe all channels. + /// + public static void CleanUp() + { + OnCleanupCall?.Invoke(); + } + #endif #region "PubNub API Channel Methods" @@ -860,6 +875,10 @@ public void SetJsonPluggableLibrary(IJsonPluggableLibrary customJson) public Pubnub(PNConfiguration config) { + #if UNITY + OnCleanupCall += this.UnsubscribeAll; + #endif + savedSdkVerion = Version; InstanceId = Guid.NewGuid().ToString(); pubnubConfig.AddOrUpdate(InstanceId, config, (k, o) => config); @@ -905,6 +924,13 @@ public Pubnub(PNConfiguration config) } + #if UNITY + ~Pubnub() + { + OnCleanupCall -= this.UnsubscribeAll; + } + #endif + private void CheckRequiredConfigValues() { if (pubnubConfig != null && pubnubConfig.ContainsKey(InstanceId)) @@ -932,5 +958,5 @@ private void CheckRequiredConfigValues() } #endregion - } + } } \ No newline at end of file diff --git a/src/Api/PubnubApiUnity/PubnubApiUnity.csproj b/src/Api/PubnubApiUnity/PubnubApiUnity.csproj new file mode 100644 index 000000000..938408f3a --- /dev/null +++ b/src/Api/PubnubApiUnity/PubnubApiUnity.csproj @@ -0,0 +1,933 @@ + + + + netstandard1.0;netstandard1.3;netstandard1.4;netstandard1.1;netstandard2.0;net6.0 + true + True + pubnub.snk + False + False + PubNub C# .NET - Web Data Push API + PubnubApiUnity + true + + + + PubnubApiUnity + 6.18.0.0 + PubNub C# .NET - Web Data Push API + Pandu Masabathula + PubNub + LICENSE.txt + http://pubnub.s3.amazonaws.com/2011/powered-by-pubnub/pubnub-icon-600x600.png + true + https://github.com/pubnub/c-sharp/ + Allow name param as optional in SetChannelMetadata. Removed default empty value. + Web Data Push Real-time Notifications ESB Message Broadcasting Distributed Computing + + PubNub is a Massively Scalable Web Push Service for Web and Mobile Games. This is a cloud-based service for broadcasting messages to thousands of web and mobile clients simultaneously + PubNub 2012-2021 + + $(PackageTargetFallback);dnxcore50 + + + $(PackageTargetFallback);dnxcore50 + + + $(PackageTargetFallback);dnxcore50 + + + $(PackageTargetFallback);dnxcore50 + + + False + false + + + + + + Builder\ResponseBuilder.cs + + + Builder\StatusBuilder.cs + + + Builder\UriUtil.cs + + + Builder\UrlRequestBuilder.cs + + + Callbacks\PNCallback.cs + + + Callbacks\SubscribeCallback.cs + + + ClientNetworkStatus.cs + + + ConcurrentDictionary.cs + + + EndPoint\Access\AuditOperation.cs + + + EndPoint\Access\GrantOperation.cs + + + + + EndPoint\ChannelGroup\AddChannelsToChannelGroupOperation.cs + + + EndPoint\ChannelGroup\DeleteChannelGroupOperation.cs + + + EndPoint\ChannelGroup\ListAllChannelGroupOperation.cs + + + EndPoint\ChannelGroup\ListChannelsForChannelGroupOperation.cs + + + EndPoint\ChannelGroup\RemoveChannelsFromChannelGroupOperation.cs + + + + + + + + + + + + + + + + + + + + + + + + + + EndPoint\OtherOperation.cs + + + EndPoint\Presence\GetStateOperation.cs + + + EndPoint\Presence\HereNowOperation.cs + + + EndPoint\Presence\SetStateOperation.cs + + + EndPoint\Presence\WhereNowOperation.cs + + + + + EndPoint\PubSub\FireOperation.cs + + + + EndPoint\PubSub\ListenerManager.cs + + + EndPoint\PubSub\PublishOperation.cs + + + + + EndPoint\PubSub\SubscribeManager.cs + + + EndPoint\PubSub\SubscribeOperation.cs + + + EndPoint\PubSub\UnsubscribeAllOperation.cs + + + EndPoint\PubSub\UnsubscribeOperation.cs + + + EndPoint\Push\AddPushChannelOperation.cs + + + EndPoint\Push\AuditPushChannelOperation.cs + + + + EndPoint\Push\RemovePushChannelOperation.cs + + + + + + + + EndPoint\TimeOperation.cs + + + + + + Enum\PNHeartbeatNotificationOption.cs + + + Enum\PNLogVerbosity.cs + + + + Enum\PNOperationType.cs + + + Enum\PNReconnectionPolicy.cs + + + Enum\PNStatusCategory.cs + + + Enum\PubnubErrorCode.cs + + + Enum\PubnubErrorSeverity.cs + + + Enum\PubnubMessageSource.cs + + + + Enum\PushTypeService.cs + + + Enum\ResponseType.cs + + + + HttpUtility\HttpUtility.cs + + + HttpUtility\HttpValue.cs + + + HttpUtility\HttpValueCollection.cs + + + Interface\IJsonPluggableLibrary.cs + + + Interface\IPubnubHttp.cs + + + Interface\IPubnubLog.cs + + + Interface\IPubnubUnitTest.cs + + + Interface\IUrlRequestBuilder.cs + + + + + + + + + + + + + + + + + + + + + + + + + Log\LoggingMethod.cs + + + Log\PNPlatform.cs + + + Model\Consumer\AccessManager\PNAccessManagerAuditResult.cs + + + Model\Consumer\AccessManager\PNAccessManagerGrantResult.cs + + + Model\Consumer\AccessManager\PNAccessManagerKeyData.cs + + + Model\Consumer\AccessManager\PNAccessManagerKeysData.cs + + + + + + + + Model\Consumer\ChannelGroup\PNChannelGroupsAddChannelResult.cs + + + Model\Consumer\ChannelGroup\PNChannelGroupsAllChannelsResult.cs + + + Model\Consumer\ChannelGroup\PNChannelGroupsDeleteGroupResult.cs + + + Model\Consumer\ChannelGroup\PNChannelGroupsListAllResult.cs + + + Model\Consumer\ChannelGroup\PNChannelGroupsRemoveChannelResult.cs + + + + + + + + + + + + + + + Model\Consumer\History\PNHistoryItemResult.cs + + + Model\Consumer\History\PNHistoryResult.cs + + + + + + + + + + + + + + + + + + + + + Model\Consumer\PNErrorData.cs + + + + Model\Consumer\PNStatus.cs + + + Model\Consumer\PNTimeResult.cs + + + Model\Consumer\Presence\PNGetStateResult.cs + + + Model\Consumer\Presence\PNHereNowChannelData.cs + + + Model\Consumer\Presence\PNHereNowOccupantData.cs + + + Model\Consumer\Presence\PNHereNowResult.cs + + + Model\Consumer\Presence\PNSetStateResult.cs + + + Model\Consumer\Presence\PNWhereNowResult.cs + + + + + + + + + Model\Consumer\Pubsub\PNMessageResult.cs + + + + Model\Consumer\Pubsub\PNPresenceEventResult.cs + + + Model\Consumer\Pubsub\PNPublishResult.cs + + + + + Model\Consumer\Push\PNPushAddChannelResult.cs + + + Model\Consumer\Push\PNPushListProvisionsResult.cs + + + Model\Consumer\Push\PNPushRemoveAllChannelsResult.cs + + + Model\Consumer\Push\PNPushRemoveChannelResult.cs + + + + Model\Derived\AccessManager\PNAccessManagerAuditResultExt.cs + + + Model\Derived\AccessManager\PNAccessManagerGrantResultExt.cs + + + + + Model\Derived\ChannelGroup\PNChannelGroupsAddChannelResultExt.cs + + + Model\Derived\ChannelGroup\PNChannelGroupsAllChannelsResultExt.cs + + + Model\Derived\ChannelGroup\PNChannelGroupsDeleteGroupResultExt.cs + + + Model\Derived\ChannelGroup\PNChannelGroupsListAllResultExt.cs + + + Model\Derived\ChannelGroup\PNChannelGroupsRemoveChannelResultExt.cs + + + + + + + + + + + + Model\Derived\History\PNHistoryResultExt.cs + + + + + + + + + + + + + + Model\Derived\PNTimeResultExt.cs + + + Model\Derived\Presence\PNGetStateResultExt.cs + + + Model\Derived\Presence\PNHereNowResultEx.cs + + + Model\Derived\Presence\PNSetStateResultExt.cs + + + Model\Derived\Presence\PNWhereNowResultExt.cs + + + + + Model\Derived\Pubsub\PNPublishResultExt.cs + + + + Model\Derived\Pubsub\SubscribeCallbackExt.cs + + + Model\Derived\Push\PNPushAddChannelResultExt.cs + + + Model\Derived\Push\PNPushListProvisionsResultExt.cs + + + + Model\Derived\Push\PNPushRemoveChannelResultExt.cs + + + Model\InternetState.cs + + + + Model\PNHeartbeatResult.cs + + + Model\PNStatusCategoryHelper.cs + + + + Model\ReconnectState.cs + + + Model\RequestState.cs + + + Model\Server\SubscribeEnvelope.cs + + + Model\Server\SubscribeMessage.cs + + + Model\Server\TimetokenMetadata.cs + + + NewtonsoftJsonDotNet.cs + + + PNConfiguration.cs + + + + Proxy\PubnubProxy.cs + + + Pubnub.cs + + + PubnubCoreBase.cs + + + PubnubHttp.cs + + + + Push\Mpns\MpnsCycleTileNotification.cs + + + Push\Mpns\MpnsFlipTileNotification.cs + + + Push\Mpns\MpnsIconicTileNotification.cs + + + Push\Mpns\MpnsToastNotification.cs + + + Security\MD5.cs + + + Security\MD5CryptoServiceProvider.cs + + + Security\PubnubCrypto.cs + + + Security\PubnubCryptoBase.cs + + + Security\SecureMessage.cs + + + Timer.cs + + + + + UNITY + + + + $(DefineConstants);NETSTANDARD10;UNITY + + + + $(DefineConstants);NETSTANDARD11;UNITY + + + + $(DefineConstants);NETSTANDARD13;UNITY + + + + $(DefineConstants);NETSTANDARD14;UNITY + + + + $(DefineConstants);NETSTANDARD20;UNITY + + + + $(DefineConstants);NET60;UNITY + + + + 1701;1702; + + + + 1701;1702; + + + + + + + + + + None + + + None + + + + + None + + + None + + + None + + + None + + + None + + + None + + + None + + + None + + + None + + + 4.3.0 + None + + + + + + + None + + + None + + + + + None + + + None + + + None + + + None + + + 4.3.0 + None + + + + + + + None + + + None + + + + + None + + + None + + + None + + + None + + + None + + + None + + + None + + + None + + + None + + + None + + + None + + + 4.3.0 + None + + + + + + + + + None + + + None + + + + + None + + + None + + + None + + + None + + + None + + + None + + + None + + + None + + + None + + + None + + + None + + + 4.3.0 + None + + + + + + + None + + + None + + + + + None + + + None + + + None + + + None + + + None + + + None + + + None + + + None + + + None + + + None + + + None + + + 4.3.0 + None + + + + + + + None + + + + + None + + + None + + + None + + + None + + + None + + + None + + + None + + + None + + + None + + + None + + + None + + + None + + + None + + + None + + + None + + + 4.3.0 + None + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Api/PubnubApiUnity/pubnub.snk b/src/Api/PubnubApiUnity/pubnub.snk new file mode 100644 index 0000000000000000000000000000000000000000..ab6f98e6ccbe10048ac6dfc9922832a5c4b39a22 GIT binary patch literal 596 zcmV-a0;~N80ssI2Bme+XQ$aES1ONa50096=h*pb2CXpvv;Js;9b9kQs|3b=ComT{N ziUL7K9M}p!WAqV04_SQXqzw;R;bq54Xnywpy`2cq;aP9P6vK}{hq(oAm@7=O7(xoP zY}{Hc&8AbMXN0npkl4STLH<s^7fZ z@G104xb8*?e}bGrE&T#EGhb0ocj6KeeXb$DF{GaDvCq4&h7(OV(!{x~o|bHSlV7^| zYGMl`=Lx$CL!#xY((Qw3Urdawedl{1sf}?e9lj{n(#+}o*+?P|*NTx5C|O{NdRMOo z87;7|v4snR2zBjV|4Qh0`ku#5QjgMyS*v<3vRA(U%7OKwYjO064<=cZ28s>#-RxXL4I#C2%<%<-zIIrTY)8c*(A?p9hA)oTMXkCTlb(Wf5axkzrW%&T zoJj}GHDWELO-QEm6L}-9Q=xdCRkmb#< zm+&3vUMMt5!+Rx)1B9~r#!8#o5WY*jh0;VT@ygH53);jOQ6>PZOhQO1K6(G5{3|HU iSa<~)<|H!5yTV$GoUpH<7?8K2GQo*km!(;|inuqU