Set the display type of the sticker 22/230922/1
authorInHong Han <inhong1.han@samsung.com>
Thu, 16 Apr 2020 04:39:38 +0000 (13:39 +0900)
committerInHong Han <inhong1.han@samsung.com>
Thu, 16 Apr 2020 04:39:38 +0000 (13:39 +0900)
Change-Id: I86ecc4aa8c13e5d1f0f64d0b9ba5551447a7f00f

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

index 3a70556..9784b5a 100644 (file)
@@ -17,7 +17,7 @@
 #ifndef __STICKER_INFO_H__
 #define __STICKER_INFO_H__
 
-void insert_sticker_data(const char *filepath, const char *keyword, const char *group, const char *desc, const char *thumbnail);
+void insert_sticker_data(const char *filepath, const char *keyword, const char *group, const char *desc, const char *thumbnail, const char *disp_type);
 int create_sticker_provider_handle(void);
 void destroy_sticker_provider_handle(void);
 void delete_sticker_data(const char *fileName);
index eb4e297..2d231d0 100644 (file)
@@ -223,7 +223,8 @@ static void _on_transfer_completed(sap_file_transaction_h file_transaction,
                     sticker_data.thumbnail_path.clear();
                 }
 
-                insert_sticker_data(sticker_data.file_path.c_str(), sticker_data.keyword.c_str(), sticker_data.group.c_str(), sticker_data.description.c_str(), sticker_data.thumbnail_path.c_str());
+                insert_sticker_data(sticker_data.file_path.c_str(), sticker_data.keyword.c_str(), sticker_data.group.c_str(), sticker_data.description.c_str(),
+                                    sticker_data.thumbnail_path.c_str(), sticker_data.disp_type.c_str());
                 destroy_sticker_provider_handle();
 
                 if (unlink(sticker_data.file_path.c_str()) == -1)
index 38c9709..2d5e58d 100644 (file)
@@ -26,7 +26,7 @@ static sticker_provider_h sticker_provider = NULL;
 
 sticker_data_h
 set_sticker_data(sticker_data_uri_type_e type, const char* uri, const char* keyword,
-int len, const char* group, const char* thumbnail, const char* description)
+int len, const char* group, const char* thumbnail, const char* description, sticker_data_display_type_e disp_type)
 {
     sticker_data_h sticker_data;
     int ret;
@@ -78,16 +78,29 @@ int len, const char* group, const char* thumbnail, const char* description)
         LOGE("Failed to set description");
     }
 
+    /* Sets the display type of the sticker.*/
+    ret = sticker_data_set_display_type(sticker_data, disp_type);
+    if (ret != STICKER_ERROR_NONE) {
+        /* Error handling */
+        LOGE("Failed to set display type");
+    }
+
     return sticker_data;
 }
 
 void
-insert_sticker_data(const char *filepath, const char *keyword, const char *group, const char *desc, const char *thumbnail)
+insert_sticker_data(const char *filepath, const char *keyword, const char *group, const char *desc, const char *thumbnail, const char *disp_type)
 {
     sticker_data_h data_handle;
     int ret;
+    sticker_data_display_type_e display_type;
+
+    if (strcmp(disp_type, "input") == 0)
+        display_type = STICKER_DATA_DISP_EMOJI;
+    else
+        display_type = STICKER_DATA_DISP_WALLPAPER;
 
-    data_handle = set_sticker_data(STICKER_DATA_URI_LOCAL_PATH, filepath, keyword, 1, group, thumbnail, desc);
+    data_handle = set_sticker_data(STICKER_DATA_URI_LOCAL_PATH, filepath, keyword, 1, group, thumbnail, desc, display_type);
 
     ret = sticker_provider_insert_data(sticker_provider, data_handle);
     if (ret != STICKER_ERROR_NONE) {