From e8bc0cb40e08a9a6a8b32949909c7bbf1cf8c75f Mon Sep 17 00:00:00 2001 From: InHong Han Date: Thu, 19 Mar 2020 19:12:40 +0900 Subject: [PATCH] Modified to use the new API to delete sticker Change-Id: I4867a69a865bc291b30ef6b867cbc88bd780f7a6 --- receiver/src/sticker_info.cpp | 42 +++--------------------------------------- 1 file changed, 3 insertions(+), 39 deletions(-) diff --git a/receiver/src/sticker_info.cpp b/receiver/src/sticker_info.cpp index 89aedfb..b71c149 100644 --- a/receiver/src/sticker_info.cpp +++ b/receiver/src/sticker_info.cpp @@ -126,46 +126,10 @@ void destroy_sticker_provider_handle(void) sticker_provider = NULL; } -static void _sticker_foreach_cb(sticker_data_h data_handle, void *user_data) -{ - int ret; - char *del_file = (char *)user_data; - sticker_data_uri_type_e type; - char *uri = NULL; - - if (!need_to_retrive) - return; - - ret = sticker_data_get_uri(data_handle, &type, &uri); - if (ret != STICKER_ERROR_NONE) - LOGE("Failed to get sticker uri"); - - int result = (string(uri)).find(del_file); - if (result >= 0) { - LOGI("Delete sticker (%s)", uri); - need_to_retrive = false; - - ret = sticker_provider_delete_data(sticker_provider, data_handle); - if (ret != STICKER_ERROR_NONE) - LOGE("Failed to delete sticker"); - } -} - void delete_sticker_data(const char *fileName) { int ret; - int offset = 0; - int count = 0; - int result = 0; - need_to_retrive = true; - - while (result == count && need_to_retrive) { - count = 20; - ret = sticker_provider_data_foreach_all(sticker_provider, offset, count, &result, _sticker_foreach_cb, (void *)fileName); - offset += result; - if (ret != STICKER_ERROR_NONE) { - LOGE("Failed to retrieve sticker"); - return; - } - } + ret = sticker_provider_delete_data_by_uri(sticker_provider, fileName); + if (ret != STICKER_ERROR_NONE) + LOGE("Failed to delete sticker. ret : %d", ret); } \ No newline at end of file -- 2.7.4