From: DongHyun Song Date: Mon, 20 Jul 2020 04:53:54 +0000 (+0900) Subject: [Service] Routing API - tizen.filesystem X-Git-Tag: submit/tizen/20200723.045512~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=011e55bb2b92a60151e47043f185bd047e2a5e84;p=platform%2Fframework%2Fweb%2Fwrtjs.git [Service] Routing API - tizen.filesystem This patch will support resolve(DOMString location, FileSuccessCallback onsuccess, optional ErrorCallback? onerror, optional FileMode? mode); Related chromium-efl patch: https://review.tizen.org/gerrit/238885 wrt.resolveVirtualRoot() must be released first. Change-Id: I5d3cbc8d9267032bf8ee421ade0d9930111c7eea Signed-off-by: DongHyun Song --- diff --git a/wrt_app/service/device_api_router.ts b/wrt_app/service/device_api_router.ts index 0e534bc4..e7f66c8b 100644 --- a/wrt_app/service/device_api_router.ts +++ b/wrt_app/service/device_api_router.ts @@ -9,10 +9,12 @@ export class DeviceAPIRouter { funcGetSharedUri: any; funcGetMetadata: any; funcGetPackageInfo: any; + funcPathResolve: any; constructor() { this.RefineApplicationApis(); this.RefinePackageApis(); + this.RefineFilesystemApis() } GetServiceId() { @@ -27,14 +29,14 @@ export class DeviceAPIRouter { // tizen.application.getCurrentApplication() this.funcCurrentApplication = global.tizen.application.getCurrentApplication; global.tizen.application.getCurrentApplication = () => { - console.log(`getCurrentApplication() : ${this.GetServiceId()}`); + console.log(`Routing - getCurrentApplication() : ${this.GetServiceId()}`); if (this.currentApplication) return this.currentApplication; this.currentApplication = this.funcCurrentApplication(); // tizen.application.getCurrentApplication().getRequestedAppControl() this.funcRequestedAppcontrol = this.currentApplication.getRequestedAppControl; this.currentApplication.getRequestedAppControl = () => { - console.log(`getRequestedAppControl() : ${this.GetServiceId()}`); + console.log(`Routing - getRequestedAppControl() : ${this.GetServiceId()}`); if (wrt.tv) wrt.tv.setCurrentApplication(this.GetServiceId()); return this.funcRequestedAppcontrol(); @@ -44,7 +46,7 @@ export class DeviceAPIRouter { // tizen.application.getAppInfo() this.funcGetAppInfo = global.tizen.application.getAppInfo; global.tizen.application.getAppInfo = (app_id?: string) => { - console.log(`getAppInfo()`); + console.log(`Routing - getAppInfo()`); if (!app_id) app_id = this.GetServiceId(); return this.funcGetAppInfo(app_id); @@ -52,7 +54,7 @@ export class DeviceAPIRouter { // tizen.application.getAppCerts() this.funcGetAppcerts = global.tizen.application.getAppCerts; global.tizen.application.getAppCerts = (app_id?: string) => { - console.log(`getAppCerts()`); + console.log(`Routing - getAppCerts()`); if (!app_id) app_id = this.GetServiceId(); return this.funcGetAppcerts(app_id); @@ -60,7 +62,7 @@ export class DeviceAPIRouter { // tizen.application.getAppSharedURI() this.funcGetSharedUri = global.tizen.application.getAppSharedURI; global.tizen.application.getAppSharedURI = (app_id?: string) => { - console.log(`getAppSharedURI()`); + console.log(`Routing - getAppSharedURI()`); if (!app_id) app_id = this.GetServiceId(); return this.funcGetSharedUri(app_id); @@ -68,7 +70,7 @@ export class DeviceAPIRouter { // tizen.application.getAppMetaData() this.funcGetMetadata = global.tizen.application.getAppMetaData; global.tizen.application.getAppMetaData = (app_id?: string) => { - console.log(`getAppMetaData()`); + console.log(`Routing - getAppMetaData()`); if (!app_id) app_id = this.GetServiceId(); return this.funcGetMetadata(app_id); @@ -79,10 +81,22 @@ export class DeviceAPIRouter { // tizen.package.getPackageInfo() this.funcGetPackageInfo = global.tizen.package.getPackageInfo; global.tizen.package.getPackageInfo = (package_id?: string) => { - console.log(`getPackageInfo()`); + console.log(`Routing - getPackageInfo()`); if (!package_id) package_id = this.GetPackageId(); return this.funcGetPackageInfo(package_id); } } + + RefineFilesystemApis() { + // tizen.filesystem.resolve + this.funcPathResolve = global.tizen.filesystem.resolve; + global.tizen.filesystem.resolve = (location: string, onSuccess: Function, + onError?: Function, mode?: string) => { + console.log(`Routing - resolve(${location})`); + let service_id = this.GetServiceId(); + location = wrt.resolveVirtualRoot(service_id, location); + this.funcPathResolve(location, onSuccess, onError, mode); + } + } } \ No newline at end of file