mirror of
https://github.com/marcogll/passkit-generator.git
synced 2026-03-15 14:25:17 +00:00
Added support to a new field additionalInfoFields
This commit is contained in:
@@ -20,6 +20,38 @@
|
|||||||
],
|
],
|
||||||
"primaryFields": [
|
"primaryFields": [
|
||||||
{ "key": "event_name", "label": "event-name", "value": "Dune" }
|
{ "key": "event_name", "label": "event-name", "value": "Dune" }
|
||||||
|
],
|
||||||
|
"additionalInfoFields": [
|
||||||
|
{
|
||||||
|
"key": "additionalInfo-1",
|
||||||
|
"label": "Additional Info 1",
|
||||||
|
"value": "The text to show"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "additionalInfo-1",
|
||||||
|
"label": "Additional Info 2",
|
||||||
|
"value": "The text to show 2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "lineItem3",
|
||||||
|
"label": "Emergency Contact",
|
||||||
|
"value": "+1 8716 12736131",
|
||||||
|
"dataDetectorTypes": [
|
||||||
|
"PKDataDetectorTypePhoneNumber",
|
||||||
|
"used only on Watch"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "lineItem4",
|
||||||
|
"label": "Test link",
|
||||||
|
"value": "https://apple.com",
|
||||||
|
"dataDetectorTypes": [
|
||||||
|
"PKDataDetectorTypeLink",
|
||||||
|
"used only on Watch"
|
||||||
|
],
|
||||||
|
"textAlignment": "<unused in these fields>",
|
||||||
|
"attributedValue": "<a href=\"https://apple.com\">Used literally on iPhone, used correctly on Watch</a>"
|
||||||
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"semantics": {
|
"semantics": {
|
||||||
|
|||||||
@@ -359,6 +359,18 @@ export default class PKPass extends Bundle {
|
|||||||
return this[propsSymbol][this.type].backFields;
|
return this[propsSymbol][this.type].backFields;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allows accessing to backFields object
|
||||||
|
*
|
||||||
|
* @throws (automatically) if no valid pass.json
|
||||||
|
* has been parsed yet or, anyway, if current
|
||||||
|
* type is not "eventTicket".
|
||||||
|
*/
|
||||||
|
|
||||||
|
public get additionalInfoFields(): Schemas.Field[] {
|
||||||
|
return this[propsSymbol]["eventTicket"].additionalInfoFields;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allows setting a pass type.
|
* Allows setting a pass type.
|
||||||
*
|
*
|
||||||
@@ -420,6 +432,11 @@ export default class PKPass extends Bundle {
|
|||||||
sharedKeysPool,
|
sharedKeysPool,
|
||||||
Schemas.Field,
|
Schemas.Field,
|
||||||
),
|
),
|
||||||
|
additionalInfoFields: new FieldsArray(
|
||||||
|
this,
|
||||||
|
sharedKeysPool,
|
||||||
|
Schemas.Field,
|
||||||
|
),
|
||||||
transitType: undefined,
|
transitType: undefined,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -589,6 +606,7 @@ export default class PKPass extends Bundle {
|
|||||||
auxiliaryFields = [],
|
auxiliaryFields = [],
|
||||||
backFields = [],
|
backFields = [],
|
||||||
transitType,
|
transitType,
|
||||||
|
additionalInfoFields = [],
|
||||||
} = data[type] || {};
|
} = data[type] || {};
|
||||||
|
|
||||||
this.headerFields.push(...headerFields);
|
this.headerFields.push(...headerFields);
|
||||||
@@ -596,6 +614,7 @@ export default class PKPass extends Bundle {
|
|||||||
this.secondaryFields.push(...secondaryFields);
|
this.secondaryFields.push(...secondaryFields);
|
||||||
this.auxiliaryFields.push(...auxiliaryFields);
|
this.auxiliaryFields.push(...auxiliaryFields);
|
||||||
this.backFields.push(...backFields);
|
this.backFields.push(...backFields);
|
||||||
|
this.additionalInfoFields.push(...additionalInfoFields);
|
||||||
|
|
||||||
if (this.type === "boardingPass") {
|
if (this.type === "boardingPass") {
|
||||||
this.transitType = transitType;
|
this.transitType = transitType;
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ export interface PassFields {
|
|||||||
primaryFields: Field[];
|
primaryFields: Field[];
|
||||||
secondaryFields: Field[];
|
secondaryFields: Field[];
|
||||||
transitType?: TransitType;
|
transitType?: TransitType;
|
||||||
|
additionalInfoFields?: Field[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export const PassFields = Joi.object<PassFields>().keys({
|
export const PassFields = Joi.object<PassFields>().keys({
|
||||||
@@ -28,4 +29,5 @@ export const PassFields = Joi.object<PassFields>().keys({
|
|||||||
primaryFields: Joi.array().items(Field),
|
primaryFields: Joi.array().items(Field),
|
||||||
secondaryFields: Joi.array().items(Field),
|
secondaryFields: Joi.array().items(Field),
|
||||||
transitType: TransitType,
|
transitType: TransitType,
|
||||||
|
additionalInfoFields: Joi.array().items(Field),
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user