From: DongHyun Song Date: Thu, 10 Sep 2020 00:36:51 +0000 (+0900) Subject: [Service][TV] Add TV productinfo webapis X-Git-Tag: submit/tizen/20201005.132203~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=05a663a54e531739ca85dd55ad8cf44811e77d7b;p=platform%2Fframework%2Fweb%2Fwrtjs.git [Service][TV] Add TV productinfo webapis Add webapis.productinfo of TV profile. Related chromium-efl patch: https://review.tizen.org/gerrit/238981/ Change-Id: I1c865e7d0b2f2708f09e4de504a52836585c7090 Signed-off-by: DongHyun Song --- diff --git a/wrt_app/service/device_api_router.ts b/wrt_app/service/device_api_router.ts index b7a6e0f1..42a57f34 100644 --- a/wrt_app/service/device_api_router.ts +++ b/wrt_app/service/device_api_router.ts @@ -50,6 +50,44 @@ export class DeviceAPIRouter { global.webapis.getPackageId = () => { return this.packageId; } + this.initProductWebapis(); + } + + initProductWebapis() { + // for TV profile + if (wrt.tv && !global.webapis.productinfo) { + global.webapis.cachedProperty = global.webapis.cachedProperty ?? {}; + let getCachedValue = (name: string) => { + if (global.webapis.cachedProperty[name]) { + return global.webapis.cachedProperty[name]; + } + let tv = wrt.tv as NativeWRTjs.TVExtension; + return (global.webapis.cachedProperty[name] = tv.queryProductValue(name)); + } + global.webapis.productinfo = { + getDuid: () => { + return getCachedValue('getDuid'); + }, + getFirmware: () => { + return getCachedValue('getFirmware'); + }, + getLocalSet: () => { + return getCachedValue('getLocalSet'); + }, + getModel: () => { + return getCachedValue('getModel'); + }, + getModelCode: () => { + return getCachedValue('getModelCode'); + }, + getRealModel: () => { + return getCachedValue('getRealModel'); + }, + getSmartTVServerVersion: () => { + return getCachedValue('getSmartTVServerVersion'); + } + }; + } } initAccessControlManager() {