diff --git a/examples/scratch.ts b/examples/scratch.ts index f41c69e..51f1d24 100644 --- a/examples/scratch.ts +++ b/examples/scratch.ts @@ -5,8 +5,13 @@ import app from "./webserver"; import path from "path"; +import { promises as fs } from "fs"; import { PKPass } from "passkit-generator"; +const iconFromModel = await fs.readFile( + path.resolve(__dirname, "models/exampleBooking.pass/icon.png"), +); + app.all(async function manageRequest(request, response) { const passName = request.params.modelName + @@ -56,6 +61,16 @@ app.all(async function manageRequest(request, response) { }, ); + /** + * Required by Apple. If one is not available, a + * pass might be openable on a Mac but not on a + * specific iPhone model + */ + + pass.addBuffer("icon.png", iconFromModel); + pass.addBuffer("icon@2x.png", iconFromModel); + pass.addBuffer("icon@3x.png", iconFromModel); + const stream = pass.getAsStream(); response.set({