Remove sticker file after inserting DB 50/225450/1
authorInHong Han <inhong1.han@samsung.com>
Thu, 20 Feb 2020 04:59:18 +0000 (13:59 +0900)
committerInHong Han <inhong1.han@samsung.com>
Thu, 20 Feb 2020 04:59:18 +0000 (13:59 +0900)
Change-Id: I9dccbca14e1a90ee4d188456c65945e8c90f766e

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

index e65c244..27f2206 100644 (file)
@@ -4,7 +4,7 @@
 #define TAG "STICKER_RECEIVER"
 
 void insert_sticker_data(const char *filepath, const char *keyword, const char *group, const char *desc);
-void create_sticker_provider_handle(void);
+int create_sticker_provider_handle(void);
 void destroy_sticker_provider_handle(void);
 
 #endif /* __STICKER_INF_H__ */
index b073de7..c5ccfbf 100644 (file)
@@ -69,9 +69,13 @@ static void _on_send_completed(sap_file_transaction_h file_transaction,
                }
                else {
                        dlog_print(DLOG_INFO, TAG, "Succeed to change permission : %s", recv_filepath.c_str());
-                       create_sticker_provider_handle();
-                       insert_sticker_data(recv_filepath.c_str(), "keyword", "group", "test icon");
-                       destroy_sticker_provider_handle();
+                       if (create_sticker_provider_handle() == STICKER_ERROR_NONE) {
+                               insert_sticker_data(recv_filepath.c_str(), "keyword", "group", "test icon");
+                               destroy_sticker_provider_handle();
+
+                               if (unlink(recv_filepath.c_str()) == -1)
+                                       dlog_print(DLOG_ERROR, TAG, "Failed to remove sticker file");
+                       }
                }
        } else {
                switch (result) {
index 280b357..0282163 100644 (file)
@@ -89,7 +89,7 @@ insert_sticker_data(const char *filepath, const char *keyword, const char *group
     }
 }
 
-void create_sticker_provider_handle(void)
+int create_sticker_provider_handle(void)
 {
     int ret;
     ret = sticker_provider_create(&sticker_provider);
@@ -97,6 +97,8 @@ void create_sticker_provider_handle(void)
         /* Error handling */
         dlog_print(DLOG_ERROR, TAG, "Failed to create sticker provider");
     }
+
+    return ret;
 }
 
 void destroy_sticker_provider_handle(void)