[Tizen6.5 Migration][Service] Add getPkgApiVersion for global model 40/249840/4
authorDongHyun Song <dh81.song@samsung.com>
Thu, 17 Dec 2020 05:07:33 +0000 (14:07 +0900)
committerDongHyun Song <dh81.song@samsung.com>
Fri, 15 Jan 2021 05:59:39 +0000 (05:59 +0000)
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.

Reference:
  https://review.tizen.org/gerrit/247389/

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

index 7cb70cb..50f6c99 100644 (file)
@@ -16,6 +16,7 @@ export class DeviceAPIRouter {
   packageId: string;
   callerAppId: string;
   permissions: string[];
+  pkgApiVersion: string;
 
   constructor(id: string, isGlobal: boolean) {
     this.id = id;
@@ -24,10 +25,12 @@ export class DeviceAPIRouter {
     this.callerAppId = ids[1] ?? '';
     this.packageId = this.serviceId.split('.')[0];
     this.permissions = [];
+    this.pkgApiVersion = '';
 
     this.initWebapis();
     if (isGlobal) {
       this.permissions = wrt.getPrivileges(this.id);
+      this.pkgApiVersion = wrt.getPkgApiVersion(this.id);
       this.refineApplicationApis();
       this.refinePackageApis();
       this.refineFilesystemApis()
@@ -276,5 +279,8 @@ export class DeviceAPIRouter {
         throw 'Permission denied';
       }
     }
+    global.xwalk.utils.getPkgApiVersion = () => {
+      return this.pkgApiVersion;
+    }
   }
 }