mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-15 19:26:42 +08:00
Merge pull request #279 from anarchicknight/platform_module_enhancements
added ability to retrieve device manufacturer
This commit is contained in:
@ -12,6 +12,7 @@ export module platformNames {
|
||||
// It is not meant to be initialized - thus it is not capitalized
|
||||
export class device implements definition.device {
|
||||
private static MIN_TABLET_PIXELS = 600;
|
||||
private static _manufacturer: string;
|
||||
private static _model: string;
|
||||
private static _osVersion: string;
|
||||
private static _sdkVersion: string;
|
||||
@ -22,6 +23,14 @@ export class device implements definition.device {
|
||||
return platformNames.android;
|
||||
}
|
||||
|
||||
static get manufacturer(): string {
|
||||
if (!device._manufacturer) {
|
||||
device._manufacturer = android.os.Build.MANUFACTURER;
|
||||
}
|
||||
|
||||
return device._manufacturer;
|
||||
}
|
||||
|
||||
static get osVersion(): string {
|
||||
if (!device._osVersion) {
|
||||
device._osVersion = android.os.Build.VERSION.RELEASE;
|
||||
|
6
platform/platform.d.ts
vendored
6
platform/platform.d.ts
vendored
@ -16,6 +16,12 @@ declare module "platform" {
|
||||
* An object containing device specific information.
|
||||
*/
|
||||
export class device {
|
||||
/**
|
||||
* Gets the manufacturer of the device.
|
||||
* For example: "Apple" or "HTC" or "Samsung".
|
||||
*/
|
||||
static manufacturer: string;
|
||||
|
||||
/**
|
||||
* Gets the model of the device.
|
||||
* For example: "Nexus 5" or "iPhone".
|
||||
|
@ -15,6 +15,10 @@ export class device implements definition.device {
|
||||
private static _sdkVersion: string;
|
||||
private static _deviceType: string;
|
||||
|
||||
static get manufacturer(): string {
|
||||
return "Apple";
|
||||
}
|
||||
|
||||
static get os(): string {
|
||||
return platformNames.ios;
|
||||
}
|
||||
|
Reference in New Issue
Block a user