}
void DelegateReporterEvent(const IEventInfo& info,
- shared_ptr<item::AbstractItem> item) {
- reporter_->SendEvent(info, item);
- }
-
- void DelegateReporterEvent(const IEventInfo& info,
- std::list<std::shared_ptr<item::AbstractItem>> itemList) {
+ list<shared_ptr<item::AbstractItem>> itemList) {
reporter_->SendEvent(info, itemList);
}
void DelegateManagerEvent(const IEventInfo& info,
- shared_ptr<item::AbstractItem> noti) {
- manager_->SendEvent(info, noti);
+ list<shared_ptr<item::AbstractItem>> itemList) {
+ manager_->SendEvent(info, itemList);
}
void LaunchDefaultViewer(list<shared_ptr<item::AbstractItem>> item,
static_pointer_cast<IItemInfoInternal>(
item.front()->GetInfo())->GetUid());
}
+
void LaunchDefaultViewer(shared_ptr<item::AbstractItem> item,
notification_op_type_e status) {
LaunchDefaultViewer(
return true;
}
+
bool CheckDoNoDisturbStatus(uid_t uid, const string& owner) {
int ret;
bool do_not_disturb = false;
class DPMReporter : public Reporter {
protected:
void OnUpdate(const IEventInfo& info,
- shared_ptr<item::AbstractItem> updatedItem) {
+ list<shared_ptr<item::AbstractItem>> updatedItem) {
DBG("Update !!!");
int ret;
}
void DoDelete(const IEventInfo& info,
- shared_ptr<item::AbstractItem> deletedItem) {
+ list<shared_ptr<item::AbstractItem>> deletedItem) {
int ret = DBManager::DeleteNotification(deletedItem);
if (ret == ERROR_NONE) {
/* noti owner */
}
void OnDelete(const IEventInfo& info,
- shared_ptr<item::AbstractItem> deletedItem) {
+ list<shared_ptr<item::AbstractItem>> deletedItem) {
DBG("Delete !!!");
if (info.GetEventType() == IEventInfo::EventType::DeleteAll) {
list<shared_ptr<item::AbstractItem>> noti_list;
facade_->GetUid(info), info.GetChannel());
EventInfo event_info(EventInfo::Delete, info.GetOwner(), info.GetChannel());
- for (auto& i : noti_list)
- DoDelete(event_info, i);
+ DoDelete(event_info, noti_list);
} else {
DoDelete(info, deletedItem);
}
list<shared_ptr<item::AbstractItem>> noti_list) override {
LOGI("Event received (%d) !!", (int)info.GetEventType());
int type = info.GetEventType();
- if (type == IEventInfo::EventType::DeleteAll) {
- OnDelete(info, nullptr);
- return;
- } else if (type == IEventInfo::EventType::Register) {
- OnRegister(info);
- return;
- }
- for (auto& i : noti_list) {
- switch (type) {
+ switch (type) {
case IEventInfo::EventType::Update:
- OnUpdate(info, i);
+ OnUpdate(info, noti_list);
break;
case IEventInfo::EventType::Delete:
- OnDelete(info, i);
+ OnDelete(info, noti_list);
+ break;
+ case IEventInfo::EventType::DeleteAll:
+ OnDelete(info, noti_list);
+ break;
+ case IEventInfo::EventType::Register:
+ OnRegister(info);
break;
default :
break;
- }
}
}
return DBManager::GetNotificationList(facade_->GetUid(info)).size();
}
- int UpdateHideApp(shared_ptr<item::AbstractItem> updatedItem) {
+ int UpdateHideApp(list<shared_ptr<item::AbstractItem>> updatedItem) {
int ret;
- string hide_list;
- int uid = static_pointer_cast<IItemInfoInternal>(updatedItem->GetInfo())->GetUid();
- DBG("try update hide app_id(%s) sender(%s) uid(%s)",
- updatedItem->GetId().c_str(),
- updatedItem->GetSenderAppId().c_str(), string(to_string(uid)).c_str());
- string map_key = updatedItem->GetId() + updatedItem->GetSenderAppId() + string(to_string(uid));
- list<string> updated_hide_list = static_pointer_cast<IItemInfoInternal>(updatedItem->GetInfo())->GetHideViewerList();
-
- /* Check new hide app */
- auto noti = facade_->hide_map_.find(map_key);
- if (noti == facade_->hide_map_.end()) {
- if (updated_hide_list.size() > 0) {
- for (auto& i : updated_hide_list)
- hide_list += i + ";";
-
- ret = DBManager::UpdateHideList(updatedItem, hide_list);
- if (ret != ERROR_NONE)
- return ret;
-
- facade_->hide_map_[map_key] = hide_list;
- return ERROR_NONE;
- } else {
- DBG("Empty hide viewer list");
- return ERROR_NOT_EXIST_ID;
+ for (auto& i : updatedItem) {
+ string hide_list;
+ int uid = static_pointer_cast<IItemInfoInternal>(i->GetInfo())->GetUid();
+ DBG("try update hide app_id(%s) sender(%s) uid(%s)",
+ i->GetId().c_str(),
+ i->GetSenderAppId().c_str(), string(to_string(uid)).c_str());
+ string map_key = i->GetId() + i->GetSenderAppId() + string(to_string(uid));
+ list<string> updated_hide_list = static_pointer_cast<IItemInfoInternal>(i->GetInfo())->GetHideViewerList();
+
+ /* Check new hide app */
+ auto noti = facade_->hide_map_.find(map_key);
+ if (noti == facade_->hide_map_.end()) {
+ if (updated_hide_list.size() > 0) {
+ for (auto& j : updated_hide_list)
+ hide_list += j + ";";
+
+ ret = DBManager::UpdateHideList(i, hide_list);
+ if (ret != ERROR_NONE)
+ return ret;
+
+ facade_->hide_map_[map_key] = hide_list;
+ return ERROR_NONE;
+ } else {
+ DBG("Empty hide viewer list");
+ return ERROR_NOT_EXIST_ID;
+ }
}
- }
- /* Check new hide app */
- hide_list = noti->second;
- for (auto& i : updated_hide_list) {
- if (hide_list.find(i + ";") == string::npos) {
- string new_hide_list = hide_list + i + ";";
- ret = DBManager::UpdateHideList(updatedItem, new_hide_list);
- if (ret != ERROR_NONE)
- return ret;
-
- facade_->hide_map_[map_key] = new_hide_list;
- return ERROR_NONE;
+ /* Check new hide app */
+ hide_list = noti->second;
+ for (auto& j : updated_hide_list) {
+ if (hide_list.find(j + ";") == string::npos) {
+ string new_hide_list = hide_list + j + ";";
+ ret = DBManager::UpdateHideList(i, new_hide_list);
+ if (ret != ERROR_NONE)
+ return ret;
+
+ facade_->hide_map_[map_key] = new_hide_list;
+ return ERROR_NONE;
+ }
}
}
-
return ERROR_NOT_EXIST_ID;
}
class DPMManager : public Manager {
protected:
- void UpdateHideApp(shared_ptr<item::AbstractItem> updatedItem) {
- string hide_list;
- int uid = static_pointer_cast<IItemInfoInternal>(updatedItem->GetInfo())->GetUid();
- string map_key = updatedItem->GetId() + updatedItem->GetSenderAppId() + string(to_string(uid));
- list<string> updated_hide_list =
- static_pointer_cast<item::IItemInfoInternal>(updatedItem->GetInfo())->GetHideViewerList();
-
- auto noti = facade_->hide_map_.find(map_key);
- if (noti == facade_->hide_map_.end())
- return;
-
- /* hide app list synchronization */
- hide_list = noti->second;
- istringstream stream(hide_list);
- string hide_app_id;
-
- while (getline(stream, hide_app_id, ';')) {
- list<string>::iterator iter = std::find(updated_hide_list.begin(),
- updated_hide_list.end(), hide_app_id);
- if (iter == updated_hide_list.end())
- static_pointer_cast<item::IItemInfoInternal>(updatedItem->GetInfo())->AddHideViewer(hide_app_id);
- }
- }
-
void OnAdd(const IEventInfo& info,
list<shared_ptr<item::AbstractItem>> addedItem) override {
DBG("Add !!!");
}
void OnUpdate(const IEventInfo& info,
- shared_ptr<item::AbstractItem> updatedItem) override {
+ list<shared_ptr<item::AbstractItem>> updatedItem) override {
DBG("Update !!!");
int ret;
}
int DoDelete(const IEventInfo& info,
- shared_ptr<item::AbstractItem> deletedItem) {
+ list<shared_ptr<item::AbstractItem>> deletedItem) {
int ret;
ret = DBManager::DeleteNotification(deletedItem);
}
void OnDelete(const IEventInfo& info,
- shared_ptr<item::AbstractItem> deletedItem) override {
+ list<shared_ptr<item::AbstractItem>> deletedItem) override {
DBG("Delete !!!");
if (info.GetEventType() == IEventInfo::EventType::DeleteAll) {
list<shared_ptr<item::AbstractItem>> noti_list =
DBManager::GetNotificationList(info.GetOwner(), facade_->GetUid(info),
- info.GetChannel());
- for (auto& i : noti_list) {
- EventInfo event_info(EventInfo::Delete, info.GetOwner(), info.GetChannel());
- DoDelete(event_info, i);
- }
+ info.GetChannel());
+ EventInfo event_info(EventInfo::Delete, info.GetOwner(), info.GetChannel());
+ DoDelete(event_info, noti_list);
facade_->LaunchDefaultViewer(noti_list, NOTIFICATION_OP_DELETE);
} else {
int ret = DoDelete(info, deletedItem);
}
}
+ void UpdateHideApp(list<shared_ptr<item::AbstractItem>> updatedItem) {
+ for (auto& i : updatedItem) {
+ string hide_list;
+ int uid = static_pointer_cast<IItemInfoInternal>(i->GetInfo())->GetUid();
+ string map_key = i->GetId() + i->GetSenderAppId() + string(to_string(uid));
+ list<string> updated_hide_list =
+ static_pointer_cast<item::IItemInfoInternal>(i->GetInfo())->GetHideViewerList();
+
+ auto noti = facade_->hide_map_.find(map_key);
+ if (noti == facade_->hide_map_.end())
+ return;
+
+ /* hide app list synchronization */
+ hide_list = noti->second;
+ istringstream stream(hide_list);
+ string hide_app_id;
+
+ while (getline(stream, hide_app_id, ';')) {
+ list<string>::iterator iter = std::find(updated_hide_list.begin(),
+ updated_hide_list.end(), hide_app_id);
+ if (iter == updated_hide_list.end())
+ static_pointer_cast<item::IItemInfoInternal>(i->GetInfo())->AddHideViewer(hide_app_id);
+ }
+ }
+ }
+
void SetIndirectRequest(const IEventInfo& info,
list<shared_ptr<AbstractItem>> addedItem) {
for (auto& i : addedItem)