mirror of
https://github.com/marcogll/passkit-generator.git
synced 2026-03-15 16:25:21 +00:00
Updated preferredStyleSchemes setter and getter checks and messages
This commit is contained in:
@@ -217,14 +217,14 @@ export default class PKPass extends Bundle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allows accessing to iOS 18 new Event Ticket
|
* Allows accessing to iOS 18 new property
|
||||||
* property `preferredStyleSchemes`.
|
* `preferredStyleSchemes`.
|
||||||
*
|
*
|
||||||
* @throws if current type is not "eventTicket".
|
* @throws if current type is not "eventTicket" and is not "boardingPass".
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public get preferredStyleSchemes(): Schemas.PreferredStyleSchemes {
|
public get preferredStyleSchemes(): Schemas.PreferredStyleSchemes {
|
||||||
if (this.type !== "eventTicket") {
|
if (this.type !== "eventTicket" && this.type !== "boardingPass") {
|
||||||
throw new TypeError(
|
throw new TypeError(
|
||||||
Messages.PREFERRED_STYLE_SCHEMES.UNEXPECTED_PASS_TYPE_GET,
|
Messages.PREFERRED_STYLE_SCHEMES.UNEXPECTED_PASS_TYPE_GET,
|
||||||
);
|
);
|
||||||
@@ -235,7 +235,9 @@ export default class PKPass extends Bundle {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Allows setting a preferredStyleSchemes property
|
* Allows setting a preferredStyleSchemes property
|
||||||
* for a eventTicket.
|
* for a eventTicket. Use this to select
|
||||||
|
* either the Poster Event Tickets (iOS 18+) or the Semantic
|
||||||
|
* Boarding passes (iOS 26+).
|
||||||
*
|
*
|
||||||
* @throws if current type is not "eventTicket".
|
* @throws if current type is not "eventTicket".
|
||||||
* @param value
|
* @param value
|
||||||
@@ -244,7 +246,7 @@ export default class PKPass extends Bundle {
|
|||||||
public set preferredStyleSchemes(value: Schemas.PreferredStyleSchemes) {
|
public set preferredStyleSchemes(value: Schemas.PreferredStyleSchemes) {
|
||||||
Utils.assertUnfrozen(this);
|
Utils.assertUnfrozen(this);
|
||||||
|
|
||||||
if (this.type !== "eventTicket") {
|
if (this.type !== "eventTicket" && this.type !== "boardingPass") {
|
||||||
throw new TypeError(
|
throw new TypeError(
|
||||||
Messages.PREFERRED_STYLE_SCHEMES.UNEXPECTED_PASS_TYPE_SET,
|
Messages.PREFERRED_STYLE_SCHEMES.UNEXPECTED_PASS_TYPE_SET,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -17,9 +17,9 @@ export const TRANSIT_TYPE = {
|
|||||||
|
|
||||||
export const PREFERRED_STYLE_SCHEMES = {
|
export const PREFERRED_STYLE_SCHEMES = {
|
||||||
UNEXPECTED_PASS_TYPE_SET:
|
UNEXPECTED_PASS_TYPE_SET:
|
||||||
"Cannot set preferredStyleSchemes on a pass with type different from eventTicket.",
|
"Cannot set preferredStyleSchemes on a pass with type different from eventTicket or boardingPass.",
|
||||||
UNEXPECTED_PASS_TYPE_GET:
|
UNEXPECTED_PASS_TYPE_GET:
|
||||||
"Cannot get preferredStyleSchemes on a pass with type different from eventTicket.",
|
"Cannot get preferredStyleSchemes on a pass with type different from eventTicket or boardingPass.",
|
||||||
INVALID:
|
INVALID:
|
||||||
"Cannot set preferredStyleSchemes because not compliant with Apple specifications - %s",
|
"Cannot set preferredStyleSchemes because not compliant with Apple specifications - %s",
|
||||||
} as const;
|
} as const;
|
||||||
|
|||||||
Reference in New Issue
Block a user