Skip to content

UUID changes #58

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/commands-handler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
11 changes: 8 additions & 3 deletions .pubnub.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions PubNubUnity/Assets/PubNub/Editor/EditorCommon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -62,6 +63,7 @@ public static PNConfiguration CreatePNConfig(){
pnConfiguration.LogVerbosity = PNLogVerbosity.BODY;
pnConfiguration.PresenceTimeout = 60;
pnConfiguration.PresenceInterval= 30;
pnConfiguration.UUID = PubNub.GenerateUUID();
return pnConfiguration;
}

Expand Down
1 change: 1 addition & 0 deletions PubNubUnity/Assets/PubNub/Editor/PNConfigurationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion PubNubUnity/Assets/PubNub/Examples/Example.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
1 change: 1 addition & 0 deletions PubNubUnity/Assets/PubNub/Helpers/CommonText.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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.";
}
}
6 changes: 6 additions & 0 deletions PubNubUnity/Assets/PubNub/Helpers/Utility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, object> dictionary, string keyName){
if(dictionary.ContainsKey(keyName) && dictionary[keyName].Equals(true)){
Expand Down
1 change: 1 addition & 0 deletions PubNubUnity/Assets/PubNub/Models/Server/BuildRequests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1300,6 +1300,7 @@ private static string TokenOrAuthKey(PubNubUnity pnInstance){
private static Uri BuildRestApiRequest<T> (List<string> urlComponents, PNOperationType type, string parameters, PubNubUnity pnInstance, Dictionary<string, string> 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 5 additions & 0 deletions PubNubUnity/Assets/PubNub/PubNub.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down Expand Up @@ -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();
Expand Down
5 changes: 1 addition & 4 deletions PubNubUnity/Assets/PubNub/PubNubUnity/PNConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion PubNubUnity/Assets/PubNub/PubNubUnity/PubNubUnityBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.0.1
7.0.0