Add hide list implementation 30/202030/2
authorjusung son <jusung07.son@samsung.com>
Fri, 22 Mar 2019 04:39:04 +0000 (13:39 +0900)
committerHyunho Kang <hhstark.kang@samsung.com>
Fri, 22 Mar 2019 06:47:06 +0000 (06:47 +0000)
Change-Id: I06b728df7192d7c5bbed8a5c9c4a6f668536ee1e
Signed-off-by: jusung son <jusung07.son@samsung.com>
notification-ex/abstract_item.cc
notification-ex/manager.cc

index 4944bb5003157c2c4621a624f67605cfa57c2e37..cccdfe52ca3ac7a0d941f81c5c76c34d2948362f 100644 (file)
@@ -366,12 +366,27 @@ list<string> AbstractItem::GetReceiverList() {
 }
 
 bool AbstractItem::CanReceive(std::string id) const {
-  if (impl_->receiver_group_list_.size() == 0 || id.empty())
+  if (impl_->receiver_group_list_.size() != 0 && !id.empty()) {
+    list<string>::iterator iter =
+      std::find(impl_->receiver_group_list_.begin(),
+        impl_->receiver_group_list_.end(), id);
+
+    if (iter != impl_->receiver_group_list_.end())
+      return false;
+  }
+
+  if (impl_->hide_viewer_list_.size() == 0)
     return true;
+
+  string app_id = util::GetAppId();
   list<string>::iterator iter =
-    std::find(impl_->receiver_group_list_.begin(),
-      impl_->receiver_group_list_.end(), id);
-  return !(iter == impl_->receiver_group_list_.end());
+    std::find(impl_->hide_viewer_list_.begin(),
+    impl_->hide_viewer_list_.end(), app_id);
+
+  if (iter != impl_->hide_viewer_list_.end())
+    return false;
+
+  return true;
 }
 
 void AbstractItem::SetPolicy(AbstractItem::Policy policy) {
index a3be6870aa50fdac0a90c94b83aa1a13e41f5830..f1abd0a1fffd76ab8b719565a33f0e18b3fa43ff 100644 (file)
@@ -128,7 +128,8 @@ list<Bundle> Manager::OnRequest(const IEventInfo& info) {
   list<shared_ptr<item::AbstractItem>> item_list = OnRequestEvent(info);
   list<Bundle> serialized_list;
   for (auto& i : item_list) {
-    serialized_list.push_back(i->Serialize());
+    if (i->CanReceive(impl_->receiver_group_))
+      serialized_list.push_back(i->Serialize());
   }
   return serialized_list;
 }