[Service] Add getPkgApiVersion for global model 89/247389/6
authorDongHyun Song <dh81.song@samsung.com>
Thu, 17 Dec 2020 05:05:07 +0000 (14:05 +0900)
committerDongHyun Song <dh81.song@samsung.com>
Thu, 17 Dec 2020 05:05:28 +0000 (14:05 +0900)
xwalk.utils.getPkgApiVersion will return required_version of
config.xml. (a.k.a. api version)
This getPkgApiVersion() is used to check api privileges which is
allowed in Tizen platform version.

Without this patch, getPkgApiVersion() will returns wrt-service
package's api version in its manifest.

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

index e188d99ee2925f56228adf8ebfd37abaae3838b1..f74f15eb0bcff05487d4f39e8c225d8657487ce4 100644 (file)
@@ -16,6 +16,7 @@ export class DeviceAPIRouter {
   packageId: string;
   callerAppId: string;
   permissions: string[];
+  pkgApiVersion: string;
   smackMap: any;
 
   constructor(id: string, isGlobal: boolean) {
@@ -25,12 +26,14 @@ export class DeviceAPIRouter {
     this.callerAppId = ids[1] ?? '';
     this.packageId = this.serviceId.split('.')[0];
     this.permissions = [];
+    this.pkgApiVersion = '';
     this.smackMap = {};
 
     this.initWebapis();
     this.permissions = wrt.getPrivileges(this.id);
     this.refineResolveFilename();
     if (isGlobal) {
+      this.pkgApiVersion = wrt.getPkgApiVersion(this.id);
       this.refineApplicationApis();
       this.refinePackageApis();
       this.refineFilesystemApis()
@@ -369,5 +372,8 @@ export class DeviceAPIRouter {
         throw 'Permission denied';
       }
     }
+    global.xwalk.utils.getPkgApiVersion = () => {
+      return this.pkgApiVersion;
+    }
   }
 }