Commit b4b5ffe5 authored by Douglas Nassif Roma Junior's avatar Douglas Nassif Roma Junior Committed by GitHub

Merge branch 'master' into patch-3

parents a337a40a 5dbd4420
## Release Notes
### Upcoming
### 0.12.0
- Get real WebView UserAgent on Android (https://github.com/rebeccahughes/react-native-device-info/pull/207)
- Add DeviceUID.h to public headers (https://github.com/rebeccahughes/react-native-device-info/pull/217)
- Add `getPhoneNumber` (https://github.com/rebeccahughes/react-native-device-info/pull/174)
- Fix typescript definitions (https://github.com/rebeccahughes/react-native-device-info/pull/221)
- Add `getFirstInstallTime` and `getLastInstallTime` (https://github.com/rebeccahughes/react-native-device-info/pull/222)
- Added version check and permission to work with Android API >= 16 (https://github.com/rebeccahughes/react-native-device-info/pull/225)
- Added device detection even when in an iOS emulator (https://github.com/rebeccahughes/react-native-device-info/pull/224)
- Add support for new iPhone, iPad, and Apple TV models (https://github.com/rebeccahughes/react-native-device-info/pull/230)
- Add android only `getAPILevel` method (https://github.com/rebeccahughes/react-native-device-info/pull/232)
- Add Android support for serial number, IP, and MAC address (https://github.com/rebeccahughes/react-native-device-info/pull/150)
- Add tvOS support (https://github.com/rebeccahughes/react-native-device-info/pull/235)
- Add flow types
- Fix getCurrentActivity() null crash in Android (https://github.com/rebeccahughes/react-native-device-info/pull/247)
[Diff](https://github.com/rebeccahughes/react-native-device-info/compare/1aafc6f0b20d7cd6f0939ea5370e9899e4914c93...master)
### 0.11.0
- Add support for RN > 0.47
- Update typescript definitions
[Diff](https://github.com/rebeccahughes/react-native-device-info/compare/5b869cdd5e16b65cbe4e85a565aa331bd7546b89...1aafc6f0b20d7cd6f0939ea5370e9899e4914c93)
### 0.10.2
- Add typescript definitions
[Diff](https://github.com/rebeccahughes/react-native-device-info/compare/f3967862711892615e7f51d49d0034ee134f3e3d...5b869cdd5e16b65cbe4e85a565aa331bd7546b89)
### 0.10.1
- Add `isPinOrFingerprintSet` method
- Add support for RN > 0.40
[Diff](https://github.com/rebeccahughes/react-native-device-info/compare/c843144ea872a79f4d53a53b32f72511fbfc8d8b...f3967862711892615e7f51d49d0034ee134f3e3d)
### 0.10.0
- Semver fix
[Diff](https://github.com/rebeccahughes/react-native-device-info/compare/e8bfe5ea8d5f5414f2f97f35a5d02b611cbe39e3...c843144ea872a79f4d53a53b32f72511fbfc8d8b)
### 0.9.8
[Diff](https://github.com/rebeccahughes/react-native-device-info/compare/668996c64e23f477fc8156cdc43a49198b4fdd20...e8bfe5ea8d5f5414f2f97f35a5d02b611cbe39e3)
### 0.9.7
Several bugfixes and detecting if device is a tablet
### 0.9.3
### 0.9.3
adds support for Brand information e.g. apple, htc, etc
......
This diff is collapsed.
......@@ -11,6 +11,10 @@
BF770A3D1F6A3EEE007E5F09 /* DeviceUID.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 76E65CA21D4CA143009B7AF1 /* DeviceUID.h */; };
DA5891DC1BA9A9FC002B4DB2 /* RNDeviceInfo.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = DA5891DB1BA9A9FC002B4DB2 /* RNDeviceInfo.h */; };
DA5891DE1BA9A9FC002B4DB2 /* RNDeviceInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = DA5891DD1BA9A9FC002B4DB2 /* RNDeviceInfo.m */; };
E72EC1491F7ABC0C0001BC90 /* DeviceUID.m in Sources */ = {isa = PBXBuildFile; fileRef = 76E65CA31D4CA143009B7AF1 /* DeviceUID.m */; };
E72EC14A1F7ABC0E0001BC90 /* RNDeviceInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = DA5891DD1BA9A9FC002B4DB2 /* RNDeviceInfo.m */; };
E72EC14B1F7ABC1A0001BC90 /* DeviceUID.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 76E65CA21D4CA143009B7AF1 /* DeviceUID.h */; };
E72EC14C1F7ABC1D0001BC90 /* RNDeviceInfo.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = DA5891DB1BA9A9FC002B4DB2 /* RNDeviceInfo.h */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
......@@ -25,6 +29,17 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
E72EC13E1F7ABB5A0001BC90 /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "include/$(PRODUCT_NAME)";
dstSubfolderSpec = 16;
files = (
E72EC14B1F7ABC1A0001BC90 /* DeviceUID.h in CopyFiles */,
E72EC14C1F7ABC1D0001BC90 /* RNDeviceInfo.h in CopyFiles */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
......@@ -33,6 +48,7 @@
DA5891D81BA9A9FC002B4DB2 /* libRNDeviceInfo.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRNDeviceInfo.a; sourceTree = BUILT_PRODUCTS_DIR; };
DA5891DB1BA9A9FC002B4DB2 /* RNDeviceInfo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNDeviceInfo.h; sourceTree = "<group>"; };
DA5891DD1BA9A9FC002B4DB2 /* RNDeviceInfo.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNDeviceInfo.m; sourceTree = "<group>"; };
E72EC1401F7ABB5A0001BC90 /* libRNDeviceInfo-tvOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libRNDeviceInfo-tvOS.a"; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
......@@ -43,6 +59,13 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
E72EC13D1F7ABB5A0001BC90 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
......@@ -58,6 +81,7 @@
isa = PBXGroup;
children = (
DA5891D81BA9A9FC002B4DB2 /* libRNDeviceInfo.a */,
E72EC1401F7ABB5A0001BC90 /* libRNDeviceInfo-tvOS.a */,
);
name = Products;
sourceTree = "<group>";
......@@ -93,6 +117,23 @@
productReference = DA5891D81BA9A9FC002B4DB2 /* libRNDeviceInfo.a */;
productType = "com.apple.product-type.library.static";
};
E72EC13F1F7ABB5A0001BC90 /* RNDeviceInfo-tvOS */ = {
isa = PBXNativeTarget;
buildConfigurationList = E72EC1481F7ABB5A0001BC90 /* Build configuration list for PBXNativeTarget "RNDeviceInfo-tvOS" */;
buildPhases = (
E72EC13C1F7ABB5A0001BC90 /* Sources */,
E72EC13D1F7ABB5A0001BC90 /* Frameworks */,
E72EC13E1F7ABB5A0001BC90 /* CopyFiles */,
);
buildRules = (
);
dependencies = (
);
name = "RNDeviceInfo-tvOS";
productName = "RNDeviceInfo-tvOS";
productReference = E72EC1401F7ABB5A0001BC90 /* libRNDeviceInfo-tvOS.a */;
productType = "com.apple.product-type.library.static";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
......@@ -105,6 +146,10 @@
DA5891D71BA9A9FC002B4DB2 = {
CreatedOnToolsVersion = 7.0;
};
E72EC13F1F7ABB5A0001BC90 = {
CreatedOnToolsVersion = 9.0;
ProvisioningStyle = Automatic;
};
};
};
buildConfigurationList = DA5891D31BA9A9FC002B4DB2 /* Build configuration list for PBXProject "RNDeviceInfo" */;
......@@ -120,6 +165,7 @@
projectRoot = "";
targets = (
DA5891D71BA9A9FC002B4DB2 /* RNDeviceInfo */,
E72EC13F1F7ABB5A0001BC90 /* RNDeviceInfo-tvOS */,
);
};
/* End PBXProject section */
......@@ -134,6 +180,15 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
E72EC13C1F7ABB5A0001BC90 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
E72EC1491F7ABC0C0001BC90 /* DeviceUID.m in Sources */,
E72EC14A1F7ABC0E0001BC90 /* RNDeviceInfo.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin XCBuildConfiguration section */
......@@ -251,6 +306,60 @@
};
name = Release;
};
E72EC1461F7ABB5A0001BC90 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_STYLE = Automatic;
GCC_C_LANGUAGE_STANDARD = gnu11;
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
SKIP_INSTALL = YES;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 10.0;
};
name = Debug;
};
E72EC1471F7ABB5A0001BC90 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_STYLE = Automatic;
GCC_C_LANGUAGE_STANDARD = gnu11;
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
SKIP_INSTALL = YES;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 10.0;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
......@@ -272,6 +381,15 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
E72EC1481F7ABB5A0001BC90 /* Build configuration list for PBXNativeTarget "RNDeviceInfo-tvOS" */ = {
isa = XCConfigurationList;
buildConfigurations = (
E72EC1461F7ABB5A0001BC90 /* Debug */,
E72EC1471F7ABB5A0001BC90 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = DA5891D01BA9A9FC002B4DB2 /* Project object */;
......
......@@ -11,29 +11,38 @@
#import <LocalAuthentication/LocalAuthentication.h>
@interface RNDeviceInfo()
@property (nonatomic) bool isEmulator;
@end
@implementation RNDeviceInfo
{
}
@synthesize isEmulator;
RCT_EXPORT_MODULE()
- (dispatch_queue_t)methodQueue
+ (BOOL)requiresMainQueueSetup
{
return dispatch_get_main_queue();
return YES;
}
- (NSString*) deviceId
{
struct utsname systemInfo;
uname(&systemInfo);
return [NSString stringWithCString:systemInfo.machine
encoding:NSUTF8StringEncoding];
NSString* deviceId = [NSString stringWithCString:systemInfo.machine
encoding:NSUTF8StringEncoding];
if ([deviceId isEqualToString:@"i386"] || [deviceId isEqualToString:@"x86_64"] ) {
deviceId = [NSString stringWithFormat:@"%s", getenv("SIMULATOR_MODEL_IDENTIFIER")];
self.isEmulator = YES;
} else {
self.isEmulator = NO;
}
return deviceId;
}
- (NSString*) deviceName
......@@ -41,10 +50,8 @@ RCT_EXPORT_MODULE()
static NSDictionary* deviceNamesByCode = nil;
if (!deviceNamesByCode) {
deviceNamesByCode = @{@"i386" :@"Simulator",
@"x86_64" :@"Simulator",
@"iPod1,1" :@"iPod Touch", // (Original)
deviceNamesByCode = @{@"iPod1,1" :@"iPod Touch", // (Original)
@"iPod2,1" :@"iPod Touch", // (Second Generation)
@"iPod3,1" :@"iPod Touch", // (Third Generation)
@"iPod4,1" :@"iPod Touch", // (Fourth Generation)
......@@ -86,6 +93,12 @@ RCT_EXPORT_MODULE()
@"iPhone9,3" :@"iPhone 7", // (model A1778 | Global)
@"iPhone9,2" :@"iPhone 7 Plus", // (model A1661 | CDMA)
@"iPhone9,4" :@"iPhone 7 Plus", // (model A1784 | Global)
@"iPhone10,3":@"iPhone X", // (model A1865, A1902)
@"iPhone10,6":@"iPhone X", // (model A1901)
@"iPhone10,1":@"iPhone 8", // (model A1863, A1906, A1907)
@"iPhone10,4":@"iPhone 8", // (model A1905)
@"iPhone10,2":@"iPhone 8 Plus", // (model A1864, A1898, A1899)
@"iPhone10,5":@"iPhone 8 Plus", // (model A1897)
@"iPad4,1" :@"iPad Air", // 5th Generation iPad (iPad Air) - Wifi
@"iPad4,2" :@"iPad Air", // 5th Generation iPad (iPad Air) - Cellular
@"iPad4,3" :@"iPad Air", // 5th Generation iPad (iPad Air)
......@@ -103,10 +116,15 @@ RCT_EXPORT_MODULE()
@"iPad6,4" :@"iPad Pro 9.7-inch",// iPad Pro 9.7-inch
@"iPad6,7" :@"iPad Pro 12.9-inch",// iPad Pro 12.9-inch
@"iPad6,8" :@"iPad Pro 12.9-inch",// iPad Pro 12.9-inch
@"iPad7,1" :@"iPad Pro 12.9-inch",// 2nd Generation iPad Pro 12.5-inch - Wifi
@"iPad7,2" :@"iPad Pro 12.9-inch",// 2nd Generation iPad Pro 12.5-inch - Cellular
@"iPad7,3" :@"iPad Pro 10.5-inch",// iPad Pro 12.5-inch - Wifi
@"iPad7,4" :@"iPad Pro 10.5-inch",// iPad Pro 12.5-inch - Cellular
@"AppleTV2,1":@"Apple TV", // Apple TV (2nd Generation)
@"AppleTV3,1":@"Apple TV", // Apple TV (3rd Generation)
@"AppleTV3,2":@"Apple TV", // Apple TV (3rd Generation - Rev A)
@"AppleTV5,3":@"Apple TV", // Apple TV (4th Generation)
@"AppleTV6,2":@"Apple TV 4K", // Apple TV 4K
};
}
......@@ -124,6 +142,9 @@ RCT_EXPORT_MODULE()
else if([self.deviceId rangeOfString:@"iPhone"].location != NSNotFound){
deviceName = @"iPhone";
}
else if([self.deviceId rangeOfString:@"AppleTV"].location != NSNotFound){
deviceName = @"Apple TV";
}
}
return deviceName;
......@@ -131,8 +152,12 @@ RCT_EXPORT_MODULE()
- (NSString*) userAgent
{
#if TARGET_OS_TV
return @"not available";
#else
UIWebView* webView = [[UIWebView alloc] initWithFrame:CGRectZero];
return [webView stringByEvaluatingJavaScriptFromString:@"navigator.userAgent"];
#endif
}
- (NSString*) deviceLocale
......@@ -153,11 +178,6 @@ RCT_EXPORT_MODULE()
return currentTimeZone.name;
}
- (bool) isEmulator
{
return [self.deviceName isEqual: @"Simulator"];
}
- (bool) isTablet
{
return [[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad;
......@@ -172,6 +192,7 @@ RCT_EXPORT_MODULE()
return @{
@"systemName": currentDevice.systemName,
@"systemVersion": currentDevice.systemVersion,
@"apiLevel": @"not available",
@"model": self.deviceName,
@"brand": @"Apple",
@"deviceId": self.deviceId,
......
package com.learnium.RNDeviceInfo;
import android.Manifest;
import android.app.KeyguardManager;
import android.bluetooth.BluetoothAdapter;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.net.wifi.WifiManager;
import android.net.wifi.WifiInfo;
import android.os.Build;
import android.provider.Settings.Secure;
import android.webkit.WebSettings;
import android.telephony.TelephonyManager;
import android.text.format.Formatter;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
import com.facebook.react.bridge.Callback;
import com.facebook.react.bridge.Promise;
import java.util.HashMap;
import java.util.Locale;
......@@ -27,8 +32,11 @@ public class RNDeviceModule extends ReactContextBaseJavaModule {
ReactApplicationContext reactContext;
WifiInfo wifiInfo;
public RNDeviceModule(ReactApplicationContext reactContext) {
super(reactContext);
this.reactContext = reactContext;
}
......@@ -37,6 +45,14 @@ public class RNDeviceModule extends ReactContextBaseJavaModule {
return "RNDeviceInfo";
}
private WifiInfo getWifiInfo() {
if ( this.wifiInfo == null ) {
WifiManager manager = (WifiManager) reactContext.getApplicationContext().getSystemService(Context.WIFI_SERVICE);
this.wifiInfo = manager.getConnectionInfo();
}
return this.wifiInfo;
}
private String getCurrentLanguage() {
Locale current = getReactApplicationContext().getResources().getConfiguration().locale;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
......@@ -75,15 +91,26 @@ public class RNDeviceModule extends ReactContextBaseJavaModule {
@ReactMethod
public void isPinOrFingerprintSet(Callback callback) {
KeyguardManager keyguardManager = (KeyguardManager) this.reactContext.getSystemService(Context.KEYGUARD_SERVICE); //api 16+
KeyguardManager keyguardManager = (KeyguardManager) this.reactContext.getApplicationContext().getSystemService(Context.KEYGUARD_SERVICE); //api 16+
callback.invoke(keyguardManager.isKeyguardSecure());
}
@ReactMethod
public void getIpAddress(Promise p) {
String ipAddress = Formatter.formatIpAddress(getWifiInfo().getIpAddress());
p.resolve(ipAddress);
}
@ReactMethod
public void getMacAddress(Promise p) {
String macAddress = getWifiInfo().getMacAddress();
p.resolve(macAddress);
}
@Override
public @Nullable Map<String, Object> getConstants() {
HashMap<String, Object> constants = new HashMap<String, Object>();
TelephonyManager telMgr = (TelephonyManager) this.reactContext.getSystemService(Context.TELEPHONY_SERVICE);
PackageManager packageManager = this.reactContext.getPackageManager();
String packageName = this.reactContext.getPackageName();
......@@ -116,23 +143,35 @@ public class RNDeviceModule extends ReactContextBaseJavaModule {
if (Class.forName("com.google.android.gms.iid.InstanceID") != null) {
constants.put("instanceId", com.google.android.gms.iid.InstanceID.getInstance(this.reactContext).getId());
}
} catch (ClassNotFoundException e) {}
} catch (ClassNotFoundException e) {
constants.put("instanceId", "N/A: Add com.google.android.gms:play-services-gcm to your project.");
}
constants.put("serialNumber", Build.SERIAL);
constants.put("deviceName", deviceName);
constants.put("systemName", "Android");
constants.put("systemVersion", Build.VERSION.RELEASE);
constants.put("model", Build.MODEL);
constants.put("brand", Build.BRAND);
constants.put("deviceId", Build.BOARD);
constants.put("apiLevel", Build.VERSION.SDK_INT);
constants.put("deviceLocale", this.getCurrentLanguage());
constants.put("deviceCountry", this.getCurrentCountry());
constants.put("uniqueId", Secure.getString(this.reactContext.getContentResolver(), Secure.ANDROID_ID));
constants.put("systemManufacturer", Build.MANUFACTURER);
constants.put("bundleId", packageName);
constants.put("userAgent", WebSettings.getDefaultUserAgent(this.reactContext));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
constants.put("userAgent", WebSettings.getDefaultUserAgent(this.reactContext));
}
constants.put("timezone", TimeZone.getDefault().getID());
constants.put("isEmulator", this.isEmulator());
constants.put("isTablet", this.isTablet());
constants.put("phoneNumber", telMgr.getLine1Number());
if (getCurrentActivity() != null &&
(getCurrentActivity().checkCallingOrSelfPermission(Manifest.permission.READ_PHONE_STATE) == PackageManager.PERMISSION_GRANTED ||
getCurrentActivity().checkCallingOrSelfPermission(Manifest.permission.READ_SMS) == PackageManager.PERMISSION_GRANTED ||
getCurrentActivity().checkCallingOrSelfPermission("android.permission.READ_PHONE_NUMBERS") == PackageManager.PERMISSION_GRANTED)) {
TelephonyManager telMgr = (TelephonyManager) this.reactContext.getApplicationContext().getSystemService(Context.TELEPHONY_SERVICE);
constants.put("phoneNumber", telMgr.getLine1Number());
}
return constants;
}
}
......@@ -23,3 +23,6 @@ export function isTablet(): boolean;
export function isPinOrFingerprintSet(): (cb: (isPinOrFingerprintSet: boolean) => void) => void;
export function getFirstInstallTime(): number;
export function getLastUpdateTime(): number;
export function getSerialNumber(): string;
export function getIPAddress(): Promise<string>;
export function getMACAddress(): Promise<string>;
......@@ -11,6 +11,15 @@ module.exports = {
getInstanceID: function() {
return RNDeviceInfo.instanceId;
},
getSerialNumber: function () {
return RNDeviceInfo.serialNumber;
},
getIPAddress: function () {
return RNDeviceInfo.getIpAddress();
},
getMACAddress: function () {
return RNDeviceInfo.getMacAddress();
},
getDeviceId: function () {
return RNDeviceInfo.deviceId;
},
......@@ -29,6 +38,9 @@ module.exports = {
getSystemVersion: function () {
return RNDeviceInfo.systemVersion;
},
getAPILevel: function () {
return RNDeviceInfo.apiLevel;
},
getBundleId: function() {
return RNDeviceInfo.bundleId;
},
......@@ -71,5 +83,7 @@ module.exports = {
getLastUpdateTime: function () {
return RNDeviceInfo.lastUpdateTime;
},
getPhoneNumber: _ => RNDeviceInfo.phoneNumber
getPhoneNumber: function () {
return RNDeviceInfo.phoneNumber;
}
};
// @flow
declare module.exports: {
getUniqueID: () => string,
getManufacturer: () => string,
getBrand: () => string,
getModel: () => string,
getDeviceId: () => string,
getSystemName: () => string,
getSystemVersion: () => string,
getBundleId: () => string,
getBuildNumber: () => string,
getVersion: () => string,
getReadableVersion: () => string,
getDeviceName: () => string,
getUserAgent: () => string,
getDeviceLocale: () => string,
getDeviceCountry: () => string,
getTimezone: () => string,
isEmulator: () => boolean,
isTablet: () => boolean,
isPinOrFingerprintSet: () => (cb: (isPinOrFingerprintSet: boolean) => void) => void,
getAPILevel: () => number,
getInstanceID: () => string,
getPhoneNumber: () => ?string,
getFirstInstallTime: () => number,
getLastUpdateTime: () => number,
getSerialNumber: () => string,
getIPAddress: () => Promise<string>,
getMACAddress: () => Promise<string>,
}
{
"name": "react-native-device-info",
"version": "0.11.0",
"version": "0.12.1",
"description": "Get device information using react-native",
"main": "deviceinfo.js",
"typings": "./deviceinfo.d.ts",
......@@ -8,6 +8,9 @@
"type": "git",
"url": "https://github.com/rebeccahughes/react-native-device-info"
},
"scripts": {
"shipit": "np"
},
"keywords": [
"react-component",
"react-native",
......@@ -19,10 +22,15 @@
"cocoapod"
],
"author": "Rebecca Hughes <rebecca@learnium.net> (https://github.com/rebeccahughes)",
"contributors": [{
"name": "Gant Laborde",
"email": "gant@infinite.red",
"url": "https://github.com/gantman"
}],
"license": "MIT"
"contributors": [
{
"name": "Gant Laborde",
"email": "gant@infinite.red",
"url": "https://github.com/gantman"
}
],
"license": "MIT",
"devDependencies": {
"np": "^2.16.0"
}
}
......@@ -99,6 +99,7 @@ namespace RNDeviceInfo
constants["deviceName"] = deviceName;
constants["systemName"] = "Windows";
constants["systemVersion"] = osVersion;
constants["apiLevel"] = "not available";
constants["model"] = model;
constants["brand"] = model;
constants["deviceId"] = hardwareVersion;
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment