[Content] remove deprecated methods set/unset db updated 35/160835/3 accepted/tizen/unified/20171204.072236 submit/tizen/20171130.124131
authorLukasz Bardeli <l.bardeli@samsung.com>
Mon, 20 Nov 2017 07:43:04 +0000 (08:43 +0100)
committerLukasz Bardeli <l.bardeli@samsung.com>
Fri, 24 Nov 2017 07:42:50 +0000 (08:42 +0100)
          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 <l.bardeli@samsung.com>
src/content/content_instance.cc
src/content/content_manager.cc
src/content/content_manager.h

index 8a3de66..bf65c44 100644 (file)
@@ -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<ReplyCallbackData*>(user_data);
-
-    int ret;
-    picojson::value result = picojson::value(picojson::object());
-    picojson::object& obj = result.get<picojson::object>();
-
-    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<void*>(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(&noti_handle_, changedContentV2Callback,
+            ->addChangeListener(&noti_handle_, changedContentCallback,
                                 static_cast<void*>(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 {
index 9ae3bb4..9f950e2 100644 (file)
@@ -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<ReplyCallbackData>& user_data) {
   ScopeLogger();
index 1801ec4..9f86c96 100644 (file)
@@ -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);