Skip to content

Commit

Permalink
UserId intro to config and build support for .net 4.8 and net 6.0 (#149)
Browse files Browse the repository at this point in the history
* Added UserId to PNConfig
* Added GetCurrentUserId() method.
* .Net Framework 4.8 build support
* Added support for net6.0
  • Loading branch information
budgetpreneur authored Jul 18, 2022
1 parent 6d9ec01 commit 17af03d
Show file tree
Hide file tree
Showing 74 changed files with 1,002 additions and 667 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x
- name: Setup .NET 6.0.x
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.x
- name: Build packages
env:
WORKSPACE_PATH: ${{ github.workspace }}
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x
- name: Setup .NET 6.0.x
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.x
- name: Build packages
env:
WORKSPACE_PATH: ${{ github.workspace }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/run_acceptance_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ jobs:
with:
token: ${{ secrets.GH_TOKEN }}

- name: Setup .NET 5.0.x
- name: Setup .NET 6.0.x
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x
dotnet-version: 6.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build Projects
Expand Down
88 changes: 27 additions & 61 deletions .pubnub.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
name: c-sharp
version: "6.5.0"
version: "6.6.0"
schema: 1
scm: github.com/pubnub/c-sharp
changelog:
- date: 2022-07-18
version: v6.6.0
changes:
- type: improvement
text: "Introduced UserId to PNConfiguration and deprecated UUID."
- type: improvement
text: "Added build target framework support to .Net Framework 4.8 and .Net 6.0."
- date: 2022-06-14
version: v6.5.0
changes:
Expand Down Expand Up @@ -653,7 +660,7 @@ features:
- QUERY-PARAM
supported-platforms:
-
version: Pubnub 'C#' 6.5.0
version: Pubnub 'C#' 6.6.0
platforms:
- Windows 10 and up
- Windows Server 2008 and up
Expand All @@ -663,7 +670,7 @@ supported-platforms:
- .Net Framework 4.5
- .Net Framework 4.6.1+
-
version: PubnubPCL 'C#' 6.5.0
version: PubnubPCL 'C#' 6.6.0
platforms:
- Xamarin.Android
- Xamarin.iOS
Expand All @@ -681,8 +688,9 @@ supported-platforms:
- .Net Standard 2.0
- .Net Standard 2.1
- .Net Core
- .Net 6.0
-
version: PubnubUWP 'C#' 6.5.0
version: PubnubUWP 'C#' 6.6.0
platforms:
- Windows Phone 10
- Universal Windows Apps
Expand All @@ -706,7 +714,7 @@ sdks:
distribution-type: source
distribution-repository: GitHub
package-name: Pubnub
location: https://github.com/pubnub/c-sharp/releases/tag/v6.5.0.0
location: https://github.com/pubnub/c-sharp/releases/tag/v6.6.0.0
requires:
-
name: ".Net"
Expand All @@ -722,18 +730,11 @@ sdks:
license-url: "https://raw.githubusercontent.com/JamesNK/Newtonsoft.Json/master/LICENSE.md"
location: "External"
is-required: "Required"
-
name: "Portable.BouncyCastle"
min-version: "1.8.1.2"
license: "MIT,X11"
license-url: "https://www.nuget.org/packages/Portable.BouncyCastle/1.8.1.2"
location: "External"
is-required: "Required"
-
name: "PeterO.Cbor"
min-version: "4.4.4"
min-version: "4.5.2"
license: "CC0-1.0"
license-url: "https://www.nuget.org/packages/PeterO.Cbor/4.4.4"
license-url: "https://www.nuget.org/packages/PeterO.Cbor/4.5.2"
location: "External"
is-required: "Required"
-
Expand Down Expand Up @@ -868,18 +869,11 @@ sdks:
license-url: "https://raw.githubusercontent.com/JamesNK/Newtonsoft.Json/master/LICENSE.md"
location: "External"
is-required: "Required"
-
name: "Portable.BouncyCastle"
min-version: "1.8.1.2"
license: "MIT,X11"
license-url: "https://www.nuget.org/packages/Portable.BouncyCastle/1.8.1.2"
location: "External"
is-required: "Required"
-
name: "PeterO.Cbor"
min-version: "4.4.4"
min-version: "4.5.2"
license: "CC0-1.0"
license-url: "https://www.nuget.org/packages/PeterO.Cbor/4.4.4"
license-url: "https://www.nuget.org/packages/PeterO.Cbor/4.5.2"
location: "External"
is-required: "Required"
-
Expand Down Expand Up @@ -1003,7 +997,7 @@ sdks:
distribution-type: source
distribution-repository: GitHub
package-name: PubNubPCL
location: https://github.com/pubnub/c-sharp/releases/tag/v6.5.0.0
location: https://github.com/pubnub/c-sharp/releases/tag/v6.6.0.0
requires:
-
name: ".Net Core"
Expand All @@ -1019,18 +1013,11 @@ sdks:
license-url: "https://raw.githubusercontent.com/JamesNK/Newtonsoft.Json/master/LICENSE.md"
location: "External"
is-required: "Required"
-
name: "Portable.BouncyCastle"
min-version: "1.8.1.2"
license: "MIT,X11"
license-url: "https://www.nuget.org/packages/Portable.BouncyCastle/1.8.1.2"
location: "External"
is-required: "Required"
-
name: "PeterO.Cbor"
min-version: "4.4.4"
min-version: "4.5.2"
license: "CC0-1.0"
license-url: "https://www.nuget.org/packages/PeterO.Cbor/4.4.4"
license-url: "https://www.nuget.org/packages/PeterO.Cbor/4.5.2"
location: "External"
is-required: "Required"
supported-platforms:
Expand Down Expand Up @@ -1204,18 +1191,11 @@ sdks:
license-url: "https://raw.githubusercontent.com/JamesNK/Newtonsoft.Json/master/LICENSE.md"
location: "External"
is-required: "Required"
-
name: "Portable.BouncyCastle"
min-version: "1.8.1.2"
license: "MIT,X11"
license-url: "https://www.nuget.org/packages/Portable.BouncyCastle/1.8.1.2"
location: "External"
is-required: "Required"
-
name: "PeterO.Cbor"
min-version: "4.4.4"
min-version: "4.5.2"
license: "CC0-1.0"
license-url: "https://www.nuget.org/packages/PeterO.Cbor/4.4.4"
license-url: "https://www.nuget.org/packages/PeterO.Cbor/4.5.2"
location: "External"
is-required: "Required"
supported-platforms:
Expand Down Expand Up @@ -1376,7 +1356,7 @@ sdks:
distribution-type: source
distribution-repository: GitHub
package-name: PubnubUWP
location: https://github.com/pubnub/c-sharp/releases/tag/v6.5.0.0
location: https://github.com/pubnub/c-sharp/releases/tag/v6.6.0.0
requires:
-
name: "Universal Windows Platform Development"
Expand All @@ -1399,18 +1379,11 @@ sdks:
license-url: "https://raw.githubusercontent.com/JamesNK/Newtonsoft.Json/master/LICENSE.md"
location: "External"
is-required: "Required"
-
name: "Portable.BouncyCastle"
min-version: "1.8.1.2"
license: "MIT,X11"
license-url: "https://www.nuget.org/packages/Portable.BouncyCastle/1.8.1.2"
location: "External"
is-required: "Required"
-
name: "PeterO.Cbor"
min-version: "4.4.4"
min-version: "4.5.2"
license: "CC0-1.0"
license-url: "https://www.nuget.org/packages/PeterO.Cbor/4.4.4"
license-url: "https://www.nuget.org/packages/PeterO.Cbor/4.5.2"
location: "External"
is-required: "Required"
supported-platforms:
Expand Down Expand Up @@ -1493,18 +1466,11 @@ sdks:
license-url: "https://raw.githubusercontent.com/JamesNK/Newtonsoft.Json/master/LICENSE.md"
location: "External"
is-required: "Required"
-
name: "Portable.BouncyCastle"
min-version: "1.8.1.2"
license: "MIT,X11"
license-url: "https://www.nuget.org/packages/Portable.BouncyCastle/1.8.1.2"
location: "External"
is-required: "Required"
-
name: "PeterO.Cbor"
min-version: "4.4.4"
min-version: "4.5.2"
license: "CC0-1.0"
license-url: "https://www.nuget.org/packages/PeterO.Cbor/4.4.4"
license-url: "https://www.nuget.org/packages/PeterO.Cbor/4.5.2"
location: "External"
is-required: "Required"
supported-platforms:
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
v6.6.0 - July 18 2022
-----------------------------
- Modified: introduced UserId to PNConfiguration and deprecated UUID.
- Modified: added build target framework support to .Net Framework 4.8 and .Net 6.0.

v6.5.0 - June 14 2022
-----------------------------
- Fixed: suppress web request aborted exception message to callback.
Expand Down
4 changes: 2 additions & 2 deletions src/Api/PubnubApi/Builder/UrlRequestBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2038,7 +2038,7 @@ private Dictionary<string, string> GenerateCommonQueryParams(PNOperationType typ
{
if (pubnubUnitTest.IncludeUuid)
{
ret.Add("uuid", UriUtil.EncodeUriComponent(pubnubConfig[pubnubInstanceId].Uuid, PNOperationType.PNSubscribeOperation, false, false, true));
ret.Add("uuid", UriUtil.EncodeUriComponent(pubnubConfig[pubnubInstanceId].UserId, PNOperationType.PNSubscribeOperation, false, false, true));
}

if (pubnubUnitTest.IncludePnsdk)
Expand All @@ -2049,7 +2049,7 @@ private Dictionary<string, string> GenerateCommonQueryParams(PNOperationType typ
else
{
ret.Add("uuid", UriUtil.EncodeUriComponent(uuid != null ? uuid :
(pubnubConfig.ContainsKey(pubnubInstanceId) ? pubnubConfig[pubnubInstanceId].Uuid : ""),
(pubnubConfig.ContainsKey(pubnubInstanceId) ? pubnubConfig[pubnubInstanceId].UserId.ToString() : ""),
PNOperationType.PNSubscribeOperation, false, false, true));
ret.Add("pnsdk", UriUtil.EncodeUriComponent(Pubnub.Version, PNOperationType.PNSubscribeOperation, false, false, true));
}
Expand Down
12 changes: 6 additions & 6 deletions src/Api/PubnubApi/ClientNetworkStatus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System.Threading.Tasks;
using System.IO;
using System.Globalization;
#if !NET35 && !NET40 && !NET45 && !NET461 && !NETSTANDARD10
#if !NET35 && !NET40 && !NET45 && !NET461 && !NET48 && !NETSTANDARD10
using System.Net.Http;
using System.Net.Http.Headers;
#endif
Expand All @@ -20,7 +20,7 @@ internal static class ClientNetworkStatus
private static IPubnubLog pubnubLog;

private static bool networkStatus = true;
#if !NET35 && !NET40 && !NET45 && !NET461 && !NETSTANDARD10
#if !NET35 && !NET40 && !NET45 && !NET461 && !NET48 && !NETSTANDARD10
private static HttpClient httpClient;
#endif

Expand Down Expand Up @@ -72,7 +72,7 @@ public static IPubnubLog PubnubLog
}
}

#if !NET35 && !NET40 && !NET45 && !NET461 && !NETSTANDARD10
#if !NET35 && !NET40 && !NET45 && !NET461 && !NET48 && !NETSTANDARD10
public static HttpClient RefHttpClient
{
set
Expand Down Expand Up @@ -221,7 +221,7 @@ private static async Task<bool> CheckSocketConnect<T>(object internetState)
}
else
{
#if !NET35 && !NET40 && !NET45 && !NET461 && !NETSTANDARD10
#if !NET35 && !NET40 && !NET45 && !NET461 && !NET48 && !NETSTANDARD10
if (pubnubConfig.UseTaskFactoryAsyncInsteadOfHttpClient)
{
gotTimeResp = await GetTimeWithTaskFactoryAsync(requestUri).ConfigureAwait(false);
Expand Down Expand Up @@ -271,7 +271,7 @@ private static void ParseCheckSocketConnectException<T>(Exception ex, PNOperatio
internalcallback(false);
}

#if !NET35 && !NET40 && !NET45 && !NET461 && !NETSTANDARD10
#if !NET35 && !NET40 && !NET45 && !NET461 && !NET48 && !NETSTANDARD10
private static async Task<bool> GetTimeWithHttpClient(Uri requestUri)
{
bool successFlag = false;
Expand Down Expand Up @@ -347,7 +347,7 @@ private static async Task<bool> GetTimeWithClassicHttp<T>(Uri requestUri)
}
if (asyncRequestState.Response != null)
{
#if NET35 || NET40 || NET45 || NET461
#if NET35 || NET40 || NET45 || NET461 || NET48
pubnubRequestState.Response.Close();
#endif
asyncRequestState.Response = null;
Expand Down
2 changes: 1 addition & 1 deletion src/Api/PubnubApi/EndPoint/Files/SendFileOperation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ private static byte[] GetMultipartFormData(byte[] sendFileByteArray, string file
ret = new byte[dataStream.Length];
int bytesRead = dataStream.Read(ret, 0, ret.Length);
System.Diagnostics.Debug.WriteLine(string.Format("MultipartFormData byte count = {0}", bytesRead));
#if NET35 || NET40 || NET45 || NET461
#if NET35 || NET40 || NET45 || NET461 || NET48
dataStream.Close();
#endif
}
Expand Down
4 changes: 2 additions & 2 deletions src/Api/PubnubApi/EndPoint/Objects/GetMembershipsOperation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ private void GetMembershipsList(string uuid, PNPageObject page, int limit, bool
{
if (string.IsNullOrEmpty(uuid))
{
uuid = config.Uuid;
uuid = config.UserId;
}

PNPageObject internalPage;
Expand Down Expand Up @@ -195,7 +195,7 @@ private async Task<PNResult<PNMembershipsResult>> GetMembershipsList(string uuid

if (string.IsNullOrEmpty(uuid))
{
uuid = config.Uuid;
uuid = config.UserId;
}

PNPageObject internalPage;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ private void GetSingleUuidMetadata(string uuid, bool includeCustom, Dictionary<s
}
if (string.IsNullOrEmpty(uuid))
{
uuid = config.Uuid;
uuid = config.UserId;
}

IUrlRequestBuilder urlBuilder = new UrlRequestBuilder(config, jsonLibrary, unit, pubnubLog, pubnubTelemetryMgr, (PubnubInstance != null && !string.IsNullOrEmpty(PubnubInstance.InstanceId) && PubnubTokenMgrCollection.ContainsKey(PubnubInstance.InstanceId)) ? PubnubTokenMgrCollection[PubnubInstance.InstanceId] : null, (PubnubInstance != null) ? PubnubInstance.InstanceId : "");
Expand Down Expand Up @@ -149,7 +149,7 @@ private async Task<PNResult<PNGetUuidMetadataResult>> GetSingleUuidMetadata(stri
{
if (string.IsNullOrEmpty(uuid))
{
uuid = config.Uuid;
uuid = config.UserId;
}
PNResult<PNGetUuidMetadataResult> ret = new PNResult<PNGetUuidMetadataResult>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ private void ManageChannelMembershipWithUuid(string uuid, List<PNMembership> set
{
if (string.IsNullOrEmpty(uuid))
{
uuid = config.Uuid;
uuid = config.UserId;
}

PNPageObject internalPage;
Expand Down Expand Up @@ -246,7 +246,7 @@ private async Task<PNResult<PNMembershipsResult>> ManageChannelMembershipWithUui

if (string.IsNullOrEmpty(uuid))
{
uuid = config.Uuid;
uuid = config.UserId;
}

if (string.IsNullOrEmpty(config.SubscribeKey) || string.IsNullOrEmpty(config.SubscribeKey.Trim()) || config.SubscribeKey.Length <= 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ private void RemoveUuidMemberships(string uuid, List<string> removeMembership, P
{
if (string.IsNullOrEmpty(uuid))
{
uuid = config.Uuid;
uuid = config.UserId;
}

PNPageObject internalPage;
Expand Down Expand Up @@ -220,7 +220,7 @@ private async Task<PNResult<PNMembershipsResult>> RemoveUuidMemberships(string u

if (string.IsNullOrEmpty(uuid))
{
uuid = config.Uuid;
uuid = config.UserId;
}

if (string.IsNullOrEmpty(config.SubscribeKey) || string.IsNullOrEmpty(config.SubscribeKey.Trim()) || config.SubscribeKey.Length <= 0)
Expand Down
Loading

0 comments on commit 17af03d

Please sign in to comment.