[Service] Routing API - tizen.package 50/238550/1
authorDongHyun Song <dh81.song@samsung.com>
Wed, 15 Jul 2020 02:11:19 +0000 (11:11 +0900)
committerDongHyun Song <dh81.song@samsung.com>
Wed, 15 Jul 2020 02:16:13 +0000 (11:16 +0900)
This patch will support
  PackageInformation getPackageInfo(optional PackageId? id);

This API need below privilege
  http://tizen.org/privilege/package.info

Change-Id: Ie737b1d11912f6c6e7ece05d5cea1a5d89434b16
Signed-off-by: DongHyun Song <dh81.song@samsung.com>
wrt_app/service/device_api_router.ts

index 934f57d..0e534bc 100644 (file)
@@ -4,19 +4,25 @@ export class DeviceAPIRouter {
   currentApplication: any;
   funcCurrentApplication: any;
   funcRequestedAppcontrol: any;
-  funcGetAppinfo: any;
+  funcGetAppInfo: any;
   funcGetAppcerts: any;
   funcGetSharedUri: any;
   funcGetMetadata: any;
+  funcGetPackageInfo: any;
 
   constructor() {
     this.RefineApplicationApis();
+    this.RefinePackageApis();
   }
 
   GetServiceId() {
     return global.webapis.getServiceId();
   }
 
+  GetPackageId() {
+    return global.webapis.getPackageId();
+  }
+
   RefineApplicationApis() {
     // tizen.application.getCurrentApplication()
     this.funcCurrentApplication = global.tizen.application.getCurrentApplication;
@@ -36,12 +42,12 @@ export class DeviceAPIRouter {
       return this.currentApplication;
     }
     // tizen.application.getAppInfo()
-    this.funcGetAppinfo = global.tizen.application.getAppInfo;
+    this.funcGetAppInfo = global.tizen.application.getAppInfo;
     global.tizen.application.getAppInfo = (app_id?: string) => {
       console.log(`getAppInfo()`);
       if (!app_id)
         app_id = this.GetServiceId();
-      return this.funcGetAppinfo(app_id);
+      return this.funcGetAppInfo(app_id);
     }
     // tizen.application.getAppCerts()
     this.funcGetAppcerts = global.tizen.application.getAppCerts;
@@ -68,4 +74,15 @@ export class DeviceAPIRouter {
       return this.funcGetMetadata(app_id);
     }
   }
+
+  RefinePackageApis() {
+    // tizen.package.getPackageInfo()
+    this.funcGetPackageInfo = global.tizen.package.getPackageInfo;
+    global.tizen.package.getPackageInfo = (package_id?: string) => {
+      console.log(`getPackageInfo()`);
+      if (!package_id)
+        package_id = this.GetPackageId();
+      return this.funcGetPackageInfo(package_id);
+    }
+  }
 }
\ No newline at end of file