mirror of
https://github.com/marcogll/passkit-generator.git
synced 2026-03-15 19:25:23 +00:00
Moved preferredStyleSchemes schema and properties to root (fixed Apple WWDC video misinformation)
This commit is contained in:
@@ -216,6 +216,44 @@ export default class PKPass extends Bundle {
|
||||
return Utils.cloneRecursive(this[propsSymbol]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows accessing to iOS 18 new Event Ticket
|
||||
* property `preferredStyleSchemes`.
|
||||
*
|
||||
* @throws (automatically) if current type is not
|
||||
* "eventTicket".
|
||||
*/
|
||||
|
||||
public get preferredStyleSchemes(): Schemas.PreferredStyleSchemes {
|
||||
return this[propsSymbol].preferredStyleSchemes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows setting a preferredStyleSchemes property
|
||||
* for a eventTicket.
|
||||
*
|
||||
* @throws if current type is not "eventTicket".
|
||||
* @param value
|
||||
*/
|
||||
|
||||
public set preferredStyleSchemes(value: Schemas.PreferredStyleSchemes) {
|
||||
Utils.assertUnfrozen(this);
|
||||
|
||||
if (this.type !== "eventTicket") {
|
||||
throw new TypeError(
|
||||
Messages.PREFERRED_STYLE_SCHEMES.UNEXPECTED_PASS_TYPE,
|
||||
);
|
||||
}
|
||||
|
||||
Schemas.assertValidity(
|
||||
Schemas.PreferredStyleSchemes,
|
||||
value,
|
||||
Messages.PREFERRED_STYLE_SCHEMES.INVALID,
|
||||
);
|
||||
|
||||
this[propsSymbol].preferredStyleSchemes = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows setting a transitType property
|
||||
* for a boardingPass.
|
||||
@@ -316,44 +354,6 @@ export default class PKPass extends Bundle {
|
||||
return this[propsSymbol][this.type].backFields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows accessing to iOS 18 new Event Ticket
|
||||
* property `preferredStyleSchemes`.
|
||||
*
|
||||
* @throws (automatically) if current type is not
|
||||
* "eventTicket".
|
||||
*/
|
||||
|
||||
public get preferredStyleSchemes(): Schemas.PreferredStyleSchemes {
|
||||
return this[propsSymbol]["eventTicket"].preferredStyleSchemes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows setting a preferredStyleSchemes property
|
||||
* for a eventTicket.
|
||||
*
|
||||
* @throws if current type is not "eventTicket".
|
||||
* @param value
|
||||
*/
|
||||
|
||||
public set preferredStyleSchemes(value: Schemas.PreferredStyleSchemes) {
|
||||
Utils.assertUnfrozen(this);
|
||||
|
||||
if (this.type !== "eventTicket") {
|
||||
throw new TypeError(
|
||||
Messages.PREFERRED_STYLE_SCHEMES.UNEXPECTED_PASS_TYPE,
|
||||
);
|
||||
}
|
||||
|
||||
Schemas.assertValidity(
|
||||
Schemas.PreferredStyleSchemes,
|
||||
value,
|
||||
Messages.PREFERRED_STYLE_SCHEMES.INVALID,
|
||||
);
|
||||
|
||||
this[propsSymbol]["eventTicket"].preferredStyleSchemes = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows setting a pass type.
|
||||
*
|
||||
@@ -383,6 +383,7 @@ export default class PKPass extends Bundle {
|
||||
*/
|
||||
|
||||
this[propsSymbol][this.type] = undefined;
|
||||
this[propsSymbol].preferredStyleSchemes = undefined;
|
||||
}
|
||||
|
||||
const sharedKeysPool = new Set<string>();
|
||||
@@ -415,7 +416,6 @@ export default class PKPass extends Bundle {
|
||||
Schemas.Field,
|
||||
),
|
||||
transitType: undefined,
|
||||
preferredStyleSchemes: undefined,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -584,7 +584,6 @@ export default class PKPass extends Bundle {
|
||||
auxiliaryFields = [],
|
||||
backFields = [],
|
||||
transitType,
|
||||
preferredStyleSchemes = [],
|
||||
} = data[type] || {};
|
||||
|
||||
this.headerFields.push(...headerFields);
|
||||
@@ -596,10 +595,6 @@ export default class PKPass extends Bundle {
|
||||
if (this.type === "boardingPass") {
|
||||
this.transitType = transitType;
|
||||
}
|
||||
|
||||
if (this.type === "eventTicket") {
|
||||
this.preferredStyleSchemes = preferredStyleSchemes;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user