BuildRequires: pkgconfig(capi-network-wifi-manager)
BuildRequires: pkgconfig(tapi)
BuildRequires: pkgconfig(libpcrecpp)
-BuildRequires: pkgconfig(capi-appfw-application)
+BuildRequires: pkgconfig(capi-appfw-app-common)
BuildRequires: pkgconfig(capi-appfw-app-manager)
BuildRequires: pkgconfig(capi-appfw-package-manager)
BuildRequires: pkgconfig(capi-content-media-content)
%endif
%if 0%{?tizen_feature_alarm_support}
+BuildRequires: pkgconfig(capi-appfw-app-control)
+BuildRequires: pkgconfig(capi-appfw-application)
BuildRequires: pkgconfig(capi-appfw-alarm)
BuildRequires: pkgconfig(alarm-service)
%endif
+%if 0%{?tizen_feature_application_support}
+BuildRequires: pkgconfig(capi-appfw-app-control)
+BuildRequires: pkgconfig(capi-appfw-event)
+%endif
+
+%if 0%{?tizen_feature_bluetooth_support}
+BuildRequires: pkgconfig(capi-appfw-app-control)
+%endif
+
%if 0%{?tizen_feature_bookmark_support}
BuildRequires: pkgconfig(capi-web-bookmark)
BuildRequires: pkgconfig(bookmark-adaptor)
%if 0%{?tizen_feature_push_support}
BuildRequires: pkgconfig(push)
+BuildRequires: pkgconfig(capi-appfw-app-control)
%endif
%if 0%{?tizen_feature_key_manager_support}
%if 0%{?tizen_feature_nfc_support}
BuildRequires: pkgconfig(capi-network-nfc)
+BuildRequires: pkgconfig(capi-appfw-app-control)
%endif
%if 0%{?tizen_feature_fm_radio_support}
%if 0%{?tizen_feature_notification_support}
BuildRequires: pkgconfig(notification)
+BuildRequires: pkgconfig(capi-appfw-app-control)
+%endif
+
+%if 0%{?tizen_feature_preference_support}
+BuildRequires: pkgconfig(capi-appfw-preference)
%endif
%if 0%{?tizen_feature_sound_support}
'variables': {
'packages': [
'capi-appfw-alarm',
+ 'capi-appfw-app-control',
+ 'capi-appfw-application',
]
},
}],
'packages': [
'aul',
'capi-appfw-app-manager',
- 'capi-appfw-application',
+ 'capi-appfw-app-control',
+ 'capi-appfw-event',
'capi-appfw-package-manager',
'pkgmgr',
'pkgmgr-info',
'variables': {
'packages': [
'capi-network-bluetooth',
+ 'capi-appfw-app-control',
'capi-system-info',
'libpcrecpp',
]
'variables': {
'packages': [
'capi-appfw-app-manager',
- 'capi-appfw-application',
+ 'capi-appfw-app-common',
'capi-appfw-package-manager',
'storage',
'security-privilege-manager',
static_cast<int>(ConvergenceUtils::GetArg(args, kJSCurrentListenerId).get<double>()));
}
- this->Post(token, result);
+ //only in case of failure call callback
+ //other cases are handled by conv_service_listener_cb()
+ if (!result) {
+ this->Post(token, result);
+ }
};
std::thread(launch_app_control, token).detach();
}
int error = conv_service_disconnect(service);
+
if (CONV_ERROR_NONE != error) {
return LogAndCreateTizenError(AbortError, "conv_service_disconnect [Fail]");
} else {
}
return common::TizenSuccess();
+
}
} // namespace convergence
'packages': [
'capi-system-info',
'capi-network-nfc',
- 'capi-appfw-application'
+ 'capi-appfw-app-control',
]
},
}],
'packages': [
'notification',
'capi-system-device',
+ 'capi-appfw-app-control',
]
},
}],
}
};
+NotificationManager.prototype.saveNotificationAsTemplate = function(name, notification) {
+ var args = validator_.validateArgs(arguments, [
+ {name: 'name', type: types_.STRING},
+ {name: 'notification', type: types_.PLATFORM_OBJECT, values: StatusNotification}
+ ]);
+
+ var result = native_.callSync('NotificationManager_saveNotificationAsTemplate', args);
+
+ if (native_.isFailure(result)) {
+ throw native_.getErrorObject(result);
+ }
+};
+
+NotificationManager.prototype.createNotificationFromTemplate = function(name) {
+ var args = validator_.validateArgs(arguments, [
+ {name: 'name', type: types_.STRING}
+ ]);
+
+ if (!arguments.length) {
+ throw new WebAPIException(WebAPIException.NOT_FOUND_ERR);
+ }
+
+ var result = native_.callSync('NotificationManager_createNotificationFromTemplate', args);
+
+ if (native_.isFailure(result)) {
+ throw native_.getErrorObject(result);
+ }
+ var n = native_.getResultObject(result);
+
+ _edit.allow();
+ var returnObject = new StatusNotification(n.statusType, n.title, n);
+ _edit.disallow();
+
+ return returnObject;
+};
+
function NotificationInitDict(data) {
var _iconPath = null;
NotificationManagerPlayLEDCustomEffect);
REGISTER_SYNC("NotificationManager_stopLEDCustomEffect",
NotificationManagerStopLEDCustomEffect);
+ REGISTER_SYNC("NotificationManager_saveNotificationAsTemplate", NotificationManagerSaveTemplate);
+ REGISTER_SYNC("NotificationManager_createNotificationFromTemplate", NotificationManagerCreateFromTemplate);
#undef REGISTER_SYNC
manager_ = NotificationManager::GetInstance();
}
}
+void NotificationInstance::NotificationManagerSaveTemplate(const picojson::value& args,
+ picojson::object& out) {
+ LoggerD("Enter");
+ CHECK_PRIVILEGE_ACCESS(kPrivilegeNotification, &out);
+
+ PlatformResult status = manager_->SaveTemplate(args.get<picojson::object>());
+
+ if (status.IsSuccess()) {
+ ReportSuccess(out);
+ } else {
+ LogAndReportError(status, &out);
+ }
+}
+
+
+void NotificationInstance::NotificationManagerCreateFromTemplate(const picojson::value& args,
+ picojson::object& out) {
+ LoggerD("Enter");
+ CHECK_PRIVILEGE_ACCESS(kPrivilegeNotification, &out);
+ picojson::value val{picojson::object{}};
+
+ PlatformResult status =
+ manager_->CreateFromTemplate(args.get<picojson::object>(), val.get<picojson::object>());
+
+ if (status.IsSuccess()) {
+ ReportSuccess(val, out);
+ } else {
+ LogAndReportError(status, &out);
+ }
+}
+
#undef CHECK_EXIST
} // namespace notification
picojson::object& out);
void NotificationManagerStopLEDCustomEffect(const picojson::value& args,
picojson::object& out);
+ void NotificationManagerSaveTemplate(const picojson::value& args,
+ picojson::object& out);
+ void NotificationManagerCreateFromTemplate(const picojson::value& args,
+ picojson::object& out);
};
} // namespace notification
return PlatformResult(ErrorCode::NO_ERROR);
}
+common::PlatformResult NotificationManager::SaveTemplate(const picojson::object& args) {
+ LoggerD("Enter");
+ std::string name = FromJson<std::string>(args, "name");
+ notification_h noti_handle = nullptr;
+ int ret;
+ SCOPE_EXIT {
+ notification_free(noti_handle);
+ };
+
+ PlatformResult status = StatusNotification::GetNotiHandleFromJson(args, false, ¬i_handle);
+
+ if (status.IsError()){
+ return status;
+ }
+
+ ret = notification_save_as_template(noti_handle, name.c_str());
+ if (ret != NOTIFICATION_ERROR_NONE) {
+ LoggerD("Error: %d (%s)", ret, get_error_message(ret));
+ if (ret == NOTIFICATION_ERROR_MAX_EXCEEDED) {
+ return LogAndCreateResult(ErrorCode::QUOTA_EXCEEDED_ERR,
+ "Maximum number of templates exceeded",
+ ("Maximum number of templates exceeded, error: %d", ret));
+ } else {
+ return LogAndCreateResult(ErrorCode::ABORT_ERR,
+ "Saving template failed",
+ ("Saving template failed, error: %d", ret));
+ }
+ }
+
+ return PlatformResult(ErrorCode::NO_ERROR);
+}
+
+
+common::PlatformResult NotificationManager::CreateFromTemplate(const picojson::object& args,
+ picojson::object& out) {
+ LoggerD("Enter");
+ std::string name = FromJson<std::string>(args, "name");
+
+ notification_h noti_handle = nullptr;
+ noti_handle = notification_create_from_template(name.c_str());
+ if (!noti_handle) {
+ return LogAndCreateResult(ErrorCode::NOT_FOUND_ERR,
+ "The template with given name not found",
+ ("The template with given name not found, handle is NULL"));
+ }
+
+ SCOPE_EXIT {
+ notification_free(noti_handle);
+ };
+
+ PlatformResult status = StatusNotification::ToJson(0, noti_handle, nullptr, &out);
+ if (status.IsError())
+ {
+ LoggerE("Failed: ToJson");
+ return status;
+ }
+ return PlatformResult(ErrorCode::NO_ERROR);
+}
+
} // namespace notification
} // namespace extension
common::PlatformResult PlayLEDCustomEffect(const picojson::object& args);
common::PlatformResult StopLEDCustomEffect();
+ common::PlatformResult SaveTemplate(const picojson::object& args);
+ common::PlatformResult CreateFromTemplate(const picojson::object& args,
+ picojson::object& out);
+
private:
NotificationManager();
virtual ~NotificationManager();
return status;
out["vibration"] = picojson::value(vibration);
- picojson::object app_control = picojson::object();
- status = GetApplicationControl(app_handle, &app_control);
- if (status.IsError())
- return status;
- if (app_control.size()) {
- out["appControl"] = picojson::value(app_control);
- }
+ if (app_handle) {
+ picojson::object app_control = picojson::object();
+ status = GetApplicationControl(app_handle, &app_control);
+ if (status.IsError())
+ return status;
+ if (app_control.size()) {
+ out["appControl"] = picojson::value(app_control);
+ }
- status = GetApplicationId(app_handle, &value_str);
- if (status.IsError())
- return status;
- if (value_str.length()) {
- out["appId"] = picojson::value(value_str);
+ status = GetApplicationId(app_handle, &value_str);
+ if (status.IsError())
+ return status;
+ if (value_str.length()) {
+ out["appId"] = picojson::value(value_str);
+ }
}
std::string progress_type;
return PlatformResult(ErrorCode::NO_ERROR);
}
-PlatformResult StatusNotification::FromJson(const picojson::object& args,
- bool is_update,
- picojson::object* out_ptr) {
+PlatformResult StatusNotification::GetNotiHandleFromJson(const picojson::object& args,
+ bool is_update,
+ notification_h *noti_handle){
LoggerD("Enter");
picojson::object noti_obj =
common::FromJson<picojson::object>(args, "notification");
return status;
int id = NOTIFICATION_PRIV_ID_NONE;
- int ret;
- notification_h noti_handle = nullptr;
- app_control_h app_control = NULL;
+ app_control_h app_control = nullptr;
SCOPE_EXIT {
if (app_control) {
app_control_destroy(app_control);
}
- notification_free(noti_handle);
};
if (is_update) {
id = std::stoi(common::FromJson<std::string>(noti_obj, "id"));
- PlatformResult status = GetNotiHandle(id, ¬i_handle);
+ PlatformResult status = GetNotiHandle(id, noti_handle);
if (status.IsError())
return status;
} else {
- status = Create(noti_type, ¬i_handle);
+ status = Create(noti_type, noti_handle);
if (status.IsError())
return status;
}
- status = SetLayout(noti_handle, status_type);
+ status = SetLayout(*noti_handle, status_type);
if (status.IsError()) {
return status;
}
const std::string& value_str = common::FromJson<std::string>(noti_obj, "iconPath");
std::string real_path = common::FilesystemProvider::Create().GetRealPath(value_str);
- status = SetImage(noti_handle, NOTIFICATION_IMAGE_TYPE_ICON, real_path);
+ status = SetImage(*noti_handle, NOTIFICATION_IMAGE_TYPE_ICON, real_path);
if (status.IsError()) {
return status;
}
common::FromJson<std::string>(noti_obj, "subIconPath");
std::string real_path = common::FilesystemProvider::Create().GetRealPath(value_str);
- status = SetImage(noti_handle, NOTIFICATION_IMAGE_TYPE_ICON_SUB, real_path);
+ status = SetImage(*noti_handle, NOTIFICATION_IMAGE_TYPE_ICON_SUB, real_path);
if (status.IsError()) {
return status;
}
if (val.contains("number") && !IsNull(noti_obj, "number")) {
long number = (long)common::FromJson<double>(noti_obj, "number");
- status = SetText(noti_handle, NOTIFICATION_TEXT_TYPE_EVENT_COUNT, std::to_string(number));
+ status = SetText(*noti_handle, NOTIFICATION_TEXT_TYPE_EVENT_COUNT, std::to_string(number));
if (status.IsError()) {
return status;
}
if (val.contains("detailInfo") && !IsNull(noti_obj, "detailInfo")) {
status = SetDetailInfos(
- noti_handle, common::FromJson<picojson::array>(noti_obj, "detailInfo"));
+ *noti_handle, common::FromJson<picojson::array>(noti_obj, "detailInfo"));
if (status.IsError()) {
return status;
}
}
if (val.contains("ledColor") && !IsNull(noti_obj, "ledColor")) {
- status = SetLedColor(noti_handle,
+ status = SetLedColor(*noti_handle,
common::FromJson<std::string>(noti_obj, "ledColor"));
if (status.IsError()) {
return status;
}
}
- status = SetLedOnPeriod(noti_handle,
+ status = SetLedOnPeriod(*noti_handle,
static_cast<unsigned long>(common::FromJson<double>(
noti_obj, "ledOnPeriod")));
if (status.IsError()) {
return status;
}
- status = SetLedOffPeriod(noti_handle,
+ status = SetLedOffPeriod(*noti_handle,
static_cast<unsigned long>(common::FromJson<double>(
noti_obj, "ledOffPeriod")));
if (status.IsError()) {
const std::string& value_str = common::FromJson<std::string>(noti_obj, "backgroundImagePath");
std::string real_path = common::FilesystemProvider::Create().GetRealPath(value_str);
- status = SetImage(noti_handle, NOTIFICATION_IMAGE_TYPE_BACKGROUND, real_path);
+ status = SetImage(*noti_handle, NOTIFICATION_IMAGE_TYPE_BACKGROUND, real_path);
if (status.IsError()) {
return status;
}
if (val.contains("thumbnails") && !IsNull(noti_obj, "thumbnails")) {
status = SetThumbnails(
- noti_handle, common::FromJson<picojson::array>(noti_obj, "thumbnails"));
+ *noti_handle, common::FromJson<picojson::array>(noti_obj, "thumbnails"));
if (status.IsError()) {
return status;
}
const std::string& value_str = common::FromJson<std::string>(noti_obj, "soundPath");
std::string real_path = common::FilesystemProvider::Create().GetRealPath(value_str);
- status = SetSoundPath(noti_handle, real_path);
+ status = SetSoundPath(*noti_handle, real_path);
if (status.IsError()) {
return status;
}
}
status =
- SetVibration(noti_handle, common::FromJson<bool>(noti_obj, "vibration"));
+ SetVibration(*noti_handle, common::FromJson<bool>(noti_obj, "vibration"));
if (status.IsError()) {
return status;
}
const std::string& progress_type =
common::FromJson<std::string>(noti_obj, "progressType");
- status = SetImage(noti_handle, NOTIFICATION_IMAGE_TYPE_LIST_5, progress_type);
+ status = SetImage(*noti_handle, NOTIFICATION_IMAGE_TYPE_LIST_5, progress_type);
if (status.IsError()) {
return status;
}
progressValue = -1;
}
- status = SetProgressValue(noti_handle, progress_type, progressValue,
+ status = SetProgressValue(*noti_handle, progress_type, progressValue,
is_update);
if (status.IsError()) {
return status;
}
- status = SetText(noti_handle,
+ status = SetText(*noti_handle,
NOTIFICATION_TEXT_TYPE_TITLE,
common::FromJson<std::string>(noti_obj, "title"));
if (status.IsError()) {
}
if (val.contains("content") && !IsNull(noti_obj, "content")) {
- status = SetText(noti_handle,
+ status = SetText(*noti_handle,
NOTIFICATION_TEXT_TYPE_CONTENT,
common::FromJson<std::string>(noti_obj, "content"));
if (status.IsError()) {
}
}
- status = SetAppControl(noti_handle, app_control);
+ status = SetAppControl(*noti_handle, app_control);
+
+ return PlatformResult(ErrorCode::NO_ERROR);
+}
+
+PlatformResult StatusNotification::FromJson(const picojson::object& args,
+ bool is_update,
+ picojson::object* out_ptr) {
+ LoggerD("Enter");
+ notification_h noti_handle = nullptr;
+ int ret;
+ int id = NOTIFICATION_PRIV_ID_NONE;
+
+ SCOPE_EXIT {
+ notification_free(noti_handle);
+ };
+
+ PlatformResult status = GetNotiHandleFromJson(args, is_update, ¬i_handle);
+
+ if (status.IsError()){
+ return status;
+ }
if (is_update) {
ret = notification_update(noti_handle);
-
} else {
ret = notification_insert(noti_handle, &id);
if (NOTIFICATION_ERROR_NONE != ret) {
notification_h noti_handle,
app_control_h app_handle,
picojson::object* out_ptr);
+ static common::PlatformResult GetNotiHandleFromJson(const picojson::object& args,
+ bool is_update,
+ notification_h *noti_handle);
static common::PlatformResult FromJson(const picojson::object& args,
bool is_update,
picojson::object* out_ptr);
['tizen == 1', {
'variables': {
'packages': [
- 'capi-appfw-application',
+ 'capi-appfw-preference',
]
},
}],
'variables': {
'packages': [
'push',
- 'capi-appfw-application',
+ 'capi-appfw-app-control',
'libpcrecpp',
]
},