Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nativescript-dna-deviceinfo

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nativescript-dna-deviceinfo - npm Package Compare versions

Comparing version 2.1.3 to 2.2.0

2

deviceinfo.android.d.ts

@@ -30,3 +30,3 @@ import { Carrier, StorageVolume } from './deviceinfo.interface';

static isBatteryCharging(): boolean;
static isExternalStorageAvailable(): boolean;
static isBluetoothEnabled(): Promise<boolean>;
private static memoryInfo;

@@ -33,0 +33,0 @@ private static totalSpace;

@@ -312,4 +312,26 @@ "use strict";

};
DeviceInfo.isExternalStorageAvailable = function () {
return false;
DeviceInfo.isBluetoothEnabled = function () {
var Build = android.os.Build;
var BluetoothAdapter = android.bluetooth.BluetoothAdapter;
var ctx = application_1.android.context;
var btAdapter = null;
if (Build.VERSION.SDK_INT > JELLY_BEAN_MR1) {
var btm = ctx.getSystemService(Context.BLUETOOTH_SERVICE);
btAdapter = btm.getAdapter();
}
else {
btAdapter = BluetoothAdapter.getDefaultAdapter();
}
return new Promise(function (resolve, reject) {
var permission = android.Manifest.permission;
var contextCompat = android.support.v4.content.ContextCompat;
var PackageManager = android.content.pm.PackageManager;
var permissionStatus = contextCompat.checkSelfPermission(ctx, permission.BLUETOOTH);
if (permissionStatus === PackageManager.PERMISSION_GRANTED) {
resolve(btAdapter && btAdapter.getState() === BluetoothAdapter.STATE_ON);
}
else {
reject(new Error("Missing bluetooth permission."));
}
});
};

@@ -316,0 +338,0 @@ DeviceInfo.memoryInfo = function () {

@@ -51,3 +51,4 @@ import { RadioAccessTechnology, WCTGeneration } from "./index.d";

isBatteryCharging(): boolean;
isBluetoothEnabled(): Promise<boolean>;
}
export declare function wirelessCellularGenerator(rat: RadioAccessTechnology): WCTGeneration;

@@ -32,4 +32,5 @@ import { Carrier, StorageVolume } from './deviceinfo.interface';

static isBatteryCharging(): boolean;
static isBluetoothEnabled(): Promise<boolean>;
private static fileSystemAttributes;
private static prepareCarrier;
}

@@ -191,2 +191,8 @@ "use strict";

};
DeviceInfo.isBluetoothEnabled = function () {
return new Promise(function (resolv) {
var bmDelegate = BluetoothManagerDelegate.new();
CBCentralManager.alloc().initWithDelegateQueueOptions(bmDelegate.initWithResolverCallback(resolv), null, NSDictionary.dictionaryWithObjectForKey(NSNumber.numberWithInt(0), CBCentralManagerOptionShowPowerAlertKey));
});
};
DeviceInfo.fileSystemAttributes = function () {

@@ -334,2 +340,20 @@ var path = NSSearchPathForDirectoriesInDomains(9, 1, true);

exports.DeviceInfo = DeviceInfo;
var BluetoothManagerDelegate = (function (_super) {
__extends(BluetoothManagerDelegate, _super);
function BluetoothManagerDelegate() {
return _super !== null && _super.apply(this, arguments) || this;
}
BluetoothManagerDelegate.new = function () {
return _super.new.call(this);
};
BluetoothManagerDelegate.prototype.initWithResolverCallback = function (resolve) {
this.resolve = resolve;
return this;
};
BluetoothManagerDelegate.prototype.centralManagerDidUpdateState = function (central) {
this.resolve(central.state === 5);
};
BluetoothManagerDelegate.ObjCProtocols = [CBCentralManagerDelegate];
return BluetoothManagerDelegate;
}(NSObject));
//# sourceMappingURL=deviceinfo.ios.js.map

@@ -58,2 +58,3 @@ import { Carrier, StorageVolume } from './deviceinfo.interface';

static isBatteryCharging(): boolean;
static isBluetoothEnabled(): Promise<boolean>;
}
{
"name": "nativescript-dna-deviceinfo",
"version": "2.1.3",
"version": "2.2.0",
"description": "NativeScript plugin to acquire device information.",

@@ -70,3 +70,4 @@ "main": "deviceinfo",

"SSID",
"WiFi SSID"
"WiFi SSID",
"Bluetooth"
],

@@ -73,0 +74,0 @@ "author": {

@@ -25,6 +25,7 @@

- 2.0.0: Changed APIs name for storageVolumes & cellularServiceProviders.
- 2.1.0: Added API to get service set identifier(SSID) of a wireless local area network (WLAN).
- 2.1.0: Added an API to get service set identifier(SSID) of a wireless local area network (WLAN).
- 2.1.1: The documentation is updated.
- 2.1.2: Added nativescript-custom-entitlements to dev dependencies to demo app.
- 2.1.3: Adjusted license from Apache-2.0 to MIT.
- 2.1.2: Added the package nativescript-custom-entitlements to dev dependencies to the demo app.
- 2.1.3: Adjusted the license from Apache-2.0 to MIT.
- 2.2.0: Added an API to get a status of Bluetooth.

@@ -325,3 +326,23 @@

### - isBluetoothEnabled
Returns Promise that resolves to 'true' if Bluetooth is enabled, otherwise false.
```javascript
DeviceInfo.isBluetoothEnabled().then(value => console.log(value))
.catch(error => console.log(error));
```
```javascript
async PrintBluetoothStatus() {
const status = await DeviceInfo.isBluetoothEnabled().catch(error => console.log(error));
console.log(status);
}
```
- Note for Android users:
* Permission BLUETOOTH is needed.
## APIs in Action

@@ -354,2 +375,4 @@

console.log("Is battery charing: ", DeviceInfo.isBatteryCharging());
console.log("Is Bluetooth enabled: ", await DeviceInfo.isBluetoothEnabled()
.catch(error => console.log(error)));
}

@@ -356,0 +379,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc