Updated relevancy schemas to match new iOS 18 changes

This commit is contained in:
Alexander Cerutti
2025-01-08 10:52:24 +01:00
parent 943b48c72e
commit 9d8ad48665

View File

@@ -30,23 +30,37 @@ export const PreferredStyleSchemes = Joi.array().items(
) satisfies Joi.Schema<PreferredStyleSchemes>;
/**
* For newly-introduced event tickets
* in iOS 18
* A single interval can span at most 24 hours
*/
interface RelevantDate {
interface RelevancyInterval {
startDate: string;
endDate: string;
}
interface RelevancyEntry {
relevantDate: string;
}
/**
* Minimum supported version: iOS 18
* Newly introduced in iOS 18.
* Using a RelevancyInterval, will trigger a live activity on
* new event ticket passes.
*
* Using a RelevancyEntry, will match the behavior of the
* currently deprecated property `relevantDate`.
*/
const RelevantDate = Joi.object<RelevantDate>().keys({
export type RelevantDate = RelevancyInterval | RelevancyEntry;
const RelevantDate = Joi.alternatives(
Joi.object<RelevancyInterval>().keys({
startDate: Joi.string().required(),
endDate: Joi.string().required(),
});
}),
Joi.object<RelevancyEntry>().keys({
relevantDate: Joi.string().required(),
}),
);
export interface FileBuffers {
[key: string]: Buffer;
@@ -80,6 +94,11 @@ export interface PassProps {
nfc?: NFC;
beacons?: Beacon[];
barcodes?: Barcode[];
/**
* @deprecated starting from iOS 18
* Use `relevantDates`
*/
relevantDate?: string;
relevantDates?: RelevantDate[];