From 8a689f0c67a6116cdd2de80473251425fd7034ed Mon Sep 17 00:00:00 2001 From: Matthew Knight Date: Sat, 11 Apr 2015 15:42:48 +0100 Subject: [PATCH] added ability to retrieve device manufacturer --- platform/platform.android.ts | 9 +++++++++ platform/platform.d.ts | 6 ++++++ platform/platform.ios.ts | 4 ++++ 3 files changed, 19 insertions(+) diff --git a/platform/platform.android.ts b/platform/platform.android.ts index 816dc167f..bb800a486 100644 --- a/platform/platform.android.ts +++ b/platform/platform.android.ts @@ -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; diff --git a/platform/platform.d.ts b/platform/platform.d.ts index 5339070b6..c3a495464 100644 --- a/platform/platform.d.ts +++ b/platform/platform.d.ts @@ -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. diff --git a/platform/platform.ios.ts b/platform/platform.ios.ts index da513f25b..b1d6dac6f 100644 --- a/platform/platform.ios.ts +++ b/platform/platform.ios.ts @@ -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; }