var n = native_.getResultObject(result);
_edit.allow();
- //TODO create UserNotification here
- var returnObject = new StatusNotification(n.statusType, n.title, n);
+ var returnObject = new UserNotification(n.userType, n.title, n);
_edit.disallow();
return returnObject;
}
}
-function UserNotification(userType, title, notificationGropedInitDict) {
+function UserNotification(userType, title, notificationGroupedInitDict) {
validator_.isConstructorCall(this, UserNotification);
- type_.isObject(notificationGropedInitDict) ?
- notificationGropedInitDict.title = title :
- notificationGropedInitDict = {title: title};
- UserNotificationInitDict.call(this, notificationGropedInitDict);
- Notification.call(this, notificationGropedInitDict);
-
- // validation of each member - setting default values instead of incorrect ones
- TextContentsInitDict.call(this.textContents, notificationGropedInitDict.textContents);
- ImagesInitDict.call(this.images, notificationGropedInitDict.images);
- ThumbnailsInitDict.call(this.thumbnails, notificationGropedInitDict.thumbnails);
- ActionsInitDict.call(this.actions, notificationGropedInitDict.actions);
- LedsInitDict.call(this.leds, notificationGropedInitDict.leds);
- GroupContentsInitDict.call(this.groupContents, notificationGropedInitDict.groupContents);
+ type_.isObject(notificationGroupedInitDict) ?
+ notificationGroupedInitDict.title = title :
+ notificationGroupedInitDict = {title: title};
+ UserNotificationInitDict.call(this, notificationGroupedInitDict);
+ Notification.call(this, notificationGroupedInitDict);
+
+ this.textContents = new TextContentsInitDict(notificationGroupedInitDict.textContents);
+ this.images = new ImagesInitDict(notificationGroupedInitDict.images);
+ this.thumbnails = new ThumbnailsInitDict(notificationGroupedInitDict.thumbnails);
+ this.actions = new ActionsInitDict(notificationGroupedInitDict.actions);
+ this.leds = new LedsInitDict(notificationGroupedInitDict.leds);
+ this.groupContents = new GroupContentsInitDict(notificationGroupedInitDict.groupContents);
var _userType = (Object.keys(UserNotificationType)).indexOf(userType) >= 0
? userType : StatusNotificationType.SIMPLE;
notification_free(noti_handle);
};
- // TODO use UserNotification method
- PlatformResult status = StatusNotification::GetNotiHandleFromJson(args, false, ¬i_handle);
+ PlatformResult status = PlatformResult(ErrorCode::NO_ERROR);
+ const auto& new_impl_it = args.find("newImpl");
+ if (args.end() != new_impl_it && new_impl_it->second.get<bool>()) {
+ status = UserNotification::GetNotiHandleFromJson(args, false, ¬i_handle);
+ } else {
+ status = StatusNotification::GetNotiHandleFromJson(args, false, ¬i_handle);
+ }
if (status.IsError()) {
return status;
notification_free(noti_handle);
};
- // TODO use UserNotification method
- PlatformResult status = StatusNotification::ToJson(0, noti_handle, nullptr, &out);
+ //This method is designed to return only UserNotification objects
+ PlatformResult status = UserNotification::ToJson(0, noti_handle, nullptr, &out);
if (status.IsError())
{
LoggerE("Failed: ToJson");