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 int64_t AbstractItem::Impl::ItemInfo::GetPrivateId() const {
39 return impl_->private_id_;
42 void AbstractItem::Impl::ItemInfo::SetPrivateId(int64_t private_id) {
43 impl_->private_id_ = private_id;
46 uid_t AbstractItem::Impl::ItemInfo::GetUid() const {
50 void AbstractItem::Impl::ItemInfo::SetUid(uid_t uid) {
54 time_t AbstractItem::Impl::ItemInfo::GetTime() const {
58 void AbstractItem::Impl::ItemInfo::SetTime(time_t time) {
62 int AbstractItem::Impl::ItemInfo::GetVersion() const {
63 return impl_->version_;
66 void AbstractItem::Impl::ItemInfo::SetVersion(int ver) {
67 impl_->version_ = ver;
70 void AbstractItem::Impl::ItemInfo::SetHideTime(int hide_time) {
71 impl_->hide_time_ = hide_time;
74 int AbstractItem::Impl::ItemInfo::GetHideTime() const {
75 return impl_->hide_time_;
78 void AbstractItem::Impl::ItemInfo::SetDeleteTime(int delete_time) {
79 impl_->delete_time_ = delete_time;
82 int AbstractItem::Impl::ItemInfo::GetDeleteTime() const {
83 return impl_->delete_time_;
86 void AbstractItem::Impl::ItemInfo::AddHideViewer(std::string appid) {
87 if (find(impl_->hide_viewer_list_.begin(),
88 impl_->hide_viewer_list_.end(), appid) !=
89 impl_->hide_viewer_list_.end()) {
92 impl_->hide_viewer_list_.push_back(appid);
95 bool AbstractItem::Impl::ItemInfo::CanReceive(std::string receiver_group) const {
96 if (impl_->receiver_group_list_.size() != 0 && !receiver_group.empty()) {
97 list<string>::iterator iter =
98 std::find(impl_->receiver_group_list_.begin(),
99 impl_->receiver_group_list_.end(), receiver_group);
101 if (iter == impl_->receiver_group_list_.end())
105 if (impl_->hide_viewer_list_.size() == 0)
108 string app_id = util::GetAppId();
109 list<string>::iterator iter =
110 std::find(impl_->hide_viewer_list_.begin(),
111 impl_->hide_viewer_list_.end(), app_id);
113 if (iter != impl_->hide_viewer_list_.end())
119 std::list<std::string> AbstractItem::Impl::ItemInfo::GetHideViewerList() const {
120 return impl_->hide_viewer_list_;
124 } // namespace notification