-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add location and dates to pass output
- Loading branch information
Showing
7 changed files
with
88 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import Hummingbird | ||
|
||
extension Pass { | ||
struct Barcode: ResponseEncodable { | ||
let format: String | ||
let message: String | ||
let messageEncoding = "utf-8" | ||
|
||
init(_ request: PassRequest.Barcode) { | ||
switch request { | ||
case .qr(let message): | ||
self.format = "PKBarcodeFormatQR" | ||
self.message = message | ||
case .code128(let message): | ||
self.format = "PKBarcodeFormatCode128" | ||
self.message = message | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import Hummingbird | ||
|
||
extension Pass { | ||
struct Location: ResponseEncodable { | ||
let latitude: Double | ||
let longitude: Double | ||
let relevantText: String? | ||
|
||
init(requestLocation: PassRequest.Location) { | ||
self.latitude = requestLocation.latitude | ||
self.longitude = requestLocation.longitude | ||
self.relevantText = requestLocation.name | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import Hummingbird | ||
|
||
extension Pass { | ||
struct StoreCard: ResponseEncodable {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import Foundation | ||
|
||
struct PassRequest: Decodable { | ||
let title: String | ||
let barcode: PassRequest.Barcode | ||
let locations: [PassRequest.Location] | ||
let dates: [String] | ||
} | ||
|
||
enum PassRequestDecodeError: Error { | ||
case unknownFormat(String) | ||
} | ||
|
||
/* Barc Supports | ||
* EAN-13 | ||
* UPC-A | ||
* Code 39 | ||
* Codabar | ||
*/ | ||
|
||
/* Both Support | ||
* QR | ||
* Code 128 | ||
*/ | ||
|
||
/* Apple Wallet Supports | ||
* Aztec | ||
* PDF417 | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
extension PassRequest { | ||
struct Location: Decodable { | ||
let latitude: Double | ||
let longitude: Double | ||
let name: String? | ||
} | ||
} |