Fix the issue AR sticker was not deleted 63/234863/2
authorInHong Han <inhong1.han@samsung.com>
Fri, 29 May 2020 08:48:09 +0000 (17:48 +0900)
committerInHong Han <inhong1.han@samsung.com>
Fri, 29 May 2020 09:17:20 +0000 (18:17 +0900)
Change-Id: I4d9d03b42cc1efcec64fca87af3c0419b30c11a7

receiver/inc/config.h
receiver/src/ft.cpp

index ecc3c10..bafee30 100644 (file)
@@ -31,4 +31,6 @@
 #define THUMBNAIL_WIDTH 96
 #define THUMBNAIL_HEIGHT 96
 
+#define STICKER_DIRECTORY "/opt/usr/share/sticker-data"
+
 #endif /* __CONFIG_H__ */
index f243539..b90dad1 100644 (file)
@@ -833,11 +833,24 @@ on_data_received(sap_socket_h socket, unsigned short int channel_id, unsigned in
                     LOGD("Add file : %s, len : %d", file_name.c_str(), file_len);
                     total_file_count_in_group++;
                 } else {
-                    LOGD("Delete file : %s, len : %d", file_name.c_str(), file_len);
+                    char *app_id = NULL;
+                    char file_path[PATH_MAX];
+                    char del_path[PATH_MAX];
+                    std::size_t found = file_name.find_last_of("/");
+                    string del_file_name = file_name.substr(found+1);
+                    char *data_path = app_get_shared_data_path();
+                    app_get_id(&app_id);
+                    snprintf(file_path, sizeof(file_path), "%s/%s", data_path, del_file_name.c_str());
+                    snprintf(del_path, sizeof(del_path), "%s/%s%s",STICKER_DIRECTORY, app_id, file_path);
+
+                    LOGD("Delete file : %s, len : %d", del_path, file_len);
                     if (create_sticker_provider_handle() == STICKER_ERROR_NONE) {
-                        delete_sticker_data(file_name.c_str());
+                        delete_sticker_data(del_path);
                         destroy_sticker_provider_handle();
                     }
+
+                    if (app_id)
+                        free(app_id);
                 }
             }
         }