Skip to content

Commit

Permalink
encode comma for multichannel push channels (#158)
Browse files Browse the repository at this point in the history
* encode comma for multichannel push channels
  • Loading branch information
budgetpreneur authored Nov 14, 2022
1 parent d3b3b8a commit 207530f
Show file tree
Hide file tree
Showing 9 changed files with 136 additions and 66 deletions.
19 changes: 12 additions & 7 deletions .pubnub.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
name: c-sharp
version: "6.11.0"
version: "6.12.0"
schema: 1
scm: github.com/pubnub/c-sharp
changelog:
- date: 2022-11-14
version: v6.12.0
changes:
- type: bug
text: "Encode comma char for push related multi channels."
- date: 2022-11-07
version: v6.11.0
changes:
Expand Down Expand Up @@ -687,7 +692,7 @@ features:
- QUERY-PARAM
supported-platforms:
-
version: Pubnub 'C#' 6.11.0
version: Pubnub 'C#' 6.12.0
platforms:
- Windows 10 and up
- Windows Server 2008 and up
Expand All @@ -697,7 +702,7 @@ supported-platforms:
- .Net Framework 4.5
- .Net Framework 4.6.1+
-
version: PubnubPCL 'C#' 6.11.0
version: PubnubPCL 'C#' 6.12.0
platforms:
- Xamarin.Android
- Xamarin.iOS
Expand All @@ -717,7 +722,7 @@ supported-platforms:
- .Net Core
- .Net 6.0
-
version: PubnubUWP 'C#' 6.11.0
version: PubnubUWP 'C#' 6.12.0
platforms:
- Windows Phone 10
- Universal Windows Apps
Expand All @@ -741,7 +746,7 @@ sdks:
distribution-type: source
distribution-repository: GitHub
package-name: Pubnub
location: https://github.com/pubnub/c-sharp/releases/tag/v6.11.0.0
location: https://github.com/pubnub/c-sharp/releases/tag/v6.12.0.0
requires:
-
name: ".Net"
Expand Down Expand Up @@ -1024,7 +1029,7 @@ sdks:
distribution-type: source
distribution-repository: GitHub
package-name: PubNubPCL
location: https://github.com/pubnub/c-sharp/releases/tag/v6.11.0.0
location: https://github.com/pubnub/c-sharp/releases/tag/v6.12.0.0
requires:
-
name: ".Net Core"
Expand Down Expand Up @@ -1383,7 +1388,7 @@ sdks:
distribution-type: source
distribution-repository: GitHub
package-name: PubnubUWP
location: https://github.com/pubnub/c-sharp/releases/tag/v6.11.0.0
location: https://github.com/pubnub/c-sharp/releases/tag/v6.12.0.0
requires:
-
name: "Universal Windows Platform Development"
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
v6.12.0 - November 14 2022
-----------------------------
- Fixed: encode comma char for push related multi channels.

v6.11.0 - November 07 2022
-----------------------------
- Modified: added Content-Type to request header to support internal acceptance tests.
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 @@ -1034,7 +1034,7 @@ Uri IUrlRequestBuilder.BuildRegisterDevicePushRequest(string requestMethod, stri
{
requestQueryStringParams.Add("type", pushType.ToString().ToLower());
}
requestQueryStringParams.Add("add", UriUtil.EncodeUriComponent(channel, currentType, true, false, false));
requestQueryStringParams.Add("add", UriUtil.EncodeUriComponent(channel, currentType, false, false, false));

if (externalQueryParam != null && externalQueryParam.Count > 0)
{
Expand Down Expand Up @@ -1139,7 +1139,7 @@ Uri IUrlRequestBuilder.BuildRemoveChannelPushRequest(string requestMethod, strin
{
requestQueryStringParams.Add("type", pushType.ToString().ToLower());
}
requestQueryStringParams.Add("remove", UriUtil.EncodeUriComponent(channel, currentType, true, false, false));
requestQueryStringParams.Add("remove", UriUtil.EncodeUriComponent(channel, currentType, false, false, false));

if (externalQueryParam != null && externalQueryParam.Count > 0)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Api/PubnubApi/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
[assembly: AssemblyProduct("Pubnub C# SDK")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyVersion("6.11.0.0")]
[assembly: AssemblyFileVersion("6.11.0.0")]
[assembly: AssemblyVersion("6.12.0.0")]
[assembly: AssemblyFileVersion("6.12.0.0")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
Expand Down
5 changes: 2 additions & 3 deletions src/Api/PubnubApi/PubnubApi.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,15 @@

<PropertyGroup>
<PackageId>Pubnub</PackageId>
<PackageVersion>6.11.0.0</PackageVersion>
<PackageVersion>6.12.0.0</PackageVersion>
<Title>PubNub C# .NET - Web Data Push API</Title>
<Authors>Pandu Masabathula</Authors>
<Owners>PubNub</Owners>
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
<PackageIconUrl>http://pubnub.s3.amazonaws.com/2011/powered-by-pubnub/pubnub-icon-600x600.png</PackageIconUrl>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<RepositoryUrl>https://github.com/pubnub/c-sharp/</RepositoryUrl>
<PackageReleaseNotes>Added Content-Type to request header to support internal acceptance tests.
Added acceptance tests for ObjectsV2 feature.</PackageReleaseNotes>
<PackageReleaseNotes>Encode comma char for push related multi channels.</PackageReleaseNotes>
<PackageTags>Web Data Push Real-time Notifications ESB Message Broadcasting Distributed Computing</PackageTags>
<!--<Summary>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</Summary>-->
<Description>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</Description>
Expand Down
5 changes: 2 additions & 3 deletions src/Api/PubnubApiPCL/PubnubApiPCL.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,15 @@

<PropertyGroup>
<PackageId>PubnubPCL</PackageId>
<PackageVersion>6.11.0.0</PackageVersion>
<PackageVersion>6.12.0.0</PackageVersion>
<Title>PubNub C# .NET - Web Data Push API</Title>
<Authors>Pandu Masabathula</Authors>
<Owners>PubNub</Owners>
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
<PackageIconUrl>http://pubnub.s3.amazonaws.com/2011/powered-by-pubnub/pubnub-icon-600x600.png</PackageIconUrl>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<RepositoryUrl>https://github.com/pubnub/c-sharp/</RepositoryUrl>
<PackageReleaseNotes>Added Content-Type to request header to support internal acceptance tests.
Added acceptance tests for ObjectsV2 feature.</PackageReleaseNotes>
<PackageReleaseNotes>Encode comma char for push related multi channels.</PackageReleaseNotes>
<PackageTags>Web Data Push Real-time Notifications ESB Message Broadcasting Distributed Computing</PackageTags>
<!--<Summary>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</Summary>-->
<Description>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</Description>
Expand Down
5 changes: 2 additions & 3 deletions src/Api/PubnubApiUWP/PubnubApiUWP.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,15 @@

<PropertyGroup>
<PackageId>PubnubUWP</PackageId>
<PackageVersion>6.11.0.0</PackageVersion>
<PackageVersion>6.12.0.0</PackageVersion>
<Title>PubNub C# .NET - Web Data Push API</Title>
<Authors>Pandu Masabathula</Authors>
<Owners>PubNub</Owners>
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
<PackageIconUrl>http://pubnub.s3.amazonaws.com/2011/powered-by-pubnub/pubnub-icon-600x600.png</PackageIconUrl>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<RepositoryUrl>https://github.com/pubnub/c-sharp/</RepositoryUrl>
<PackageReleaseNotes>Added Content-Type to request header to support internal acceptance tests.
Added acceptance tests for ObjectsV2 feature.</PackageReleaseNotes>
<PackageReleaseNotes>Encode comma char for push related multi channels.</PackageReleaseNotes>
<PackageTags>Web Data Push Real-time Notifications ESB Message Broadcasting Distributed Computing</PackageTags>
<!--<Summary>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</Summary>-->
<Description>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</Description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,22 +68,35 @@ public void ThenTheResponseContainsListWithAndMemberships(string membership1, st
personaList.Add(channelMembershipMetadata);
}
}
Assert.AreEqual(personaList[0].channel.id, getMembershipsMetadataResult.Memberships[0].ChannelMetadata.Channel);
Assert.AreEqual(personaList[1].channel.id, getMembershipsMetadataResult.Memberships[1].ChannelMetadata.Channel);
Assert.IsTrue(personaList.Count > 0, "ThenTheResponseContainsListWithAndMemberships failed due to expected data");
Assert.IsTrue(getMembershipsMetadataResult!= null && getMembershipsMetadataResult.Memberships != null, "ThenTheResponseContainsListWithAndMemberships failed due to actual data");
if (personaList.Count > 0 && getMembershipsMetadataResult != null && getMembershipsMetadataResult.Memberships != null)
{
Assert.AreEqual(personaList[0].channel.id, getMembershipsMetadataResult.Memberships[0].ChannelMetadata.Channel);
Assert.AreEqual(personaList[1].channel.id, getMembershipsMetadataResult.Memberships[1].ChannelMetadata.Channel);
}
}

[When(@"I get the memberships for current user")]
public async Task WhenIGetTheMembershipsForCurrentUser()
{
PNResult<PNMembershipsResult> getMembershipsResponse = await pn.GetMemberships()
var getMembershipsRequestBuilder = pn.GetMemberships();
if (uuidMetadataPersona != null && string.Compare(uuidMetadataPersona.id, pn.GetCurrentUserId().ToString(), true) != 0)
{
getMembershipsRequestBuilder = getMembershipsRequestBuilder.Uuid(uuidMetadataPersona.id);
}
PNResult<PNMembershipsResult> getMembershipsResponse = await getMembershipsRequestBuilder
.ExecuteAsync();
getMembershipsMetadataResult = getMembershipsResponse.Result;
pnStatus = getMembershipsResponse.Status;
if (pnStatus.Error)
{
pnError = pn.JsonPluggableLibrary.DeserializeToObject<PubnubError>(pnStatus.ErrorData.Information);
}

if (getMembershipsMetadataResult == null || getMembershipsMetadataResult.Memberships == null)
{
Assert.Fail($"WhenIGetTheMembershipsForCurrentUser failed for user = {pn.GetCurrentUserId()}");
}
}

[When(@"I get the memberships including custom and channel custom information")]
Expand Down Expand Up @@ -116,13 +129,25 @@ public void GivenTheDataForMembership(string whatMembership)
if (string.Compare(currentContract, "removeAliceMembership", true) == 0)
{
removeChannelMembershipMetadata = JsonSerializer.Deserialize<ChannelMembershipMetadataLocal>(json, new JsonSerializerOptions { });
if (removeChannelMembershipMetadata == null)
{
Assert.Fail($"GivenTheDataForMembership failed for {whatMembership}. Null value to remove.");
}
}
else
{
channelMembershipMetadata = JsonSerializer.Deserialize<ChannelMembershipMetadataLocal>(json, new JsonSerializerOptions { });
if (channelMembershipMetadata == null)
{
Assert.Fail($"GivenTheDataForMembership failed for {whatMembership}. Null value.");
}
}
}
}
else
{
Assert.Fail($"GivenTheDataForMembership failed for {whatMembership}. Not found.");
}
}

