From: Lukasz Bardeli Date: Mon, 20 Nov 2017 07:43:04 +0000 (+0100) Subject: [Content] remove deprecated methods set/unset db updated X-Git-Tag: submit/tizen/20171130.124131^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=96d0e7042af1798ec585e7c2c9e3a7031384273e;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git [Content] remove deprecated methods set/unset db updated remove methods: media_content_set_db_updated_cb media_content_unset_db_updated_cb [Verification] Passrate didn't change Change-Id: I903d75b49dc648dc1910e6fa23ffc2eab40d57ee Signed-off-by: Lukasz Bardeli --- diff --git a/src/content/content_instance.cc b/src/content/content_instance.cc index 8a3de66c..bf65c442 100644 --- a/src/content/content_instance.cc +++ b/src/content/content_instance.cc @@ -242,63 +242,7 @@ static void ScanDirectoryCallback(media_content_error_e error, void* user_data) common::Instance::PostMessage(cbData->instance, picojson::value(out).serialize().c_str()); } -// DEPRECATED CALLBACK. contentChangeCallback() is currently in use -static void changedContentV1Callback(media_content_error_e error, int pid, - media_content_db_update_item_type_e update_item, - media_content_db_update_type_e update_type, - media_content_type_e media_type, char* uuid, char* path, - char* mime_type, void* user_data) { - ScopeLogger("File change callback"); - - if (error != MEDIA_CONTENT_ERROR_NONE) { - LoggerE("Media content changed callback error: %d", (int)error); - return; - } - - if (update_item == MEDIA_ITEM_FILE) { - if (!uuid) { - LoggerE("Provided uuid is NULL, ignoring"); - return; - } - - ReplyCallbackData* cbData = static_cast(user_data); - - int ret; - picojson::value result = picojson::value(picojson::object()); - picojson::object& obj = result.get(); - - if (update_type == MEDIA_CONTENT_INSERT || update_type == MEDIA_CONTENT_UPDATE) { - media_info_h media = NULL; - ret = media_info_get_media_from_db(uuid, &media); - if (ret == MEDIA_CONTENT_ERROR_NONE && media != NULL) { - picojson::object o; - - ContentToJson(media, o); - ReportSuccess(picojson::value(o), obj); - - if (update_type == MEDIA_CONTENT_INSERT) { - obj["state"] = picojson::value("oncontentadded"); - } else { - obj["state"] = picojson::value("oncontentupdated"); - } - - media_info_destroy(media); - } - } else { - ReportSuccess(picojson::value(std::string(uuid)), obj); - obj["state"] = picojson::value("oncontentremoved"); - } - - obj["listenerId"] = cbData->args.get("listenerId"); - common::Instance::PostMessage(cbData->instance, result.serialize().c_str()); - } else { - LoggerD("Media item is not a file, skipping."); - return; - } -} - -// DEPRECATED CALLBACK. contentChangeCallback() is currently in use -static void changedContentV2Callback(media_content_error_e error, int pid, +static void changedContentCallback(media_content_error_e error, int pid, media_content_db_update_item_type_e update_item, media_content_db_update_type_e update_type, media_content_type_e media_type, char* uuid, char* path, @@ -678,17 +622,9 @@ void ContentInstance::ContentManagerSetchangelistener(const picojson::value& arg listener_data_->cbType = ContentManagerErrorCallback; } - if (ContentManager::getInstance() - ->setChangeListener(changedContentV1Callback, static_cast(listener_data_)) - .IsError()) { - LogAndReportError(common::PlatformResult(common::ErrorCode::UNKNOWN_ERR, - "The callback did not register properly"), - &out); - } - if (nullptr == noti_handle_) { // To remain consistency with the previous implementation if (ContentManager::getInstance() - ->addChangeListener(¬i_handle_, changedContentV2Callback, + ->addChangeListener(¬i_handle_, changedContentCallback, static_cast(listener_data_)) .IsError()) { LogAndReportError(common::PlatformResult(common::ErrorCode::UNKNOWN_ERR, @@ -708,9 +644,6 @@ void ContentInstance::ContentManagerUnsetchangelistener(const picojson::value& a // CHECK_PRIVILEGE_ACCESS(kPrivilegeContentRead, &out); CHECK_PRIVILEGE_ACCESS(kPrivilegeContentWrite, &out); - if (ContentManager::getInstance()->unSetChangeListener().IsError()) { - LoggerD("unsuccesfull deregistering of callback"); - } if (ContentManager::getInstance()->removeChangeListener(noti_handle_).IsError()) { LoggerD("unsuccesfull deregistering of callback"); } else { diff --git a/src/content/content_manager.cc b/src/content/content_manager.cc index 9ae3bb4f..9f950e22 100644 --- a/src/content/content_manager.cc +++ b/src/content/content_manager.cc @@ -910,31 +910,6 @@ PlatformResult ContentManager::removeChangeListener(media_content_noti_h noti_ha } } -PlatformResult ContentManager::setChangeListener(media_content_db_update_cb callback, - void* user_data) { - ScopeLogger(); - - int ret = media_content_set_db_updated_cb(callback, user_data); - if (ret != MEDIA_CONTENT_ERROR_NONE) { - return LogAndCreateResult( - ErrorCode::UNKNOWN_ERR, "registering the listener is failed.", - ("Failed: registering the listener is failed %d (%s)", ret, get_error_message(ret))); - } - return PlatformResult(ErrorCode::NO_ERROR); -} - -PlatformResult ContentManager::unSetChangeListener() { - ScopeLogger(); - - int ret = media_content_unset_db_updated_cb(); - if (ret != MEDIA_CONTENT_ERROR_NONE) { - return LogAndCreateResult( - ErrorCode::UNKNOWN_ERR, "unregistering the listener is failed.", - ("Failed: unregistering the listener is failed: %d (%s)", ret, get_error_message(ret))); - } - return PlatformResult(ErrorCode::NO_ERROR); -} - void ContentManager::createPlaylist(std::string name, const std::shared_ptr& user_data) { ScopeLogger(); diff --git a/src/content/content_manager.h b/src/content/content_manager.h index 1801ec41..9f86c960 100644 --- a/src/content/content_manager.h +++ b/src/content/content_manager.h @@ -65,8 +65,6 @@ class ContentManager { common::PlatformResult addChangeListener(media_content_noti_h* noti_handle, media_content_db_update_cb callback, void* user_data); common::PlatformResult removeChangeListener(media_content_noti_h noti_handle); - common::PlatformResult setChangeListener(media_content_db_update_cb callback, void* user_data); - common::PlatformResult unSetChangeListener(); // Lyrics int getLyrics(const picojson::value& args, picojson::object& result);