expo-device 4.3.0 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -10,6 +10,20 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 5.0.0 — 2022-10-25
14
+
15
+ ### 🛠 Breaking changes
16
+
17
+ - Bumped iOS deployment target to 13.0 and deprecated support for iOS 12. ([#18873](https://github.com/expo/expo/pull/18873) by [@tsapeta](https://github.com/tsapeta))
18
+
19
+ ### 🐛 Bug fixes
20
+
21
+ - Fixed `<bluetooth_name> is only readable to apps with targetSdkVersion lower than or equal to: 31` error when the `targetSdkVersion` is set to 33. ([#19666](https://github.com/expo/expo/pull/19666) by [@kudo](https://github.com/kudo), [@kudo](https://github.com/kudo))
22
+
23
+ ### 💡 Others
24
+
25
+ - Refactored inline emulator checks to use enhanced checking in `EmulatorUtilities.isRunningOnEmulator() `. ([#16177](https://github.com/expo/expo/pull/16177)) by [@kbrandwijk](https://github.com/kbrandwijk), [@keith-kurak](https://github.com/keith-kurak))
26
+
13
27
  ## 4.3.0 — 2022-07-07
14
28
 
15
29
  _This version does not introduce any user-facing changes._
@@ -3,7 +3,7 @@ apply plugin: 'kotlin-android'
3
3
  apply plugin: 'maven-publish'
4
4
 
5
5
  group = 'host.exp.exponent'
6
- version = '4.3.0'
6
+ version = '5.0.0'
7
7
 
8
8
  buildscript {
9
9
  def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
@@ -74,7 +74,7 @@ android {
74
74
  minSdkVersion safeExtGet("minSdkVersion", 21)
75
75
  targetSdkVersion safeExtGet("targetSdkVersion", 31)
76
76
  versionCode 12
77
- versionName '4.3.0'
77
+ versionName '5.0.0'
78
78
  }
79
79
  lintOptions {
80
80
  abortOnError false
@@ -3,6 +3,7 @@ package expo.modules.device
3
3
  import expo.modules.core.ExportedModule
4
4
  import expo.modules.core.Promise
5
5
  import expo.modules.core.interfaces.ExpoMethod
6
+ import expo.modules.core.utilities.EmulatorUtilities
6
7
 
7
8
  import com.facebook.device.yearclass.YearClass
8
9
 
@@ -37,7 +38,7 @@ class DeviceModule(private val mContext: Context) : ExportedModule(mContext) {
37
38
  }
38
39
 
39
40
  override fun getConstants(): Map<String, Any> = mapOf(
40
- "isDevice" to (!isRunningOnGenymotion && !isRunningOnStockEmulator),
41
+ "isDevice" to !isRunningOnEmulator,
41
42
  "brand" to Build.BRAND,
42
43
  "manufacturer" to Build.MANUFACTURER,
43
44
  "modelName" to Build.MODEL,
@@ -62,7 +63,12 @@ class DeviceModule(private val mContext: Context) : ExportedModule(mContext) {
62
63
  "osInternalBuildId" to Build.ID,
63
64
  "osBuildFingerprint" to Build.FINGERPRINT,
64
65
  "platformApiLevel" to Build.VERSION.SDK_INT,
65
- "deviceName" to Settings.Secure.getString(mContext.contentResolver, "bluetooth_name")
66
+ "deviceName" to run {
67
+ if (Build.VERSION.SDK_INT <= 31)
68
+ Settings.Secure.getString(mContext.contentResolver, "bluetooth_name")
69
+ else
70
+ Settings.Global.getString(mContext.contentResolver, Settings.Global.DEVICE_NAME)
71
+ },
66
72
  )
67
73
 
68
74
  private val deviceYearClass: Int
@@ -96,7 +102,7 @@ class DeviceModule(private val mContext: Context) : ExportedModule(mContext) {
96
102
  @ExpoMethod
97
103
  fun isRootedExperimentalAsync(promise: Promise) {
98
104
  var isRooted = false
99
- val isDevice = !isRunningOnGenymotion && !isRunningOnStockEmulator
105
+ val isDevice = !isRunningOnEmulator
100
106
 
101
107
  try {
102
108
  val buildTags = Build.TAGS
@@ -151,10 +157,8 @@ class DeviceModule(private val mContext: Context) : ExportedModule(mContext) {
151
157
  companion object {
152
158
  private val TAG = DeviceModule::class.java.simpleName
153
159
 
154
- private val isRunningOnGenymotion: Boolean
155
- get() = Build.FINGERPRINT.contains("vbox")
156
- private val isRunningOnStockEmulator: Boolean
157
- get() = Build.FINGERPRINT.contains("generic")
160
+ private val isRunningOnEmulator: Boolean
161
+ get() = EmulatorUtilities.isRunningOnEmulator()
158
162
 
159
163
  private fun getDeviceType(context: Context): DeviceType {
160
164
  // Detect TVs via UI mode (Android TVs) or system features (Fire TV).
@@ -10,7 +10,7 @@ Pod::Spec.new do |s|
10
10
  s.license = package['license']
11
11
  s.author = package['author']
12
12
  s.homepage = package['homepage']
13
- s.platform = :ios, '12.0'
13
+ s.platform = :ios, '13.0'
14
14
  s.source = { git: 'https://github.com/expo/expo.git' }
15
15
  s.static_framework = true
16
16
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-device",
3
- "version": "4.3.0",
3
+ "version": "5.0.0",
4
4
  "description": "A universal module that gets physical information about the device running the application",
5
5
  "main": "build/Device.js",
6
6
  "types": "build/Device.d.ts",
@@ -36,10 +36,10 @@
36
36
  "ua-parser-js": "^0.7.19"
37
37
  },
38
38
  "devDependencies": {
39
- "expo-module-scripts": "^2.0.0"
39
+ "expo-module-scripts": "^3.0.0"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "expo": "*"
43
43
  },
44
- "gitHead": "e893ff2b01e108cf246cec02318c0df9d6bc603c"
44
+ "gitHead": "eab2b09c735fb0fc2bf734a3f29a6593adba3838"
45
45
  }