From c869fee472860571ab6ae6ef5a2e5980412a1cdf Mon Sep 17 00:00:00 2001 From: Piotr Kosko Date: Thu, 28 Jul 2016 08:44:47 +0200 Subject: [PATCH] [Notification] Added missing values casting [Bug] Native API expects range of 0-1, but webapi spec defines it with 0-100, additional values casting was needed. [Verification] TCT passrate is 100%. Code below generates notification with "12%" progress bar: tizen.notification.post( new tizen.StatusNotification( "PROGRESS", "Progress Notification", { content:"Progress", progressValue : 12 , progressType : "PERCENTAGE" } ) ); Change-Id: Ib8b5ed9bbc8235071591e93f4dc19b1fa450b557 Signed-off-by: Piotr Kosko --- src/notification/status_notification.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/notification/status_notification.cc b/src/notification/status_notification.cc index 894b4327..9b03933a 100644 --- a/src/notification/status_notification.cc +++ b/src/notification/status_notification.cc @@ -856,6 +856,8 @@ PlatformResult StatusNotification::GetProgressValue( return LogAndCreateResult(ErrorCode::UNKNOWN_ERR, "Get notification progress error"); } + // native api uses range 0-1, but webapi expects 0-100, so we need to multiply result with 100 + tmp_progress_value *= 100; } else { return LogAndCreateResult(ErrorCode::UNKNOWN_ERR, "Unknown notification progress type", @@ -884,7 +886,8 @@ PlatformResult StatusNotification::SetProgressValue( progress_value); } } else if (progress_type == kProgressTypePercentage) { - ret = notification_set_progress(noti_handle, progress_value); + // native api uses range 0-1, but webapi expects 0-100, so we need to divide by 100 + ret = notification_set_progress(noti_handle, progress_value/100); if (is_update) { ret = notification_update_progress(noti_handle, NOTIFICATION_PRIV_ID_NONE, -- 2.34.1