diff --git a/.github/workflows/commands-handler.yml b/.github/workflows/commands-handler.yml index e5196c1b..ab7456da 100644 --- a/.github/workflows/commands-handler.yml +++ b/.github/workflows/commands-handler.yml @@ -12,6 +12,8 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v2 + with: + token: ${{ secrets.GH_TOKEN }} - name: Checkout release actions uses: actions/checkout@v2 with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3ee00d22..2510b702 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -38,6 +38,7 @@ jobs: with: # This should be the same as the one specified for on.pull_request.branches ref: master + token: ${{ secrets.GH_TOKEN }} - name: Checkout actions uses: actions/checkout@v2 with: diff --git a/.pubnub.yml b/.pubnub.yml index 310eb59e..f98611c2 100644 --- a/.pubnub.yml +++ b/.pubnub.yml @@ -1,6 +1,11 @@ --- -version: v6.0.1 +version: v7.0.0 changelog: + - date: 2022-01-06 + version: v7.0.0 + changes: + - type: improvement + text: "BREAKING CHANGES: UUID is not automatically generated by the SDK anymore. Please set it in the PNConfig before instantiating the PubNub object. If UUID is empty an exception will be thrown." - date: 2021-11-30 version: v6.0.1 changes: @@ -628,7 +633,7 @@ sdks: distributions: - distribution-type: package - distribution-repository: git release + distribution-repository: GitHub package-name: PubNub.unitypackage location: https://github.com/pubnub/unity/releases/download/v5.0.0/PubNub.unitypackage requires: @@ -795,7 +800,7 @@ sdks: distributions: - distribution-type: package - distribution-repository: git release + distribution-repository: GitHub package-name: PubNub.unitypackage location: https://github.com/pubnub/unity/releases/download/v5.0.0/PubNub.unitypackage requires: diff --git a/PubNubUnity/Assets/PubNub/Editor/EditorCommon.cs b/PubNubUnity/Assets/PubNub/Editor/EditorCommon.cs index 0cce1f24..a521dfde 100644 --- a/PubNubUnity/Assets/PubNub/Editor/EditorCommon.cs +++ b/PubNubUnity/Assets/PubNub/Editor/EditorCommon.cs @@ -50,6 +50,7 @@ public class EditorCommon public bool DeliveryStatus { get; set; } public static PubNub InitPN(PNConfiguration pnConfig){ + pnConfig.UUID = PubNub.GenerateUUID(); return new PubNub(pnConfig); } @@ -62,6 +63,7 @@ public static PNConfiguration CreatePNConfig(){ pnConfiguration.LogVerbosity = PNLogVerbosity.BODY; pnConfiguration.PresenceTimeout = 60; pnConfiguration.PresenceInterval= 30; + pnConfiguration.UUID = PubNub.GenerateUUID(); return pnConfiguration; } diff --git a/PubNubUnity/Assets/PubNub/Editor/PNConfigurationTests.cs b/PubNubUnity/Assets/PubNub/Editor/PNConfigurationTests.cs index ed8fbea6..b28280bf 100644 --- a/PubNubUnity/Assets/PubNub/Editor/PNConfigurationTests.cs +++ b/PubNubUnity/Assets/PubNub/Editor/PNConfigurationTests.cs @@ -13,6 +13,7 @@ public class PNConfigurationTests public void TestPNinGenerateGuid () { PNConfiguration pnConfig = new PNConfiguration(); + pnConfig.UUID = PubNub.GenerateUUID(); Assert.IsTrue(pnConfig.UUID.Contains("pn-")); } #endif diff --git a/PubNubUnity/Assets/PubNub/Examples/Example.cs b/PubNubUnity/Assets/PubNub/Examples/Example.cs index 5da83295..ecbe3dac 100644 --- a/PubNubUnity/Assets/PubNub/Examples/Example.cs +++ b/PubNubUnity/Assets/PubNub/Examples/Example.cs @@ -487,7 +487,7 @@ void Init(){ pnConfiguration.HeartbeatNotificationOption = PNHeartbeatNotificationOption.All; //TODO: remove - pnConfiguration.UUID = "PubNubUnityExample"; + pnConfiguration.UUID = PubNub.GenerateUUID(); Debug.Log ("PNConfiguration"); pubnub = new PubNub (pnConfiguration); diff --git a/PubNubUnity/Assets/PubNub/Helpers/CommonText.cs b/PubNubUnity/Assets/PubNub/Helpers/CommonText.cs index 437a195a..cb4b00d4 100644 --- a/PubNubUnity/Assets/PubNub/Helpers/CommonText.cs +++ b/PubNubUnity/Assets/PubNub/Helpers/CommonText.cs @@ -6,5 +6,6 @@ internal static class CommonText { internal static readonly string DuplicateChannelsOrChannelGroups = "Duplicate Channels or Channel Groups"; internal static readonly string APNS2TopicEmpty = "Topic cannot be empty when APNS2 is selected"; + internal static readonly string UUIDMissing = "UUID misisng, please set it in the PNConfig."; } } \ No newline at end of file diff --git a/PubNubUnity/Assets/PubNub/Helpers/Utility.cs b/PubNubUnity/Assets/PubNub/Helpers/Utility.cs index b29de4c4..7a357c6b 100644 --- a/PubNubUnity/Assets/PubNub/Helpers/Utility.cs +++ b/PubNubUnity/Assets/PubNub/Helpers/Utility.cs @@ -25,6 +25,12 @@ public static int CheckTimeoutValue(int value){ } } #endif + + public static void CheckUUID(string uuid){ + if (string.IsNullOrEmpty (uuid) || string.IsNullOrEmpty (uuid.Trim ())) { + throw new PubNubException(CommonText.UUIDMissing); + } + } public static bool CheckDictionaryForError(Dictionary dictionary, string keyName){ if(dictionary.ContainsKey(keyName) && dictionary[keyName].Equals(true)){ diff --git a/PubNubUnity/Assets/PubNub/Models/Server/BuildRequests.cs b/PubNubUnity/Assets/PubNub/Models/Server/BuildRequests.cs index f9b5e230..50207d3f 100644 --- a/PubNubUnity/Assets/PubNub/Models/Server/BuildRequests.cs +++ b/PubNubUnity/Assets/PubNub/Models/Server/BuildRequests.cs @@ -1300,6 +1300,7 @@ private static string TokenOrAuthKey(PubNubUnity pnInstance){ private static Uri BuildRestApiRequest (List urlComponents, PNOperationType type, string parameters, PubNubUnity pnInstance, Dictionary queryParams) { string uuid = pnInstance.PNConfig.UUID; + Utility.CheckUUID(pnInstance.PNConfig.UUID); bool ssl = pnInstance.PNConfig.Secure; string origin = pnInstance.PNConfig.Origin; int pubnubPresenceHeartbeatInSeconds = pnInstance.PNConfig.PresenceTimeout; diff --git a/PubNubUnity/Assets/PubNub/PlayModeTests/PlayModeCommon.cs b/PubNubUnity/Assets/PubNub/PlayModeTests/PlayModeCommon.cs index a057e3cb..2fd97a31 100644 --- a/PubNubUnity/Assets/PubNub/PlayModeTests/PlayModeCommon.cs +++ b/PubNubUnity/Assets/PubNub/PlayModeTests/PlayModeCommon.cs @@ -90,6 +90,7 @@ public static PNConfiguration SetPNConfig(bool useCipher, bool withPAM){ pnConfiguration.Origin = Origin; pnConfiguration.SubscribeKey = SubscribeKey; pnConfiguration.PublishKey = PublishKey; + pnConfiguration.UUID = PubNub.GenerateUUID(); pnConfiguration.NonSubscribeTimeout = 30; if(withPAM){ pnConfiguration.SubscribeKey = SubscribeKeyPAM; diff --git a/PubNubUnity/Assets/PubNub/PubNub.cs b/PubNubUnity/Assets/PubNub/PubNub.cs index cb88de0e..685e4026 100644 --- a/PubNubUnity/Assets/PubNub/PubNub.cs +++ b/PubNubUnity/Assets/PubNub/PubNub.cs @@ -72,6 +72,7 @@ private PubNub (PNConfiguration pnConfiguration, GameObject gameObjectRef, IJson this.jsonLibrary = jsonLibrary; this.gameObj = gameObjectRef; this.PNConfig = pnConfiguration; + Utility.CheckUUID(this.PNConfig.UUID); PubNubUnityInitializationAfterCleanup(); } @@ -102,6 +103,10 @@ public IJsonLibrary JsonLibrary{ } } + public static string GenerateUUID(){ + return string.Format("pn-{0}", Guid.NewGuid ().ToString ()); + } + public void Reconnect(){ PubNubUnityInitializationAfterCleanup(); pnUnity.Reconnect(); diff --git a/PubNubUnity/Assets/PubNub/PubNubUnity/PNConfiguration.cs b/PubNubUnity/Assets/PubNub/PubNubUnity/PNConfiguration.cs index 849014e9..1bd2e1dc 100644 --- a/PubNubUnity/Assets/PubNub/PubNubUnity/PNConfiguration.cs +++ b/PubNubUnity/Assets/PubNub/PubNubUnity/PNConfiguration.cs @@ -29,14 +29,11 @@ public ushort ConcurrentNonSubscribeWorkers { private string uuid; public string UUID { get{ - if (string.IsNullOrEmpty (uuid) || string.IsNullOrEmpty (uuid.Trim ())) { - uuid = string.Format("pn-{0}", Guid.NewGuid ().ToString ()); - } - return uuid; } set{ uuid = value; + Utility.CheckUUID(uuid); if(UUIDChanged!=null){ UUIDChanged.Invoke(this, null); } diff --git a/PubNubUnity/Assets/PubNub/PubNubUnity/PubNubUnityBase.cs b/PubNubUnity/Assets/PubNub/PubNubUnity/PubNubUnityBase.cs index 2957f580..1adf39af 100644 --- a/PubNubUnity/Assets/PubNub/PubNubUnity/PubNubUnityBase.cs +++ b/PubNubUnity/Assets/PubNub/PubNubUnity/PubNubUnityBase.cs @@ -7,7 +7,7 @@ namespace PubNubAPI public class PubNubUnityBase { protected Counter publishMessageCounter; - private const string build = "6.0.1"; + private const string build = "7.0.0"; private string pnsdkVersion = string.Format ("PubNub-CSharp-Unity/{0}", build); public string Version { diff --git a/README.md b/README.md index 81a51896..75f30d1f 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ You will need the publish and subscribe keys to authenticate your app. Get your ## Configure PubNub -1. Download the PubNub Unity package from [this repository](https://github.com/pubnub/unity/releases/download/v6.0.1/PubNub.unitypackage). +1. Download the PubNub Unity package from [this repository](https://github.com/pubnub/unity/releases/download/v7.0.0/PubNub.unitypackage). 2. Import it to your Unity project by going to Assets -> Import Package -> Custom Package. diff --git a/VERSION b/VERSION index 5fe60723..66ce77b7 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -6.0.1 +7.0.0