#define ABSTRACT_ITEM_UID_KEY "__ABSTRACT_ITEM_UID_KEY__"
#define ABSTRACT_ITEM_TIME_KEY "__ABSTRACT_ITEM_TIME_KEY__"
#define ABSTRACT_ITEM_SENDER_APPID_KEY "__ABSTRACT_ITEM_SENDER_APPID_KEY__"
+#define ABSTRACT_ITEM_TAG_KEY "__ABSTRACT_ITEM_TAG_KEY__"
#define ABSTRACT_ITEM_CHANNEL_KEY "__ABSTRACT_ITEM_CHANNEL_KEY__"
#define ABSTRACT_ITEM_VERSION_KEY "__ABSTRACT_ITEM_VERSION_KEY__"
#define ABSTRACT_ITEM_HIDE_TIME_KEY "__ABSTRACT_ITEM_HIDE_TIME_KEY__"
b.Add(ABSTRACT_ITEM_HIDE_TIME_KEY, to_string(impl_->hide_time_));
b.Add(ABSTRACT_ITEM_DELETE_TIME_KEY, to_string(impl_->delete_time_));
b.Add(ABSTRACT_ITEM_UID_KEY, to_string(impl_->uid_));
+ b.Add(ABSTRACT_ITEM_TAG_KEY, impl_->tag_);
timeinfo = localtime(&impl_->time_);
strftime (buf, sizeof(buf), "%s", timeinfo);
impl_->sound_path_ = b.GetString(ABSTRACT_ITEM_SOUND_PATH_KEY);
impl_->vibration_path_ = b.GetString(ABSTRACT_ITEM_VIBRATION_PATH_KEY);
impl_->uid_ = stoi(b.GetString(ABSTRACT_ITEM_UID_KEY));
+ impl_->tag_ = b.GetString(ABSTRACT_ITEM_TAG_KEY);
time_s = b.GetString(ABSTRACT_ITEM_TIME_KEY);
strptime(time_s.c_str(), "%s", &timeinfo);
impl_->sender_appid_ = sender_appid;
}
+std::string AbstractItem::GetTag() const {
+ return impl_->tag_;
+}
+
+void AbstractItem::SetTag(std::string tag) {
+ impl_->tag_ = tag;
+}
+
} // namespace item
} // namespace notification
std::shared_ptr<IItemInfo> GetInfo() const;
std::string GetSenderAppId() const;
void SetSenderAppId(std::string sender_appid);
- std::string GetTag();
- void SetTag();
+ std::string GetTag() const;
+ void SetTag(std::string tag);
private:
class Impl;
#define NOTIFICATION_EX_EVENT_OWNER_KEY "__NOTIFICATION_EX_EVENT_OWNER_KEY__"
#define NOTIFICATION_EX_EVENT_CHANNEL_KEY "__NOTIFICATION_EX_EVENT_CHANNEL_KEY__"
#define NOTIFICATION_EX_EVENT_ITEM_ID_KEY "__NOTIFICATION_EX_EVENT_ITEM_ID_KEY__"
-#define NOTIFICATION_EX_EVENT_TAG_KEY "__NOTIFICATION_EX_EVENT_TAG_KEY__"
#define NOTIFICATION_EX_EVENT_UID_KEY "__NOTIFICATION_EX_EVENT_UID_KEY__"
#define NOTIFICATION_EX_EVENT_REQUEST_ID_KEY "__NOTIFICATION_EX_EVENT_REQUEST_ID_KEY__"
#define NOTIFICATION_EX_EVENT_ERROR_KEY "__NOTIFICATION_EX_EVENT_ERROR_KEY__"
namespace notification {
EventInfo::EventInfo(int type, std::string owner, std::string channel,
- std::string item_id, std::string tag)
- : impl_(new Impl(this, type, owner, channel, item_id, tag)) {
+ std::string item_id)
+ : impl_(new Impl(this, type, owner, channel, item_id)) {
}
EventInfo::~EventInfo() = default;
EventInfo::Impl::~Impl() = default;
-EventInfo::Impl::Impl(EventInfo* parent,
- int type, std::string owner, std::string channel,
- std::string item_id, std::string tag)
- : type_(type), owner_(owner), channel_(channel),
- item_id_(item_id), tag_(tag), parent_(parent) {
+EventInfo::Impl::Impl(EventInfo* parent, int type, std::string owner,
+ std::string channel, std::string item_id)
+ : type_(type), owner_(owner), channel_(channel), item_id_(item_id),
+ parent_(parent) {
uid_ = getuid();
request_id_ = util::GetRequestId();
error_ = NOTIFICATION_ERROR_NONE;
}
EventInfo::EventInfo(Bundle serialized)
- : impl_(new Impl(this, EventInfo::Post, "", "", "", "")) {
+ : impl_(new Impl(this, EventInfo::Post, "", "", "")) {
string event_str = serialized.GetString(NOTIFICATION_EX_EVENT_TYPE_KEY);
impl_->type_ = (int)strtol(event_str.c_str(), NULL, 10);
impl_->owner_ = serialized.GetString(NOTIFICATION_EX_EVENT_OWNER_KEY);
impl_->channel_ = serialized.GetString(NOTIFICATION_EX_EVENT_CHANNEL_KEY);
impl_->item_id_ = serialized.GetString(NOTIFICATION_EX_EVENT_ITEM_ID_KEY);
- impl_->tag_ = serialized.GetString(NOTIFICATION_EX_EVENT_TAG_KEY);
string uid_str = serialized.GetString(NOTIFICATION_EX_EVENT_UID_KEY);
impl_->uid_ = (uid_t)strtol(uid_str.c_str(), NULL, 10);
string request_id_str =
serialized.Add(NOTIFICATION_EX_EVENT_OWNER_KEY, impl_->owner_);
serialized.Add(NOTIFICATION_EX_EVENT_CHANNEL_KEY, impl_->channel_);
serialized.Add(NOTIFICATION_EX_EVENT_ITEM_ID_KEY, impl_->item_id_);
- serialized.Add(NOTIFICATION_EX_EVENT_TAG_KEY, impl_->tag_);
serialized.Add(NOTIFICATION_EX_EVENT_UID_KEY, to_string((int)impl_->uid_));
serialized.Add(
NOTIFICATION_EX_EVENT_REQUEST_ID_KEY, to_string(impl_->request_id_));
return impl_->item_id_;
}
-string EventInfo::GetTag() const {
- return impl_->tag_;
-}
-
uid_t EventInfo::GetUid() const {
return impl_->uid_;
}
private:
friend class EventInfo;
Impl(EventInfo* parent, int type, std::string owner, std::string channel,
- std::string item_id, std::string tag);
+ std::string item_id);
private:
int type_;
std::string owner_;
std::string channel_;
std::string item_id_;
- std::string tag_;
uid_t uid_;
int request_id_;
NotificationError error_;
};
} // namespace notification
-#endif // NOTIFICATION_EX_EVENT_INFO_IMPLEMENTATION_H_
\ No newline at end of file
+#endif // NOTIFICATION_EX_EVENT_INFO_IMPLEMENTATION_H_
class EventInfo : public IEventInfoInternal {
public:
EventInfo(int type, std::string owner, std::string channel = "",
- std::string item_id = "", std::string tag = "");
+ std::string item_id = "");
EventInfo(Bundle serialized);
virtual ~EventInfo();
uid_t GetUid() const override;
std::string GetOwner() const override;
std::string GetChannel() const override;
std::string GetItemId() const override;
- std::string GetTag() const override;
int GetRequestId() const override;
Bundle Serialize() const override;
static std::string GetString(int type);
virtual std::string GetOwner() const = 0;
virtual std::string GetChannel() const = 0;
virtual std::string GetItemId() const = 0;
- virtual std::string GetTag() const = 0;
virtual int GetRequestId() const = 0;
virtual Bundle Serialize() const = 0;
};
item.SetVibrationPath("vibrationpath");
std::static_pointer_cast<IItemInfoInternal>(item.GetInfo())->SetUid(3);
item.SetSenderAppId("sender");
+ item.SetTag("tag");
time(¤t_time);
std::static_pointer_cast<IItemInfoInternal>(item.GetInfo())->SetTime(current_time);
ASSERT_EQ(gen_test->GetSoundPath(), "soundpath");
ASSERT_EQ(gen_test->GetVibrationPath(), "vibrationpath");
ASSERT_EQ(gen_test->GetSenderAppId(), "sender");
+ ASSERT_EQ(gen_test->GetTag(), "tag");
ASSERT_EQ(gen_test->GetInfo()->GetTime(), current_time);
ASSERT_EQ(gen_test->GetStyle()->GetPadding().GetLeft(), 10);
};
TEST_F(EventInfoTest, SerializeDeserialize) {
- EventInfo info(EventInfo::Get, "test", "channel", "id", "tag");
+ EventInfo info(EventInfo::Get, "test", "channel", "id");
Bundle b = info.Serialize();
EventInfo serialized(b);
ASSERT_EQ(serialized.GetEventType(), info.GetEventType());
ASSERT_EQ(serialized.GetOwner(), info.GetOwner());
ASSERT_EQ(serialized.GetChannel(), info.GetChannel());
ASSERT_EQ(serialized.GetItemId(), info.GetItemId());
- ASSERT_EQ(serialized.GetTag(), info.GetTag());
ASSERT_EQ(serialized.GetUid(), info.GetUid());
}