New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.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 1.0.1 to 1.1.0

2

deviceinfo.android.d.ts

@@ -18,5 +18,7 @@ export declare function staticDecorator<T>(): (constructor: T) => void;

static systemManufacturer(): string;
static batteryLevel(): number;
static isTablet(): boolean;
static is24Hour(): boolean;
static isEmulator(): boolean;
static isBatteryCharging(): boolean;
private static memoryInfo;

@@ -23,0 +25,0 @@ private static totalSpace;

@@ -100,2 +100,11 @@ "use strict";

};
DeviceInfo.batteryLevel = function () {
var BM = android.os.BatteryManager;
var iFilter = new android.content.IntentFilter(android.content.Intent.ACTION_BATTERY_CHANGED);
var ctx = application_1.android.context;
var batteryStatus = ctx.registerReceiver(null, iFilter);
var level = batteryStatus.getIntExtra(BM.EXTRA_LEVEL, -1);
var scale = batteryStatus.getIntExtra(BM.EXTRA_SCALE, -1);
return (level * 100) / scale;
};
DeviceInfo.isTablet = function () {

@@ -128,2 +137,10 @@ var Configuration = android.content.res.Configuration;

};
DeviceInfo.isBatteryCharging = function () {
var BM = android.os.BatteryManager;
var iFilter = new android.content.IntentFilter(android.content.Intent.ACTION_BATTERY_CHANGED);
var ctx = application_1.android.context;
var batteryStatus = ctx.registerReceiver(null, iFilter);
var chargingStatus = batteryStatus.getIntExtra(BM.EXTRA_STATUS, -1);
return chargingStatus === BM.BATTERY_STATUS_CHARGING;
};
DeviceInfo.memoryInfo = function () {

@@ -130,0 +147,0 @@ var actMgr = (application_1.getNativeApplication()

@@ -17,5 +17,7 @@ export interface DeviceInfoInterface {

systemManufacturer(): string;
batteryLevel(): number;
isTablet(): boolean;
is24Hour(): boolean;
isEmulator(): boolean;
isBatteryCharging(): boolean;
}

@@ -19,6 +19,8 @@ export declare function staticDecorator<T>(): (constructor: T) => void;

static systemManufacturer(): string;
static batteryLevel(): number;
static isTablet(): boolean;
static is24Hour(): boolean;
static isEmulator(): boolean;
static isBatteryCharging(): boolean;
private static fileSystemAttributes;
}

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

};
DeviceInfo.batteryLevel = function () {
UIDevice.currentDevice.batteryMonitoringEnabled = true;
var level = UIDevice.currentDevice.batteryLevel * 100;
UIDevice.currentDevice.batteryMonitoringEnabled = false;
return level;
};
DeviceInfo.isTablet = function () {

@@ -122,2 +128,8 @@ return UIDevice.currentDevice.userInterfaceIdiom === 1;

};
DeviceInfo.isBatteryCharging = function () {
UIDevice.currentDevice.batteryMonitoringEnabled = true;
var batteryStatus = UIDevice.currentDevice.batteryState;
UIDevice.currentDevice.batteryMonitoringEnabled = false;
return batteryStatus === 2;
};
DeviceInfo.fileSystemAttributes = function () {

@@ -124,0 +136,0 @@ var path = NSSearchPathForDirectoriesInDomains(9, 1, true);

@@ -18,5 +18,7 @@ export declare function staticDecorator<T>(): (constructor: T) => void;

static systemManufacturer(): string;
static batteryLevel(): number;
static isTablet(): boolean;
static is24Hour(): boolean;
static isEmulator(): boolean;
static isBatteryCharging(): boolean;
}

6

package.json
{
"name": "nativescript-dna-deviceinfo",
"version": "1.0.1",
"version": "1.1.0",
"description": "NativeScript plugin to acquire device information.",

@@ -48,3 +48,5 @@ "main": "deviceinfo",

"Locale",
"CPU"
"CPU",
"Battery",
"Charging"
],

@@ -51,0 +53,0 @@ "author": {

@@ -101,2 +101,6 @@

### - batteryLevel
Returns the current battery charge level of the device.
### - isTablet

@@ -114,3 +118,7 @@

### - isBatteryCharging
Returns 'true' if the device is plugged in and charging, otherwise 'false'.
## APIs in Action

@@ -153,4 +161,10 @@

## Changelogs:
- 1.0.0: First release
- 1.0.1: Minor document correction
- 1.1.0: New APIs related to battery charging status and its charge level.
## License
MIT license (see LICENSE file)
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