| Index: src/Notification.cpp |
| diff --git a/src/Notification.cpp b/src/Notification.cpp |
| index 0791f3db86d0464c162812bce203f6fb9a03f0ca..c490e688846ad90d1d3aba8cefc8d17bc8318109 100644 |
| --- a/src/Notification.cpp |
| +++ b/src/Notification.cpp |
| @@ -64,50 +64,31 @@ Notification::Notification(const JsValuePtr& jsValue) |
| NotificationType Notification::GetType() const |
| { |
| - return type; |
| + return StringToNotificationType(GetProperty("type")->AsString()); |
| } |
| -const std::string& Notification::GetTitle() const |
| +NotificationTexts Notification::GetTexts() |
| { |
| - return title; |
| -} |
| - |
| -const std::string& Notification::GetMessageString() const |
| -{ |
| - return message; |
| -} |
| - |
| -void Notification::MarkAsShown() |
| -{ |
| - JsValueList params; |
| - params.push_back(GetProperty("id")); |
| - jsEngine->Evaluate("API.markNotificationAsShown")->Call(params); |
| -} |
| - |
| -NotificationPtr Notification::JsValueToNotification(const JsValuePtr& jsValue) |
| -{ |
| - if (!jsValue || !jsValue->IsObject()) |
| - { |
| - return NotificationPtr(); |
| - } |
| - |
| - NotificationPtr notification(new Notification(jsValue)); |
| - JsValuePtr jsType = notification->GetProperty("type"); |
| - notification->type = StringToNotificationType(jsType ? jsType->AsString() : ""); |
| - |
| JsValueList params; |
| - params.push_back(notification); |
| - JsValuePtr func = notification->jsEngine->Evaluate("API.getNotificationTexts"); |
| - JsValuePtr jsTexts = func->Call(params); |
| + params.push_back(shared_from_this()); |
| + JsValuePtr jsTexts = jsEngine->Evaluate("API.getNotificationTexts")->Call(params); |
| + NotificationTexts notificationTexts; |
| JsValuePtr jsTitle = jsTexts->GetProperty("title"); |
| if (jsTitle->IsString()) |
| { |
| - notification->title = jsTitle->AsString(); |
| + notificationTexts.title = jsTitle->AsString(); |
| } |
| JsValuePtr jsMessage = jsTexts->GetProperty("message"); |
| if (jsMessage->IsString()) |
| { |
| - notification->message = jsMessage->AsString(); |
| + notificationTexts.message = jsMessage->AsString(); |
| } |
| - return notification; |
| + return notificationTexts; |
| +} |
| + |
| +void Notification::MarkAsShown() |
| +{ |
| + JsValueList params; |
| + params.push_back(GetProperty("id")); |
| + jsEngine->Evaluate("API.markNotificationAsShown")->Call(params); |
| } |