Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handles Default User-Agent Failure #2961

Merged
merged 3 commits into from
Feb 28, 2024
Merged

Conversation

antonis
Copy link

@antonis antonis commented Feb 27, 2024

Fixes Partially wordpress-mobile/WordPress-Android#20147 (comment)

WordPress-Android PR: wordpress-mobile/WordPress-Android#20296

Description

This PR converts the UserAgent class to Kotlin and handles the exception thrown when the default user agent cannot be retrieved preventing a runtime crash.
(internal ref: pcdRpT-5Us-p2)

Note: A similar implementation is employed in the WordPress app initialiser

To Test

To test the app behaviour in the exception case you can use this fallback.patch

@antonis antonis force-pushed the fix/defaultuseragent-kotlin branch from 0c39287 to 22bd254 Compare February 27, 2024 10:26
@antonis antonis force-pushed the fix/defaultuseragent-kotlin branch from 22bd254 to abf37d1 Compare February 27, 2024 10:36
Copy link
Contributor

@jarvislin jarvislin left a comment

Choose a reason for hiding this comment

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

The logic looks good, I only left comments related to Mockito and Robolectric but they are not blockers.

I have applied the patch, but I'm not sure the steps to reproduce the crash

@antonis
Copy link
Author

antonis commented Feb 28, 2024

Thank you for reviewing and your suggestions @jarvislin 🙇

I have applied the patch, but I'm not sure the steps to reproduce the crash

I wasn't able to reproduce the crash either but tested that the app would perform as expected when the fallback exception case is used similar to how it works in the WordPress app initialiser

@antonis antonis merged commit 8b93041 into trunk Feb 28, 2024
13 checks passed
@antonis antonis deleted the fix/defaultuseragent-kotlin branch February 28, 2024 08:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants