Skip to content

Commit ed3dab7

Browse files
committed
allow specifying payload serialization options
1 parent 9437486 commit ed3dab7

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
using Newtonsoft.Json;
2+
3+
namespace dotAPNS;
4+
5+
public static class ApnsClientCustomPayloadSerializationOptions
6+
{
7+
public static JsonSerializerSettings Value { get; set; } = new()
8+
{
9+
NullValueHandling = NullValueHandling.Ignore
10+
};
11+
}

dotAPNS/JsonContent.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ public class JsonContent : StringContent
88
{
99
const string JsonMediaType = "application/json";
1010

11-
public JsonContent(object obj) : this(obj is string str ? str : JsonConvert.SerializeObject(obj, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }))
11+
public JsonContent(object obj) : this(obj is string str ? str : JsonConvert.SerializeObject(obj, ApnsClientCustomPayloadSerializationOptions.Value ))
1212
{
1313

1414
}

dotAPNS/dotAPNS.csproj

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@
44
<TargetFrameworks>net46;netstandard2.0;netstandard2.1</TargetFrameworks>
55
<Authors>alexalok</Authors>
66
<Description>dotAPNS is a library used to send push notifications to Apple devices using Apple Push Notification service.</Description>
7-
<Version>4.5.0</Version>
8-
<Copyright>© alexalok 2019-2024</Copyright>
7+
<Version>4.6.0</Version>
8+
<Copyright>© alexalok 2019-2025</Copyright>
99
<PackageReleaseNotes>
10-
* Minor perf improvements (#131)
11-
* Allow getting APNs certificate information externally (#131)
10+
* allow specifying payload serialization options
1211
</PackageReleaseNotes>
1312
<PackageProjectUrl>https://github.com/alexalok/dotAPNS</PackageProjectUrl>
1413
<RepositoryUrl>https://github.com/alexalok/dotAPNS</RepositoryUrl>

0 commit comments

Comments
 (0)