Auto-detect BCBP codes from boarding passes#516
Auto-detect BCBP codes from boarding passes#516nielstron wants to merge 9 commits intoSeineEloquenz:mainfrom
Conversation
|
Currently this allows further configuration for boarding passes, but I am not sure this is needed/useful |
|
I would say we don't need that.
I think this way we can keep all the complexity of dealing with bcbp out of the actual pass creator and keep the code easy to extend should we ever get something else alike bcbp in the future |
|
Ok now the flow is
|
| val parsedBcbpFields = bcbp?.let { | ||
| Triple( | ||
| listOfNotNull( | ||
| plainField("from", "From", it.fromAirport), | ||
| plainField("to", "To", it.toAirport), | ||
| ), | ||
| listOfNotNull( | ||
| plainField("flight", "Flight", it.flightCode()), | ||
| plainField("date", "Date", it.flightDate?.format(DateTimeFormatter.ISO_LOCAL_DATE).orEmpty()), | ||
| plainField("class", "Class", it.travelClass), | ||
| ), | ||
| listOfNotNull( | ||
| plainField("passenger", "Passenger", it.passengerName), | ||
| plainField("seat", "Seat", it.seat), | ||
| ), | ||
| ) | ||
| } | ||
|
|
||
| val primaryFields = parsedBcbpFields?.first.orEmpty().ifEmpty { listOf(nameField) } | ||
| val secondaryFields = parsedBcbpFields?.second.orEmpty() | ||
| val auxiliaryFields = parsedBcbpFields?.third.orEmpty() |
There was a problem hiding this comment.
TBH, that's an odd code style (putting values to a Triple and then destructuralizing into separate entities) — it's prone to errors. Let's just assign those directly.
Feedback for position:
- For flight tickets, the seat/group/gate are usually part of
headerFields - Passenger name and class is part of
secondaryFields - Flight code, terminal, date are usually part of
auxiliaryFields
There was a problem hiding this comment.
I know that are no strict rules, but that's usually how they put this data. @SeineEloquenz, what do you say about my proposal?
There was a problem hiding this comment.
I haven't yet looked in detail at the new code, but yes, the flight tickets I have on hand follow the convention you mentioned
There was a problem hiding this comment.
I switched to just storing it as a date field. The rendering in the wallet view then matches the device language and generally matches the described format by @soshial
| <string name="expand">Expand</string> | ||
| <string name="airline_code_detected">Airline code detected</string> | ||
| <string name="bcbp_create_question">Create boarding pass?</string> | ||
| <string name="create_boarding_pass">Boarding pass</string> |
There was a problem hiding this comment.
There is already a string for "Boarding pass", maybe you mean "Create boarding pass"?
Re-based version of #502 using the new creation flow of #511