1 import { wrt } from '../browser/wrt';
3 export class DeviceAPIRouter {
4 currentApplication: any;
5 funcCurrentApplication: any;
6 funcRequestedAppcontrol: any;
13 this.RefineApplicationApis();
17 return global.webapis.getServiceId();
20 RefineApplicationApis() {
21 // tizen.application.getCurrentApplication()
22 this.funcCurrentApplication = global.tizen.application.getCurrentApplication;
23 global.tizen.application.getCurrentApplication = () => {
24 console.log(`getCurrentApplication() : ${this.GetServiceId()}`);
25 if (this.currentApplication)
26 return this.currentApplication;
27 this.currentApplication = this.funcCurrentApplication();
28 // tizen.application.getCurrentApplication().getRequestedAppControl()
29 this.funcRequestedAppcontrol = this.currentApplication.getRequestedAppControl;
30 this.currentApplication.getRequestedAppControl = () => {
31 console.log(`getRequestedAppControl() : ${this.GetServiceId()}`);
33 wrt.tv.setCurrentApplication(this.GetServiceId());
34 return this.funcRequestedAppcontrol();
36 return this.currentApplication;
38 // tizen.application.getAppInfo()
39 this.funcGetAppinfo = global.tizen.application.getAppInfo;
40 global.tizen.application.getAppInfo = (app_id?: string) => {
41 console.log(`getAppInfo()`);
43 app_id = this.GetServiceId();
44 return this.funcGetAppinfo(app_id);
46 // tizen.application.getAppCerts()
47 this.funcGetAppcerts = global.tizen.application.getAppCerts;
48 global.tizen.application.getAppCerts = (app_id?: string) => {
49 console.log(`getAppCerts()`);
51 app_id = this.GetServiceId();
52 return this.funcGetAppcerts(app_id);
54 // tizen.application.getAppSharedURI()
55 this.funcGetSharedUri = global.tizen.application.getAppSharedURI;
56 global.tizen.application.getAppSharedURI = (app_id?: string) => {
57 console.log(`getAppSharedURI()`);
59 app_id = this.GetServiceId();
60 return this.funcGetSharedUri(app_id);
62 // tizen.application.getAppMetaData()
63 this.funcGetMetadata = global.tizen.application.getAppMetaData;
64 global.tizen.application.getAppMetaData = (app_id?: string) => {
65 console.log(`getAppMetaData()`);
67 app_id = this.GetServiceId();
68 return this.funcGetMetadata(app_id);