2 * Copyright (c) 2019 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
22 #include "notification-ex/item_info_internal.h"
23 #include "notification-ex/ex_util.h"
29 #define LOG_TAG "NOTIFICATION_EX"
32 namespace notification {
35 AbstractItem::Impl::ItemInfo::ItemInfo(AbstractItem::Impl* impl) : impl_(impl) {
38 uid_t AbstractItem::Impl::ItemInfo::GetUid() const {
42 void AbstractItem::Impl::ItemInfo::SetUid(uid_t uid) {
46 time_t AbstractItem::Impl::ItemInfo::GetTime() const {
50 void AbstractItem::Impl::ItemInfo::SetTime(time_t time) {
54 int AbstractItem::Impl::ItemInfo::GetVersion() const {
55 return impl_->version_;
58 void AbstractItem::Impl::ItemInfo::SetVersion(int ver) {
59 impl_->version_ = ver;
62 void AbstractItem::Impl::ItemInfo::SetHideTime(int hide_time) {
63 impl_->hide_time_ = hide_time;
66 int AbstractItem::Impl::ItemInfo::GetHideTime() const {
67 return impl_->hide_time_;
70 void AbstractItem::Impl::ItemInfo::SetDeleteTime(int delete_time) {
71 impl_->delete_time_ = delete_time;
74 int AbstractItem::Impl::ItemInfo::GetDeleteTime() const {
75 return impl_->delete_time_;
78 void AbstractItem::Impl::ItemInfo::AddHideViewer(std::string appid) {
79 if (find(impl_->hide_viewer_list_.begin(),
80 impl_->hide_viewer_list_.end(), appid) !=
81 impl_->hide_viewer_list_.end()) {
84 impl_->hide_viewer_list_.push_back(appid);
87 bool AbstractItem::Impl::ItemInfo::CanReceive(std::string receiver_group) const {
88 if (impl_->receiver_group_list_.size() != 0 && !receiver_group.empty()) {
89 list<string>::iterator iter =
90 std::find(impl_->receiver_group_list_.begin(),
91 impl_->receiver_group_list_.end(), receiver_group);
93 if (iter == impl_->receiver_group_list_.end())
97 if (impl_->hide_viewer_list_.size() == 0)
100 string app_id = util::GetAppId();
101 list<string>::iterator iter =
102 std::find(impl_->hide_viewer_list_.begin(),
103 impl_->hide_viewer_list_.end(), app_id);
105 if (iter != impl_->hide_viewer_list_.end())
111 std::list<std::string> AbstractItem::Impl::ItemInfo::GetHideViewerList() const {
112 return impl_->hide_viewer_list_;
116 } // namespace notification