Skip to content

Commit

Permalink
fix: os_name was not being set correctly for some devices using expo-…
Browse files Browse the repository at this point in the history
…device (#330)
  • Loading branch information
marandaneto authored Dec 17, 2024
1 parent 2baa794 commit 695e142
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
4 changes: 4 additions & 0 deletions posthog-react-native/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Next

# 3.6.1 - 2024-12-17

1. fix: os_name was not being set correctly for some devices using expo-device

# 3.6.0 - 2024-12-12

1. Add new debugging property `$feature_flag_bootstrapped_response`, `$feature_flag_bootstrapped_payload` and `$used_bootstrap_value` to `$feature_flag_called` event
Expand Down
2 changes: 1 addition & 1 deletion posthog-react-native/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "posthog-react-native",
"version": "3.6.0",
"version": "3.6.1",
"main": "lib/posthog-react-native/index.js",
"files": [
"lib/"
Expand Down
11 changes: 10 additions & 1 deletion posthog-react-native/src/native-deps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,16 @@ export const getAppProperties = (): PostHogCustomAppProperties => {
properties.$device_manufacturer = OptionalExpoDevice.manufacturer
// expo-device already maps the device model identifier to a human readable name
properties.$device_name = OptionalExpoDevice.modelName
properties.$os_name = OptionalExpoDevice.osName

// https://github.com/expo/expo/issues/6990
// some devices return a value similar to:
// HUAWEI/SNE-LX1/HWSNE:8.1.0/HUAWEISNE-LX1/131(C432):user/release-keys
if (Platform.OS === 'android') {
properties.$os_name = 'Android'
} else {
properties.$os_name = OptionalExpoDevice.osName
}

properties.$os_version = OptionalExpoDevice.osVersion
} else if (OptionalReactNativeDeviceInfo) {
properties.$device_manufacturer = returnPropertyIfNotUnknown(OptionalReactNativeDeviceInfo.getManufacturerSync())
Expand Down

0 comments on commit 695e142

Please sign in to comment.