Use MainNone type to clear item's main type 10/218610/4
authorhyunho <hhstark.kang@samsung.com>
Tue, 26 Nov 2019 05:00:01 +0000 (14:00 +0900)
committerHyunho Kang <hhstark.kang@samsung.com>
Thu, 28 Nov 2019 10:25:02 +0000 (10:25 +0000)
Change-Id: I881b333dd532d53907e7350ffa88cdc8bc81d84e
Signed-off-by: hyunho <hhstark.kang@samsung.com>
notification-ex/abstract_item.cc

index ee01a4e..ccb1778 100644 (file)
@@ -589,6 +589,8 @@ bool AbstractItem::Impl::IsValidMainType(AbstractItem& target, MainType type) {
   int item_type = target.GetType();
 
   switch (type) {
+    case MainNone:
+      return true;
     case MainTitle:
     case MainContents:
       if (item_type != Text)
@@ -613,6 +615,13 @@ bool AbstractItem::SetMainType(std::string target_id, MainType type) {
   AbstractItem& target = FindByID(target_id);
   if (target.GetType() == NullObject)
     return false;
+
+  if (type == MainNone) {
+    LOGW("Clear main type from %s", target_id.c_str());
+    target.impl_->main_type_ = MainNone;
+    return true;
+  }
+
   if (!impl_->IsValidMainType(target, type)) {
     LOGE("Main type and item type are not matched (%d, %d)",
         type, target.GetType());