From: DongHyun Song Date: Wed, 6 Jan 2021 03:32:25 +0000 (+0900) Subject: [Tizen6.5 Migration][Service] Support simple notification popup X-Git-Tag: submit/tizen/20210122.055702~1^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=054d81987df8f183576a9445f5db71f8cc56cb8b;p=platform%2Fframework%2Fweb%2Fwrtjs.git [Tizen6.5 Migration][Service] Support simple notification popup User apps can use this notification posting API by calling webapis.postPlainNotification() - title: string, mandatory - message: string, mandatory - timeout: number, optional (10s default) Actually, this feature is alternative simple solution to show notification popup of tizen.UserNotification webapi. Global notification webapis is not included in TV platform. Related patch: https://review.tizen.org/gerrit/250942/ Change-Id: Ibf51f707be4b1edf3fc50dd94041df38cbdae168 Signed-off-by: DongHyun Song --- diff --git a/wrt_app/service/device_api_router.ts b/wrt_app/service/device_api_router.ts index 7cb70cb3..7f6548fe 100644 --- a/wrt_app/service/device_api_router.ts +++ b/wrt_app/service/device_api_router.ts @@ -37,21 +37,30 @@ export class DeviceAPIRouter { } initWebapis() { - global.webapis = global.webapis ?? {}; + let app_info = global.tizen.application.getAppInfo(this.serviceId); + if (app_info) { + this.packageId = app_info.packageId; + } + global.webapis = global.webapis ?? {}; global.webapis.getCallerAppId = () => { return this.callerAppId; } global.webapis.getServiceId = () => { return this.serviceId; } - let app_info = global.tizen.application.getAppInfo(this.serviceId); - if (app_info) { - this.packageId = app_info.packageId; - } global.webapis.getPackageId = () => { return this.packageId; } + global.webapis.postPlainNotification = (title: string, message: string, timeout?: number) => { + return wrt.postPlainNotification(title, message, timeout ?? 10); + } + Object.defineProperties(global.webapis, { + getCallerAppId: { writable: false, enumerable: true }, + getPackageId: { writable: false, enumerable: true }, + getServiceId: { writable: false, enumerable: true }, + postPlainNotification: { writable: false, enumerable: true }, + }); this.initProductWebapis(); }