From: InHong Han Date: Thu, 19 Mar 2020 10:12:40 +0000 (+0900) Subject: Modified to use the new API to delete sticker X-Git-Tag: accepted/tizen/5.5/unified/20200324.134509~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e8bc0cb40e08a9a6a8b32949909c7bbf1cf8c75f;p=platform%2Fcore%2Fuifw%2Fcapi-ui-sticker.git Modified to use the new API to delete sticker Change-Id: I4867a69a865bc291b30ef6b867cbc88bd780f7a6 --- 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