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

getUserAgentSync: fix memoKey #1506

Merged
merged 1 commit into from
Feb 15, 2023

Conversation

kesha-antonov
Copy link
Contributor

@kesha-antonov kesha-antonov commented Feb 14, 2023

Description

Fixes getUserAgent returning unknown when used with the getUserAgentSync

For example,

  let userAgent = '' + Platform.select({
    android: DeviceInfo.getUserAgentSync(), // sync not supported by iOS - supportedPlatforms: ['android', 'web']
    default: await DeviceInfo.getUserAgent(),
  })

On ios it will return unknown

The reason:

getUserAgent and getUserAgent have same memoKey

https://github.com/react-native-device-info/react-native-device-info/blob/master/src/index.ts#L228
https://github.com/react-native-device-info/react-native-device-info/blob/master/src/index.ts#L236

Compatibility

OS Implemented
iOS
Android
Windows

Checklist

  • I have tested this on a device/simulator for each compatible OS
  • I added the documentation in README.md
  • I updated the typings files (privateTypes.ts, types.ts)
  • I added a sample use of the API (example/App.js)

Copy link
Collaborator

@mikehardy mikehardy left a comment

Choose a reason for hiding this comment

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

interesting! This API (getUserAgent) is a corner case in so many ways, the change here seems like it is in tune with how it works though, thank you

@mikehardy mikehardy merged commit 4bda3ba into react-native-device-info:master Feb 15, 2023
rndi-bot pushed a commit that referenced this pull request Feb 15, 2023
## [10.3.1](v10.3.0...v10.3.1) (2023-02-15)

### Bug Fixes

* **ios:** getUserAgentSync: separate memoKeys for sync / non-sync usage ([#1506](#1506)) ([4bda3ba](4bda3ba))
@rndi-bot
Copy link
Collaborator

🎉 This PR is included in version 10.3.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

wdavis122 added a commit to wdavis122/react-native-device-info that referenced this pull request Jun 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants