summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormk5004.lee <mk5004.lee@samsung.com>2020-03-13 17:59:32 +0900
committermk5004.lee <mk5004.lee@samsung.com>2020-03-16 10:57:58 +0900
commitf615dd925e7c457337e9e3fed94d63c1820b5f50 (patch)
tree9bb98418a4f422bed151ac026df84161df0b0497
parent3618f838d753da1c64d46a0c720d5774082197d4 (diff)
downloadnotification-f615dd925e7c457337e9e3fed94d63c1820b5f50.tar.gz
notification-f615dd925e7c457337e9e3fed94d63c1820b5f50.tar.bz2
notification-f615dd925e7c457337e9e3fed94d63c1820b5f50.zip
Add noti_ex_manager_delete_by_appid
Change-Id: Ia2350fe58a808605c7bca41ea1299ab8d7d6fd58 Signed-off-by: mk5004.lee <mk5004.lee@samsung.com>
-rwxr-xr-x[-rw-r--r--]notification-ex/api/notification_ex_internal.h12
-rw-r--r--notification-ex/manager.cc8
-rw-r--r--notification-ex/manager.h1
-rw-r--r--notification-ex/stub.cc24
4 files changed, 37 insertions, 8 deletions
diff --git a/notification-ex/api/notification_ex_internal.h b/notification-ex/api/notification_ex_internal.h
index 5d199e5..52ad052 100644..100755
--- a/notification-ex/api/notification_ex_internal.h
+++ b/notification-ex/api/notification_ex_internal.h
@@ -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
}
diff --git a/notification-ex/manager.cc b/notification-ex/manager.cc
index 29ea066..36fd034 100644
--- a/notification-ex/manager.cc
+++ b/notification-ex/manager.cc
@@ -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);
diff --git a/notification-ex/manager.h b/notification-ex/manager.h
index a663308..f4d3cdf 100644
--- a/notification-ex/manager.h
+++ b/notification-ex/manager.h
@@ -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);
diff --git a/notification-ex/stub.cc b/notification-ex/stub.cc
index 0478bc3..41269c3 100644
--- a/notification-ex/stub.cc
+++ b/notification-ex/stub.cc
@@ -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;