Skip to content

Auto-detect BCBP codes from boarding passes#516

Open
nielstron wants to merge 9 commits intoSeineEloquenz:mainfrom
nielstron:feat/bcbp-scan-choice-main
Open

Auto-detect BCBP codes from boarding passes#516
nielstron wants to merge 9 commits intoSeineEloquenz:mainfrom
nielstron:feat/bcbp-scan-choice-main

Conversation

@nielstron
Copy link
Contributor

@nielstron nielstron commented Feb 26, 2026

Re-based version of #502 using the new creation flow of #511

08-bcbp-modalScreenshot_1772134657

@nielstron
Copy link
Contributor Author

Currently this allows further configuration for boarding passes, but I am not sure this is needed/useful

@SeineEloquenz
Copy link
Owner

I would say we don't need that.
My imagined userflow was:

  • User scans code
  • Modal pops up that a boarding pass was detected
  • User either:
    • Presses create boarding pass -> A pass is directly created
    • Edit/Manually create/whatever -> the pass creator opens

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

@nielstron
Copy link
Contributor Author

Ok now the flow is

  • when BCBP detected -> Modal do you want to create a boarding pass?
    • yes --> directly creates pass
    • no --> continue to normal pass create view
      Screenshots updated

Comment on lines 90 to 110
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()
Copy link

@soshial soshial Feb 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know that are no strict rules, but that's usually how they put this data. @SeineEloquenz, what do you say about my proposal?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Contributor Author

@nielstron nielstron Feb 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is already a string for "Boarding pass", maybe you mean "Create boarding pass"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants