diff --git a/PassKitHelper.Demo/Program.cs b/PassKitHelper.Demo/Program.cs
index ca06159..01bc59c 100644
--- a/PassKitHelper.Demo/Program.cs
+++ b/PassKitHelper.Demo/Program.cs
@@ -64,9 +64,11 @@ public static async Task GenerateSamplePass(IPassKitHelper passKitHelper)
var package = await passKitHelper.CreateNewPassPackage(pass)
.Icon(await File.ReadAllBytesAsync("images/icon.png"))
.Icon2X(await File.ReadAllBytesAsync("images/icon@2x.png"))
+ .Icon3X(await File.ReadAllBytesAsync("images/icon@3x.png"))
.Logo(await File.ReadAllBytesAsync("images/logo.jpg"))
.Strip(await File.ReadAllBytesAsync("images/strip.jpg"))
.Strip2X(await File.ReadAllBytesAsync("images/strip@2x.jpg"))
+ .Strip3X(await File.ReadAllBytesAsync("images/strip@3x.jpg"))
.SignAndBuildAsync();
await File.WriteAllBytesAsync("Sample.pkpass", package.ToArray());
diff --git a/PassKitHelper/Extensions/PassPackageBuilderExtensions.cs b/PassKitHelper/Extensions/PassPackageBuilderExtensions.cs
index 67c3cdc..d945eaf 100644
--- a/PassKitHelper/Extensions/PassPackageBuilderExtensions.cs
+++ b/PassKitHelper/Extensions/PassPackageBuilderExtensions.cs
@@ -51,6 +51,24 @@ public static PassPackageBuilder Background2X(this PassPackageBuilder builder, S
return builder;
}
+ ///
+ /// 3X-version of Background.
+ ///
+ public static PassPackageBuilder Background3X(this PassPackageBuilder builder, byte[] content)
+ {
+ builder.AddFile(GetFileName(GetCaller()), content);
+ return builder;
+ }
+
+ ///
+ /// 3X-version of Background.
+ ///
+ public static PassPackageBuilder Background3X(this PassPackageBuilder builder, Stream content)
+ {
+ builder.AddFile(GetFileName(GetCaller()), content);
+ return builder;
+ }
+
///
/// The image displayed on the front of the pass near the barcode.
///
@@ -87,6 +105,24 @@ public static PassPackageBuilder Footer2X(this PassPackageBuilder builder, Strea
return builder;
}
+ ///
+ /// 3X-version of Footer.
+ ///
+ public static PassPackageBuilder Footer3X(this PassPackageBuilder builder, byte[] content)
+ {
+ builder.AddFile(GetFileName(GetCaller()), content);
+ return builder;
+ }
+
+ ///
+ /// 3X-version of Footer.
+ ///
+ public static PassPackageBuilder Footer3X(this PassPackageBuilder builder, Stream content)
+ {
+ builder.AddFile(GetFileName(GetCaller()), content);
+ return builder;
+ }
+
///
/// The pass’s icon. This is displayed in notifications and in emails that have a pass attached, and on the lock screen.
///
@@ -129,6 +165,24 @@ public static PassPackageBuilder Icon2X(this PassPackageBuilder builder, Stream
return builder;
}
+ ///
+ /// 3X-version of Icon.
+ ///
+ public static PassPackageBuilder Icon3X(this PassPackageBuilder builder, byte[] content)
+ {
+ builder.AddFile(GetFileName(GetCaller()), content);
+ return builder;
+ }
+
+ ///
+ /// 3X-version of Icon.
+ ///
+ public static PassPackageBuilder Icon3X(this PassPackageBuilder builder, Stream content)
+ {
+ builder.AddFile(GetFileName(GetCaller()), content);
+ return builder;
+ }
+
///
/// The image displayed on the front of the pass in the top left.
///
@@ -165,6 +219,24 @@ public static PassPackageBuilder Logo2X(this PassPackageBuilder builder, Stream
return builder;
}
+ ///
+ /// 3X-version of Logo.
+ ///
+ public static PassPackageBuilder Logo3X(this PassPackageBuilder builder, byte[] content)
+ {
+ builder.AddFile(GetFileName(GetCaller()), content);
+ return builder;
+ }
+
+ ///
+ /// 3X-version of Logo.
+ ///
+ public static PassPackageBuilder Logo3X(this PassPackageBuilder builder, Stream content)
+ {
+ builder.AddFile(GetFileName(GetCaller()), content);
+ return builder;
+ }
+
///
/// The image displayed behind the primary fields on the front of the pass.
///
@@ -201,6 +273,24 @@ public static PassPackageBuilder Strip2X(this PassPackageBuilder builder, Stream
return builder;
}
+ ///
+ /// 3X-version of Strip.
+ ///
+ public static PassPackageBuilder Strip3X(this PassPackageBuilder builder, byte[] content)
+ {
+ builder.AddFile(GetFileName(GetCaller()), content);
+ return builder;
+ }
+
+ ///
+ /// 3X-version of Strip.
+ ///
+ public static PassPackageBuilder Strip3X(this PassPackageBuilder builder, Stream content)
+ {
+ builder.AddFile(GetFileName(GetCaller()), content);
+ return builder;
+ }
+
///
/// An additional image displayed on the front of the pass. For example, on a membership card, the thumbnail could be used to a picture of the cardholder.
///
@@ -237,6 +327,24 @@ public static PassPackageBuilder Thumbnail2X(this PassPackageBuilder builder, St
return builder;
}
+ ///
+ /// 3X-version of Thumbnail.
+ ///
+ public static PassPackageBuilder Thumbnail3X(this PassPackageBuilder builder, byte[] content)
+ {
+ builder.AddFile(GetFileName(GetCaller()), content);
+ return builder;
+ }
+
+ ///
+ /// 3X-version of Thumbnail.
+ ///
+ public static PassPackageBuilder Thumbnail3X(this PassPackageBuilder builder, Stream content)
+ {
+ builder.AddFile(GetFileName(GetCaller()), content);
+ return builder;
+ }
+
private static string GetCaller([CallerMemberName] string caller = "unknown")
{
return caller;
@@ -249,6 +357,11 @@ private static string GetFileName(string name)
return name.Replace("2X", "@2X").ToLowerInvariant() + ".png";
}
+ if (name.EndsWith("3X"))
+ {
+ return name.Replace("3X", "@3X").ToLowerInvariant() + ".png";
+ }
+
return name.ToLowerInvariant() + ".png";
}
}
diff --git a/README.md b/README.md
index eb4663f..ab25aed 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@ Helper library for all your Apple PassKit (Apple Wallet, Apple Passbook) needs:
**Attention:** Apple Developer Account required!
-[![NuGet](https://img.shields.io/nuget/v/PassKitHelper.svg?maxAge=86400&style=flat)](https://www.nuget.org/packages/PassKitHelper/)
+[![NuGet](https://img.shields.io/nuget/v/PassKitHelper.svg?maxAge=86400&style=flat)](https://www.nuget.org/packages/PassKitHelper/)
## Features
@@ -88,9 +88,11 @@ var pass = passKitHelper.CreateNewPass()
var passPackage = passKitHelper.CreateNewPassPackage(pass)
.Icon(await File.ReadAllBytesAsync("images/icon.png"))
.Icon2X(await File.ReadAllBytesAsync("images/icon@2x.png"))
+ .Icon3X(await File.ReadAllBytesAsync("images/icon@3x.png"))
.Logo(await File.ReadAllBytesAsync("images/logo.jpg"))
.Strip(await File.ReadAllBytesAsync("images/strip.jpg"))
- .Strip2X(await File.ReadAllBytesAsync("images/strip@2x.jpg"));
+ .Strip2X(await File.ReadAllBytesAsync("images/strip@2x.jpg"))
+ .Strip3X(await File.ReadAllBytesAsync("images/strip@3x.jpg"));
MemoryStream packageFile = await passPackage.SignAndBuildAsync();
@@ -168,7 +170,6 @@ WebServiceURL is hostname of your server and path that equal to one in `UsePassK
When users install your pass packge to their iOS and Mac devices - Apple server call your `RegisterDeviceAsync`. Save `pushToken` value in database, and when you need to update pass on user device - call `IPassKitHelper.SendPushNotificationAsync(pushToken)`.
-
## Installation
Use NuGet package [PassKitHelper](https://www.nuget.org/packages/PassKitHelper/)
@@ -176,11 +177,13 @@ Use NuGet package [PassKitHelper](https://www.nuget.org/packages/PassKitHelper/)
## Dependencies
For `netcoreapp3.1`:
+
* Microsoft.Extensions.Http, v3.1.1
* Newtonsoft.Json, v12.0.2
* System.Security.Cryptography.Pkcs, v4.6.0
For `netstandard2.0`:
+
* Microsoft.AspNetCore.Http.Abstractions, v2.1.1
* Microsoft.Extensions.DependencyInjection.Abstractions, v2.1.1
* Microsoft.Extensions.Logging.Abstractions, v2.1.1
@@ -197,4 +200,4 @@ Tests can be run with `dotnet test`.
## Credits
* Thanks for inspiration to Tomas McGuinness and his [dotnet-passbook](https://github.com/tomasmcguinness/dotnet-passbook) package.
-* Thanks to [maxpixel.net](https://www.maxpixel.net) for sample kitten images.
\ No newline at end of file
+* Thanks to [maxpixel.net](https://www.maxpixel.net) for sample kitten images.