Skip to content

Commit

Permalink
BREAKING CHANGE - locale APIs gone, events renamed, getBuildNumber type
Browse files Browse the repository at this point in the history
Also switched to yarn, and altered Bluetooth access in Android to drop permission

CHANGELOG has the details
  • Loading branch information
mikehardy committed Aug 29, 2019
1 parent 99a3b36 commit cc2021f
Show file tree
Hide file tree
Showing 19 changed files with 3,512 additions and 4,363 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
## Release Notes

### Next
* fix: Android `getBuildNumber` now returns a string (https://github.com/react-native-community/react-native-device-info/pull/648)
* BREAKING CHANGE: all events prefixed with 'RNDeviceInfo_' to future-proof against collisions (https://github.com/react-native-community/react-native-device-info/issues/620)
* feat: getDeviceName() without Bluetooth permission on Android (https://github.com/react-native-community/react-native-device-info/issues/735)
* BREAKING CHANGE: Android `getBuildNumber` now returns a string (https://github.com/react-native-community/react-native-device-info/pull/648)
* deprecated: IP-address-related methods deprecated - use @react-native-community/netinfo or react-native-network-info or react-native-carrier-info
* feat: TurboModule support (https://github.com/react-native-community/react-native-device-info/pull/745)
* BREAKING CHANGE: remove is24Hour, getTimezone, isAutoTimeZone and isAutoDateAndTime, getDeviceLocale, getDeviceCountry, getPreferredLocales. react-native-localize is superior for these purposes (https://github.com/react-native-community/react-native-localize/pull/65)
* feat: allow for destructured ES6 imports (https://github.com/react-native-community/react-native-device-info/pull/727)
* BREAKING CHANGE: remove deprecated iOS WebView / promises (https://github.com/react-native-community/react-native-device-info/pull/757)
* fix: remove unnecessary gradle depencies (https://github.com/react-native-community/react-native-device-info/pull/746)

### 2.3.2
* fix: load module async by default with option to load sync (https://github.com/react-native-community/react-native-device-info/pull/741)
Expand Down
115 changes: 6 additions & 109 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -292,11 +292,8 @@ import { getUniqueID, getManufacturer } from 'react-native-device-info';
| [getCarrier()](#getcarrier) | `string` |||| 0.13.0 |
| [getCodename()](#getcodename) | `string` |||| ? |
| [getDevice()](#getdevice) | `string` |||| ? |
| [getDeviceCountry()](#getdevicecountry) | `string` |||| 0.9.0 |
| [getDeviceId()](#getdeviceid) | `string` |||| 0.5.0 |
| [getDeviceLocale()](#getdevicelocale) | `string` |||| 0.7.0 |
| [getDisplay()](#getdisplay) | `string` |||| ? |
| [getPreferredLocales()](#getpreferredlocale) | `Array<string>` |||| ? |
| [getDeviceName()](#getdevicename) | `string` |||| ? |
| [getFirstInstallTime()](#getfirstinstalltime) | `number` |||| 0.12.0 |
| [getFingerprint()](#getfingerprint) | `string` |||| ? |
Expand Down Expand Up @@ -325,13 +322,11 @@ import { getUniqueID, getManufacturer } from 'react-native-device-info';
| [getBuildId()](#getbuildid) | `string` |||| ? |
| [getTags()](#gettags) | `string` |||| ? |
| [getType()](#gettype) | `string` |||| ? |
| [getTimezone()](#gettimezone) | `string` |||| ? |
| [getTotalDiskCapacity()](#gettotaldiskcapacity) | `number` |||| 0.15.0 |
| [getTotalMemory()](#gettotalmemory) | `number` |||| 0.14.0 |
| [getUniqueID()](#getuniqueid) | `string` |||| ? |
| [getUserAgent()](#getuseragent) | `string` |||| 0.7.0 |
| [getVersion()](#getversion) | `string` |||| ? |
| [is24Hour()](#is24hour) | `boolean` |||| 0.13.0 |
| [isAirPlaneMode()](#isairplanemode) | `Promise<boolean>` |||| 0.25.0 |
| [isBatteryCharging()](#isbatterycharging) | `Promise<boolean>` |||| 0.27.0 |
| [isEmulator()](#isemulator) | `boolean` |||| ? |
Expand All @@ -340,8 +335,6 @@ import { getUniqueID, getManufacturer } from 'react-native-device-info';
| [hasNotch()](#hasNotch) | `boolean` |||| 0.23.0 |
| [isLandscape()](#isLandscape) | `boolean` |||| 0.24.0 |
| [getDeviceType()](#getDeviceType) | `string` |||| ? |
| [isAutoDateAndTime()](#isAutoDateAndTime) | `Promise<boolean>` |||| 0.29.0 |
| [isAutoTimeZone()](#isAutoTimeZone) | `Promise<boolean>` |||| 0.29.0 |
| [supported32BitAbis()](#supported32BitAbis) | `string[]` |||| ? |
| [supported64BitAbis()](#supported64BitAbis) | `string[]` |||| ? |
| [supportedABIs()](#supportedABIs) | `string[]` |||| 1.1.0 |
Expand Down Expand Up @@ -543,17 +536,6 @@ const device = DeviceInfo.getDevice();
// "walleye"
```

---
### getDeviceCountry()

Gets the device country based on the locale information.

**Examples**

```js
const deviceCountry = DeviceInfo.getDeviceCountry(); // "US"
```

---

### getDeviceId()
Expand All @@ -572,22 +554,6 @@ const deviceId = DeviceInfo.getDeviceId();

---

### getDeviceLocale()

Gets the device locale.

**Examples**

```js
const deviceLocale = DeviceInfo.getDeviceLocale();

// iOS: "en"
// Android: "en-US"
// Windows: ?
```

---

### getDisplay()

A build ID string meant for displaying to the user.
Expand All @@ -602,22 +568,6 @@ const display = DeviceInfo.getDisplay();

---

### getPreferredLocales()

Gets the preferred locales defined by the user.

**Examples**

```js
const preferredLocales = DeviceInfo.getPreferredLocales();

// iOS: "[es-ES, en-US]"
// Android: "[es-ES, en-US]"
// Windows: ?
```

---

### getDeviceName()

Gets the device name.
Expand All @@ -632,9 +582,7 @@ const deviceName = DeviceInfo.getDeviceName();
// Windows: ?
```

**Android Permissions**

* [android.permission.BLUETOOTH](https://developer.android.com/reference/android/Manifest.permission.html#BLUETOOTH)
This used to require the android.permission.BLUETOOTH but the new implementation in v3 does not need it. You may remove that from your AndroidManifest.xml if you had it for this API.

---

Expand Down Expand Up @@ -739,7 +687,8 @@ const host = DeviceInfo.getHost();

### getIPAddress()

Gets the device current IP address.
**Deprecated** Gets the device current IP address.
Switch to @react-native-community/netinfo or react-native-network-info

**Examples**

Expand Down Expand Up @@ -1080,18 +1029,6 @@ const type = DeviceInfo.getType();

---

### getTimezone()

Gets the device default timezone.

**Examples**

```js
const timezone = DeviceInfo.getTimezone(); // "Africa/Tunis"
```

---

### getTotalDiskCapacity()

Gets full disk storage size, in bytes.
Expand Down Expand Up @@ -1174,18 +1111,6 @@ const version = DeviceInfo.getVersion();

---

### is24Hour()

Tells if the user preference is set to 24-hour format.

**Examples**

```js
const is24Hour = DeviceInfo.is24Hour(); // true
```

---

### isAirPlaneMode()

Tells if the device is in AirPlaneMode.
Expand Down Expand Up @@ -1304,34 +1229,6 @@ const deviceType = DeviceInfo.getDeviceType(); // 'Handset'

---

### isAutoDateAndTime()

Tells if the automatic date & time setting is enabled on the phone.

**Examples**

```js
DeviceInfo.isAutoDateAndTime().then(isAutoDateAndTime => {
// true or false
});
```

---

### isAutoTimeZone()

Tells if the automatic time zone setting is enabled on the phone.

**Examples**

```js
DeviceInfo.isAutoTimeZone().then(isAutoTimeZone => {
// true or false
});
```

---

### supported32BitAbis()

An ordered list of 32 bit ABIs supported by this device.
Expand Down Expand Up @@ -1455,7 +1352,7 @@ Fired when the battery level changes; sent no more frequently than once per minu
import { NativeEventEmitter, NativeModules } from 'react-native'
const deviceInfoEmitter = new NativeEventEmitter(NativeModules.RNDeviceInfo)

deviceInfoEmitter.addListener('batteryLevelDidChange', level => {
deviceInfoEmitter.addListener('RNDeviceInfo_batteryLevelDidChange', level => {
// 0.759999
});
```
Expand All @@ -1472,7 +1369,7 @@ Fired when the battery drops below 20%.
import { NativeEventEmitter, NativeModules } from 'react-native'
const deviceInfoEmitter = new NativeEventEmitter(NativeModules.RNDeviceInfo)

deviceInfoEmitter.addListener('batteryLevelIsLow', level => {
deviceInfoEmitter.addListener('RNDeviceInfo_batteryLevelIsLow', level => {
// 0.19
});
```
Expand All @@ -1489,7 +1386,7 @@ Fired when the battery state changes, for example when the device enters chargin
import { NativeEventEmitter, NativeModules } from 'react-native'
const deviceInfoEmitter = new NativeEventEmitter(NativeModules.RNDeviceInfo)

deviceInfoEmitter.addListener('powerStateDidChange', { batteryState } => {
deviceInfoEmitter.addListener('RNDeviceInfo_powerStateDidChange', { batteryState } => {
// 'charging'
});
```
Expand Down
Binary file added android/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
6 changes: 6 additions & 0 deletions android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#Thu Aug 29 10:53:21 ECT 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip

0 comments on commit cc2021f

Please sign in to comment.