[When(@"I set the membership")]
Expand Down Expand Up @@ -162,8 +187,13 @@ public void ThenTheResponseContainsListWithMembership(string whatMembership)
membershipsList.Add(channelMembershipMetadata);
}
}
Assert.IsTrue(membershipsList.Count > 0, "ThenTheResponseContainsListWithMembership failed due to expected data");
Assert.IsTrue(setMembershipsResult != null && setMembershipsResult.Memberships != null, "ThenTheResponseContainsListWithMembership failed due to actual data");

Assert.AreEqual(membershipsList[0].channel.id, setMembershipsResult.Memberships[0].ChannelMetadata.Channel);
if (membershipsList.Count > 0 && setMembershipsResult != null && setMembershipsResult.Memberships != null)
{
Assert.AreEqual(membershipsList[0].channel.id, setMembershipsResult.Memberships[0].ChannelMetadata.Channel);
}
}

[When(@"I set the membership for current user")]
Expand All @@ -173,16 +203,25 @@ public async Task WhenISetTheMembershipForCurrentUser()
{
Channel = channelMembershipMetadata.channel.id
};
var setMembershipsRequestBuilder = pn.SetMemberships()
.Channels(new List<PNMembership>() { membership });
if (uuidMetadataPersona != null && string.Compare(uuidMetadataPersona.id, pn.GetCurrentUserId().ToString(), true) != 0)
{
setMembershipsRequestBuilder = setMembershipsRequestBuilder.Uuid(uuidMetadataPersona.id);
}

PNResult<PNMembershipsResult> setMembershipsResponse = await pn.SetMemberships()
.Channels(new List<PNMembership>() { membership })
PNResult<PNMembershipsResult> setMembershipsResponse = await setMembershipsRequestBuilder
.ExecuteAsync();
setMembershipsResult = setMembershipsResponse.Result;
pnStatus = setMembershipsResponse.Status;
if (pnStatus.Error)
{
pnError = pn.JsonPluggableLibrary.DeserializeToObject<PubnubError>(pnStatus.ErrorData.Information);
}
if (setMembershipsResult == null || setMembershipsResult.Memberships == null)
{
Assert.Fail($"WhenISetTheMembershipForCurrentUser failed for current user {pn.GetCurrentUserId()}");
}
}

[When(@"I remove the membership")]
Expand Down
Loading

0 comments on commit 207530f

Please sign in to comment.