Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@seadowg
Copy link
Member

@seadowg seadowg commented Sep 17, 2025

This should prevent a crash we've seen on Crashlytics.

Why is this the best possible solution? Were any other approaches considered?

The original code would end up calling handleScannerResult twice: once when the action is clicked and once when the snackbar is dismissed. This didn't cause any obvious problems, but ran the risk of a requireActivity call after the first call's finish had already happened. I've now made it so that handleScannerResult is only called once, and hopefully made our API around snackbars clearer to avoid a similar mistake in future.

How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?

It's probably impossible to reliably reproduce the crash. So just testing normal barcode scanning is enough here.

Before submitting this PR, please make sure you have:

  • added or modified tests for any new or changed behavior
  • run ./gradlew connectedAndroidTest (or ./gradlew testLab) and confirmed all checks still pass
  • added a comment above any new strings describing it for translators
  • added any new strings with date formatting to DateFormatsTest
  • verified that any code or assets from external sources are properly credited in comments and/or in the about file.
  • verified that any new UI elements use theme colors. UI Components Style guidelines

@seadowg seadowg marked this pull request as ready for review September 17, 2025 09:32
@seadowg seadowg marked this pull request as draft September 17, 2025 09:32
@seadowg seadowg marked this pull request as ready for review September 17, 2025 09:43
@seadowg seadowg changed the base branch from master to v2025.3.x September 17, 2025 10:42
@seadowg seadowg added the high priority Should be looked at before other PRs/issues label Sep 17, 2025
@seadowg seadowg merged commit df953c6 into getodk:v2025.3.x Sep 17, 2025
6 checks passed
@seadowg seadowg deleted the barcode-dismiss branch September 17, 2025 10:44
@dbemke
Copy link

dbemke commented Sep 18, 2025

Tested with Success!

Verified on Android 10

Verified cases:

  • regression checks in adding a project, barcode widget and reconfiguring a project

@WKobus
Copy link

WKobus commented Sep 18, 2025

Tested with Success!

Verified on Android 16

grzesiek2010 pushed a commit to grzesiek2010/collect that referenced this pull request Sep 29, 2025
@grzesiek2010
Copy link
Member

The issue still exists in v2025.3.1, so the fix doesn't work.

@grzesiek2010
Copy link
Member

I was able to reproduce it and here is another pull request: #6911

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

Labels

behavior verified high priority Should be looked at before other PRs/issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants