using namespace Tizen::Shell;
extern "C" int service_create_request(bundle *data, service_h *service);
+extern "C" int service_to_bundle(service_h service, bundle** data);
namespace
{
{
switch (error)
{
- case UI_NOTIFICATION_ERROR_NONE:
+ case NOTIFICATION_ERROR_NONE:
return E_SUCCESS;
- case UI_NOTIFICATION_ERROR_INVALID_PARAMETER:
+ case NOTIFICATION_ERROR_INVALID_DATA:
return E_INVALID_ARG;
- case UI_NOTIFICATION_ERROR_OUT_OF_MEMORY:
+ case NOTIFICATION_ERROR_NO_MEMORY:
return E_OUT_OF_MEMORY;
- case UI_NOTIFICATION_ERROR_DB_FAILED:
+ case NOTIFICATION_ERROR_FROM_DB:
return E_DATABASE;
- case UI_NOTIFICATION_ERROR_NO_SUCH_FILE:
+ case NOTIFICATION_ERROR_ALREADY_EXIST_ID:
return E_OPERATION_FAILED;
- case UI_NOTIFICATION_ERROR_INVALID_STATE:
+ case NOTIFICATION_ERROR_NOT_EXIST_ID:
return E_OPERATION_FAILED;
default:
return E_OPERATION_FAILED;
return length;
}
-ui_notification_progress_type_e
-ConvertToNotificationProgressType(int progressType)
-{
- switch (progressType)
- {
- case ONGOING_ACTIVITY_TYPE_TEXT:
- return UI_NOTIFICATION_PROGRESS_TYPE_PERCENTAGE;
- case ONGOING_ACTIVITY_TYPE_PROGRESS_BYTE:
- return UI_NOTIFICATION_PROGRESS_TYPE_SIZE;
- case ONGOING_ACTIVITY_TYPE_PROGRESS_PERCENTAGE:
- return UI_NOTIFICATION_PROGRESS_TYPE_PERCENTAGE;
- default:
- return UI_NOTIFICATION_PROGRESS_TYPE_PERCENTAGE;
- }
-}
-
bool
IsPosted(ui_notification_h handle)
{
bool isOngoing) const
{
result r = E_SUCCESS;
- int retcode = 0;
char* pMsg = null;
- ui_notification_h core = NULL;
+ notification_h core = NULL;
char* pkgname = NULL;
+ bundle* pKb = NULL;
+ bundle* service_data = NULL;
+ service_h svc = NULL;
+ _AppArg arg;
if (!messageText.IsEmpty())
{
messageText.GetLength() <= GetMessageLength(), E_INVALID_ARG,
"MessageText is greater than MAX_NOTIFICATION_MESSAGE_LENGTH.");
- retcode = ui_notification_create(isOngoing, &core);
- SysTryReturnResult(NID_APP, retcode == UI_NOTIFICATION_ERROR_NONE, E_OPERATION_FAILED, "Notification creation error : 0x%x.", retcode);
+ if (isOngoing)
+ {
+ core = notification_new(NOTIFICATION_TYPE_ONGOING, NOTIFICATION_GROUP_ID_DEFAULT, NOTIFICATION_PRIV_ID_NONE);
+ SysTryReturnResult(NID_APP, core!= NULL , E_SYSTEM, "Notification creation failed ");
+ }
+ else
+ {
+ core = notification_new(NOTIFICATION_TYPE_NOTI, NOTIFICATION_GROUP_ID_DEFAULT, NOTIFICATION_PRIV_ID_NONE);
+ SysTryReturnResult(NID_APP, core!= NULL , E_SYSTEM, "Notification creation failed ");
+ }
pMsg = _StringConverter::CopyToCharArrayN(messageText);
-
- int ret = ui_notification_set_content(core, pMsg);
- SysTryLog(NID_APP, ret == UI_NOTIFICATION_ERROR_NONE, "Setting notification content failure : %d.", ret);
-
- bundle* pKb = NULL;
- service_h svc = NULL;
- _AppArg arg;
+ notification_set_text(core, NOTIFICATION_TEXT_TYPE_CONTENT, pMsg, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
app_get_package(&pkgname);
SysTryCatch(NID_APP, pkgname != NULL, r = E_OBJ_NOT_FOUND, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] Cannot acquire package name for current application.");
pKb = arg.GetBundle();
service_create_request(pKb, &svc);
service_set_package(svc, pkgname);
- ui_notification_set_service(core, svc);
-
- SysLog(NID_APP, "Sending notification[%ls] for package %s.", messageText.GetPointer(), pkgname);
-
- r = ConvertNotificationResult(ui_notification_post(core));
-
+
+ if (service_to_bundle(svc, &service_data) == SERVICE_ERROR_NONE)
+ {
+ notification_set_property(core, 0);
+ notification_set_execute_option(core, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, NULL, service_data);
+ SysLog(NID_APP, "Sending notification[%ls] for package %s.", messageText.GetPointer(), pkgname);
+ }
+
+ r = ConvertNotificationResult(notification_insert(core, NULL));
SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification post failure.", GetErrorMessage(r));
}
if (core)
{
- ui_notification_destroy(core);
+ notification_free(core);
}
return r;
bool isOngoing) const
{
result r = E_SUCCESS;
- int retcode = 0;
char* pMsg = null;
char* pIcon = NULL;
char* pName = NULL;
- ui_notification_h core = NULL;
+ notification_h core = NULL;
char buffer[256];
+ bundle* pKb = NULL;
+ bundle* service_data = NULL;
+ service_h svc = NULL;
+ _AppArg arg;
memset(buffer, 0, 256);
SysTryReturnResult(NID_APP, b == true, E_APP_NOT_INSTALLED, "The application %ls is not installed", appId.GetPointer());
- if (!isOngoing || !messageText.IsEmpty())
+ if (isOngoing || !messageText.IsEmpty())
{
SysTryReturnResult(NID_APP,
messageText.GetLength() <= GetMessageLength(), E_INVALID_ARG,
"MessageText is greater than MAX_NOTIFICATION_MESSAGE_LENGTH.");
- retcode = ui_notification_create(isOngoing, &core);
- SysTryReturnResult(NID_APP, retcode == UI_NOTIFICATION_ERROR_NONE, E_OPERATION_FAILED, "Notification creation error : 0x%x.", retcode);
+ if (isOngoing)
+ {
+ core = notification_new(NOTIFICATION_TYPE_ONGOING, NOTIFICATION_GROUP_ID_DEFAULT, NOTIFICATION_PRIV_ID_NONE);
+ SysTryReturnResult(NID_APP, core!= NULL , E_SYSTEM, "Notification creation failed ");
+ }
+ else
+ {
+ core = notification_new(NOTIFICATION_TYPE_NOTI, NOTIFICATION_GROUP_ID_DEFAULT, NOTIFICATION_PRIV_ID_NONE);
+ SysTryReturnResult(NID_APP, core!= NULL , E_SYSTEM, "Notification creation failed ");
+ }
pMsg = _StringConverter::CopyToCharArrayN(messageText);
-
- int ret = ui_notification_set_content(core, pMsg);
- SysTryLog(NID_APP, ret == UI_NOTIFICATION_ERROR_NONE, "Setting notification content failure : %d.", ret);
-
- bundle* pKb = NULL;
- service_h svc = NULL;
- _AppArg arg;
+ notification_set_text(core, NOTIFICATION_TEXT_TYPE_CONTENT, pMsg, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
snprintf(buffer, 256, "%ls", appId.GetPointer());
app_manager_get_app_icon_path(buffer, &pIcon);
- ui_notification_set_icon(core, pIcon);
+ notification_set_image(core, NOTIFICATION_IMAGE_TYPE_ICON, pIcon);
app_manager_get_app_name(buffer, &pName);
- ui_notification_set_title(core, pName);
+ notification_set_text(core, NOTIFICATION_TEXT_TYPE_TITLE, pName, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
r = arg.Construct(launchArguments);
SysTryCatch(NID_APP, !IsFailed(r), , r, "[%s] Propagating.", GetErrorMessage(r));
pKb = arg.GetBundle();
service_create_request(pKb, &svc);
service_set_app_id(svc, buffer);
- ui_notification_set_service(core, svc);
-
- SysLog(NID_APP, "Sending notification[%ls] for package %s.", messageText.GetPointer(), buffer);
-
- r = ConvertNotificationResult(ui_notification_post(core));
-
+
+ if (service_to_bundle(svc, &service_data) == SERVICE_ERROR_NONE)
+ {
+ notification_set_property(core, 0);
+ notification_set_execute_option(core, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, NULL, service_data);
+ SysLog(NID_APP, "Sending notification[%ls] for package %s.", messageText.GetPointer(), buffer);
+ }
+
+ r = ConvertNotificationResult(notification_insert(core,NULL));
SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification post failure.", GetErrorMessage(r));
}
if (core)
{
- ui_notification_destroy(core);
+ notification_free(core);
}
if (pIcon)
_NotificationManagerImpl::NotifyMessageImpl(const NotificationRequest& notiMessage, bool isOngoing)
{
result r = E_SUCCESS;
- int retcode = 0;
int progress = -1;
- ui_notification_h core = NULL;
+ notification_h core = NULL;
char* pkgname = NULL;
char* pTitleText = NULL;
char* pIconPath = NULL;
char* pSoundPath = NULL;
+ bundle* pKb = NULL;
+ bundle* service_data = NULL;
+ service_h svc = NULL;
+ _AppArg arg;
const String& messageText = notiMessage.GetAlertText();
const String& launchArguments = notiMessage.GetAppMessage();
messageText.GetLength() <= GetMessageLength(), E_INVALID_ARG,
"MessageText is greater than MAX_NOTIFICATION_MESSAGE_LENGTH.");
- retcode = ui_notification_create(isOngoing, &core);
- SysTryReturnResult(NID_APP, retcode == UI_NOTIFICATION_ERROR_NONE, E_OPERATION_FAILED, "Notification creation error : 0x%x.", retcode);
+ if (isOngoing)
+ {
+ core = notification_new(NOTIFICATION_TYPE_ONGOING, NOTIFICATION_GROUP_ID_DEFAULT, NOTIFICATION_PRIV_ID_NONE);
+ SysTryReturnResult(NID_APP, core!= NULL , E_SYSTEM, "Notification creation failed ");
+ }
+ else
+ {
+ core = notification_new(NOTIFICATION_TYPE_NOTI, NOTIFICATION_GROUP_ID_DEFAULT, NOTIFICATION_PRIV_ID_NONE);
+ SysTryReturnResult(NID_APP, core!= NULL , E_SYSTEM, "Notification creation failed ");
+ }
std::unique_ptr<char[]> pMsg(_StringConverter::CopyToCharArrayN(messageText));
if (pMsg)
{
- int ret = ui_notification_set_content(core, pMsg.get());
- SysTryLog(NID_APP, ret == UI_NOTIFICATION_ERROR_NONE, "Setting notification content failure : %d.", ret);
+ notification_set_text(core, NOTIFICATION_TEXT_TYPE_CONTENT, pMsg.get(), NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
}
if (!titleText.IsEmpty())
{
pTitleText = _StringConverter::CopyToCharArrayN(titleText);
- ui_notification_set_title(core, pTitleText);
+ notification_set_text(core, NOTIFICATION_TEXT_TYPE_TITLE, pTitleText, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
}
if (!iconPath.IsEmpty())
{
pIconPath = _StringConverter::CopyToCharArrayN(iconPath);
- ui_notification_set_icon(core, pIconPath);
+ notification_set_image(core, NOTIFICATION_IMAGE_TYPE_ICON, pIconPath);
}
if (!soundPath.IsEmpty())
{
pSoundPath = _StringConverter::CopyToCharArrayN(soundPath);
- ui_notification_set_sound(core, pSoundPath);
+ notification_set_sound(core, NOTIFICATION_SOUND_TYPE_USER_DATA, pSoundPath);
}
- bundle* pKb = NULL;
- service_h svc = NULL;
- _AppArg arg;
-
app_get_id(&pkgname);
SysTryCatch(NID_APP, pkgname != NULL, r = E_OBJ_NOT_FOUND, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] Cannot acquire package name for current application.");
service_create_request(pKb, &svc);
service_set_app_id(svc, pkgname);
- ui_notification_set_service(core, svc);
- SysLog(NID_APP, "Sending notification[%ls] for package %s.", messageText.GetPointer(), pkgname);
+ if (service_to_bundle(svc, &service_data) == SERVICE_ERROR_NONE)
+ {
+ notification_set_property(core, 0);
+ notification_set_execute_option(core, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, NULL, service_data);
+ SysLog(NID_APP, "Sending notification[%ls] for package %s.", messageText.GetPointer(), pkgname);
+ }
if (isOngoing)
{
switch (activityType)
{
case ONGOING_ACTIVITY_TYPE_PROGRESS_PERCENTAGE:
- if (!IsPosted(core))
- {
- ui_notification_post(core);
- }
- r = ConvertNotificationResult(ui_notification_update_progress(core, ConvertToNotificationProgressType(activityType), progress/100.));
+ r = ConvertNotificationResult(notification_insert(core,NULL));
+ SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification post failure.", GetErrorMessage(r));
+ r = ConvertNotificationResult(notification_update_progress(core, NOTIFICATION_PRIV_ID_NONE, progress/100.));
+ SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification update failure.", GetErrorMessage(r));
break;
case ONGOING_ACTIVITY_TYPE_PROGRESS_BYTE:
- if (!IsPosted(core))
- {
- ui_notification_post(core);
- }
- r = ConvertNotificationResult(ui_notification_update_progress(core, ConvertToNotificationProgressType(activityType), progress));
+ r = ConvertNotificationResult(notification_insert(core,NULL));
+ SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification post failure.", GetErrorMessage(r));
+ r = ConvertNotificationResult(notification_update_size(core, NOTIFICATION_PRIV_ID_NONE, progress));
+ SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification update failure.", GetErrorMessage(r));
break;
case ONGOING_ACTIVITY_TYPE_TEXT:
- r = ConvertNotificationResult(ui_notification_post(core));
+ r = ConvertNotificationResult(notification_insert(core,NULL));
+ SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification post failure.", GetErrorMessage(r));
break;
default:
r = E_OPERATION_FAILED;
}
else
{
- r = ConvertNotificationResult(ui_notification_post(core));
+ r = ConvertNotificationResult(notification_insert(core,NULL));
SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification post failure.", GetErrorMessage(r));
}
}
}
if (core)
{
- ui_notification_destroy(core);
+ notification_free(core);
}
return r;