mirror of
https://github.com/marcogll/passkit-generator.git
synced 2026-03-15 23:25:26 +00:00
Added implementation of setLocations along with tests
This commit is contained in:
@@ -318,15 +318,33 @@ export default class PKPass extends Bundle {
|
||||
* Allows setting some locations the OS should
|
||||
* react to and show this pass.
|
||||
*
|
||||
* Pass `null` to remove them at all.
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* PKPassInstance.setLocations(null)
|
||||
* PKPassInstance.setLocations({
|
||||
* latitude: 0.5333245342
|
||||
* longitude: 0.2135332252
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* @param locations
|
||||
* @returns
|
||||
*/
|
||||
|
||||
setLocations(...locations: Schemas.Location[]): this {
|
||||
/**
|
||||
* @TODO implement
|
||||
* @TODO specify a way to get current ones deleted
|
||||
*/
|
||||
setLocations(locations: null): this;
|
||||
setLocations(...locations: Schemas.Location[]): this;
|
||||
setLocations(...locations: (Schemas.Location | null)[]): this {
|
||||
if (locations[0] === null) {
|
||||
delete this[propsSymbol]["locations"];
|
||||
return;
|
||||
}
|
||||
|
||||
this[propsSymbol]["locations"] = Schemas.filterValid(
|
||||
locations,
|
||||
Schemas.Location,
|
||||
);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user