Merge pull request #279 from anarchicknight/platform_module_enhancements

added ability to retrieve device manufacturer
This commit is contained in:
dtopuzov
2015-04-14 15:38:30 +03:00
3 changed files with 19 additions and 0 deletions

View File

@ -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;

View File

@ -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".

View File

@ -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;
}