Add noti_ex_manager_delete_by_appid 85/227685/2
authormk5004.lee <mk5004.lee@samsung.com>
Fri, 13 Mar 2020 08:59:32 +0000 (17:59 +0900)
committermk5004.lee <mk5004.lee@samsung.com>
Mon, 16 Mar 2020 01:57:58 +0000 (10:57 +0900)
Change-Id: Ia2350fe58a808605c7bca41ea1299ab8d7d6fd58
Signed-off-by: mk5004.lee <mk5004.lee@samsung.com>
notification-ex/api/notification_ex_internal.h [changed mode: 0644->0755]
notification-ex/manager.cc
notification-ex/manager.h
notification-ex/stub.cc

old mode 100644 (file)
new mode 100755 (executable)
index 5d199e5..52ad052
@@ -40,18 +40,20 @@ int noti_ex_item_icon_create(noti_ex_item_h *handle, const char *id,
                const char *icon_path);
 int noti_ex_item_icon_get_icon_path(noti_ex_item_h handle, char **icon_path);
 
-int noti_ex_item_button_set_image(noti_ex_item_h handle, char *path);
+int noti_ex_item_button_set_image(noti_ex_item_h handle, const char *path);
 int noti_ex_item_button_get_image(noti_ex_item_h handle, char **path);
 
 int noti_ex_reporter_find_by_channel(noti_ex_reporter_h handle,
                const char *channel, noti_ex_item_h **noti_list, int *count);
 int noti_ex_reporter_find_all(noti_ex_reporter_h handle,
                noti_ex_item_h **noti_list, int *count);
-int noti_ex_reporter_delete_by_channel(noti_ex_reporter_h handle, char *channel,
-               int *request_id);
+int noti_ex_reporter_delete_by_channel(noti_ex_reporter_h handle,
+               const char *channel, int *request_id);
 
-int noti_ex_manager_delete_by_channel(noti_ex_manager_h handle, char *channel,
-               int *request_id);
+int noti_ex_manager_delete_by_channel(noti_ex_manager_h handle,
+               const char *channel, int *request_id);
+int noti_ex_manager_delete_by_appid(noti_ex_manager_h handle,
+               const char *app_id, int *request_id);
 
 #ifdef __cplusplus
 }
index 29ea066..36fd034 100644 (file)
@@ -114,6 +114,14 @@ int Manager::DeleteByChannel(string channel) {
   return info.GetRequestId();
 }
 
+int Manager::DeleteByAppId(string appId) {
+  Bundle serialized;
+  EventInfo info(EventInfo::DeleteAll, util::GetAppId(), "", appId);
+  list<Bundle> serialized_list {serialized};
+  impl_->sender_->Notify(info, serialized_list, util::GetAppId());
+  return info.GetRequestId();
+}
+
 int Manager::GetCount() const {
   EventInfo info(EventInfo::Count, util::GetAppId(), "");
   int num = impl_->sender_->RequestNumber(info);
index a663308..f4d3cdf 100644 (file)
@@ -44,6 +44,7 @@ class EXPORT_API Manager : public IEventObserver {
   int Delete(std::shared_ptr<item::AbstractItem> noti);
   int DeleteAll();
   int DeleteByChannel(std::string channel);
+  int DeleteByAppId(std::string appId);
   int Hide(std::shared_ptr<item::AbstractItem> noti);
   std::unique_ptr<item::AbstractItem> FindByRootID(std::string id);
   int SendEvent(const IEventInfo& info, std::shared_ptr<item::AbstractItem> noti);
index 0478bc3..41269c3 100644 (file)
@@ -433,7 +433,7 @@ extern "C" EXPORT_API int noti_ex_item_button_set_multi_language_title(
 }
 
 extern "C" EXPORT_API int noti_ex_item_button_set_image(
-    noti_ex_item_h handle, char *path) {
+    noti_ex_item_h handle, const char *path) {
   if (handle == nullptr || path == nullptr) {
     LOGE("Invalid parameter");
     return NOTI_EX_ERROR_INVALID_PARAMETER;
@@ -2724,7 +2724,7 @@ extern "C" EXPORT_API int noti_ex_manager_delete_all(noti_ex_manager_h handle,
 }
 
 extern "C" EXPORT_API int noti_ex_manager_delete_by_channel(
-    noti_ex_manager_h handle, char* channel, int* request_id) {
+    noti_ex_manager_h handle, const char* channel, int* request_id) {
   if (handle == nullptr || channel == nullptr || request_id == nullptr) {
     LOGE("Invalid parameter");
     return NOTI_EX_ERROR_INVALID_PARAMETER;
@@ -2741,6 +2741,24 @@ extern "C" EXPORT_API int noti_ex_manager_delete_by_channel(
   return NOTI_EX_ERROR_NONE;
 }
 
+extern "C" EXPORT_API int noti_ex_manager_delete_by_appid(
+    noti_ex_manager_h handle, const char* app_id, int* request_id) {
+  if (handle == nullptr || app_id == nullptr || request_id == nullptr) {
+    LOGE("Invalid parameter");
+    return NOTI_EX_ERROR_INVALID_PARAMETER;
+  }
+
+  try {
+    ManagerStub* stub = static_cast<ManagerStub*>(handle);
+    *request_id = stub->DeleteByAppId(app_id);
+  } catch (Exception &ex) {
+    LOGE("%s %d", ex.what(), ex.GetErrorCode());
+    return NOTI_EX_ERROR_IO_ERROR;
+  }
+
+  return NOTI_EX_ERROR_NONE;
+}
+
 extern "C" EXPORT_API int noti_ex_manager_hide(noti_ex_manager_h handle,
     noti_ex_item_h noti, int *request_id) {
   if (handle == nullptr || noti == nullptr || request_id == nullptr) {
@@ -3107,7 +3125,7 @@ extern "C" EXPORT_API int noti_ex_reporter_delete_all(
 }
 
 extern "C" EXPORT_API int noti_ex_reporter_delete_by_channel(
-    noti_ex_reporter_h handle, char* channel, int* request_id) {
+    noti_ex_reporter_h handle, const char* channel, int* request_id) {
   if (handle == nullptr || channel == nullptr || request_id == nullptr) {
     LOGE("Invalid parameter");
     return NOTI_EX_ERROR_INVALID_PARAMETER;