if (origin_handle->date)
handle->date = strdup(origin_handle->date);
+ handle->disp_type = origin_handle->disp_type;
+
*target_handle = handle;
return STICKER_ERROR_NONE;
return STICKER_ERROR_NONE;
}
+
+EXPORT_API int sticker_data_set_display_type(sticker_data_h data_handle, sticker_data_display_type_e type)
+{
+ CHECK_STICKER_FEATURE();
+
+ if (!data_handle || !type || type < STICKER_DATA_DISP_EMOJI || type > STICKER_DATA_DISP_WALLPAPER)
+ return STICKER_ERROR_INVALID_PARAMETER;
+
+ data_handle->disp_type = type;
+
+ return STICKER_ERROR_NONE;
+}
+
+EXPORT_API int sticker_data_get_display_type(sticker_data_h data_handle, sticker_data_display_type_e *type)
+{
+ CHECK_STICKER_FEATURE();
+
+ if (!data_handle || !type)
+ return STICKER_ERROR_INVALID_PARAMETER;
+
+ *type = data_handle->disp_type;
+
+ return STICKER_ERROR_NONE;
+}
\ No newline at end of file
char *group;
char *description;
char *date;
+ sticker_data_display_type_e disp_type;
};
#ifdef __cplusplus
case STICKER_DATA_TYPE_DATE:
sticker_data->date = g_variant_dup_string(value, NULL);
break;
+ case STICKER_DATA_TYPE_DISP_TYPE:
+ sticker_data->disp_type = g_variant_get_int32(value);
+ break;
default:
break;
}
if (sticker_data->description)
g_variant_builder_add(info_builder, "{iv}", STICKER_DATA_TYPE_DESCRIPTION, g_variant_new_string((const gchar *)sticker_data->description));
g_variant_builder_add(info_builder, "{iv}", STICKER_DATA_TYPE_GROUP, g_variant_new_string((const gchar *)sticker_data->group));
+ g_variant_builder_add(info_builder, "{iv}", STICKER_DATA_TYPE_DISP_TYPE, g_variant_new_int32(sticker_data->disp_type));
keyword_builder = g_variant_builder_new(G_VARIANT_TYPE("a(s)"));
g_list_foreach(sticker_data->keyword, (GFunc) _set_keyword_builder, keyword_builder);
STICKER_DATA_TYPE_GROUP,
STICKER_DATA_TYPE_KEYWORD,
STICKER_DATA_TYPE_DATE,
+ STICKER_DATA_TYPE_DISP_TYPE,
} STICKER_DAT_TYPE;
#ifdef __cplusplus
} sticker_data_uri_type_e;
/**
+ * @brief Enumeration for sticker display type.
+ *
+ * @since_tizen 5.5
+ */
+typedef enum {
+ STICKER_DATA_DISP_EMOJI = 1, /**< Emoji type */
+ STICKER_DATA_DISP_WALLPAPER, /**< Wallpaper type */
+} sticker_data_display_type_e;
+
+/**
* @brief The sticker data handle.
* @since_tizen 5.5
*/
int sticker_data_get_date(sticker_data_h data_handle, char **date);
/**
+ * @brief Sets the display type of the sticker.
+ * @since_tizen 5.5
+ * @param[in] data_handle The sticker data handle
+ * @param[in] type The display type to be saved
+ * @return 0 on success, otherwise a negative error value
+ * @retval #STICKER_ERROR_NONE Successful
+ * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported
+ * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see sticker_data_get_display_type()
+ */
+int sticker_data_set_display_type(sticker_data_h data_handle, sticker_data_display_type_e type);
+
+/**
+ * @brief Gets the display type from sticker data handle.
+ * @details If the display type is empty, the result will be a zero.
+ * @since_tizen 5.5
+ * @param[in] data_handle The sticker data handle
+ * @param[out] type The display type of the sticker
+ * @return 0 on success, otherwise a negative error value
+ * @retval #STICKER_ERROR_NONE Successful
+ * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported
+ * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see sticker_data_set_display_type()
+ */
+int sticker_data_get_display_type(sticker_data_h data_handle, sticker_data_display_type_e *type);
+
+/**
* @}
*/
/**
* @brief Inserts a sticker data to the sticker database.
* @since_tizen 5.5
- * @remarks All data except thumbnail and description must be set in the @a data_handle to insert the sticker data.
+ * @remarks All data except thumbnail, description, display_type must be set in the @a data_handle to insert the sticker data.
* If the uri type is #STICKER_DATA_URI_LOCAL_PATH, the sticker file is copied to a sticker directory.
* It is recommended to delete your sticker file after inserting a sticker data.
* @param[in] provider_handle The sticker provider handle
* @brief Inserts a sticker data using json file.
* @details @a json_path must be a relative path like '/data/message_sticker.json'.
* @since_tizen 5.5
- * @remarks All data except thumbnail and description must be set in the json file to insert the sticker data.
+ * @remarks All data except thumbnail, description, display_type must be set in the json file to insert the sticker data.
* @a json_path must have a non-null value and must be an existing file. If not, the error as invalid parameter will be returned.
* If the uri type is #STICKER_DATA_URI_LOCAL_PATH, the sticker file is copied to a sticker directory.
* It is recommended to delete your sticker files after inserting a sticker data.
"keyword" : ["heart eyes", "love", "cute"],
"group" : "face",
"thumbnail" : "/res/face/thumbnail/heart_eyes.png",
- "description" : "Smiling face with heart eyes emoji."
+ "description" : "Smiling face with heart eyes emoji.",
+ "display_type" : 1
},
{
"type" : 2,
"keyword" : ["smile", "high five"],
"group" : "face",
"thumbnail" : "",
- "description" : "Smiling face with high five emoji."
+ "description" : "Smiling face with high five emoji.",
+ "display_type" : null
},
.....
{
case STICKER_DATA_TYPE_GROUP:
sticker_info->group = (char *) g_variant_get_string(value, NULL);
break;
+ case STICKER_DATA_TYPE_DISP_TYPE:
+ sticker_info->display_type = g_variant_get_int32(value);
default:
break;
}
sticker_info->description = _get_string_from_object(info_object, "description");
+ sticker_info->display_type = _get_int_from_object(info_object, "display_type");
+
JsonArray *keyword_arr = json_object_get_array_member(info_object, "keyword");
int keyword_arr_len = json_array_get_length(keyword_arr);
if (keyword_arr_len < 1)
g_variant_builder_add(info_builder, "{iv}", STICKER_DATA_TYPE_DESCRIPTION, g_variant_new_string((const gchar *)sticker_info->description));
g_variant_builder_add(info_builder, "{iv}", STICKER_DATA_TYPE_GROUP, g_variant_new_string((const gchar *)sticker_info->group));
g_variant_builder_add(info_builder, "{iv}", STICKER_DATA_TYPE_DATE, g_variant_new_string((const gchar *)sticker_info->date));
+ g_variant_builder_add(info_builder, "{iv}", STICKER_DATA_TYPE_DISP_TYPE, g_variant_new_int32(sticker_info->display_type));
keyword_builder = g_variant_builder_new(G_VARIANT_TYPE("a(s)"));
g_list_foreach(sticker_info->keyword, (GFunc) _set_keyword_builder, keyword_builder);
* Table Information
*
* sticker_info
- * +-----------------+--------+------+------+-----------+-------------+------------+------+
- * | INT | TEXT | INT | TEXT | TEXT | TEXT | TEXT | TEXT |
- * +-----------------+--------+------+------+-----------+-------------+------------+------+
- * | sticker_info_id | app_id | type | uri | thumbnail | description | group_name | date |
- * +-----------------+--------+------+------+-----------+-------------+------------+------+
+ * +-----------------+--------+------+------+-----------+-------------+------------+------+--------------+
+ * | INT | TEXT | INT | TEXT | TEXT | TEXT | TEXT | TEXT | INT |
+ * +-----------------+--------+------+------+-----------+-------------+------------+------+--------------+
+ * | sticker_info_id | app_id | type | uri | thumbnail | description | group_name | date | display_type |
+ * +-----------------+--------+------+------+-----------+-------------+------------+------+--------------+
*
* sticker_keyword_info
* +------------+-----------------+---------+
*/
#define STICKER_DB_PATH tzplatform_mkpath(TZ_SYS_DB, ".sticker_info.db")
-#define STICKER_INFO_CREATE_TABLE "CREATE TABLE IF NOT EXISTS sticker_info(sticker_info_id INTEGER PRIMARY KEY AUTOINCREMENT, app_id TEXT NOT NULL, type INTEGER NOT NULL, uri TEXT NOT NULL, thumbnail TEXT, description TEXT, group_name TEXT NOT NULL, date TEXT NOT NULL)"
+#define STICKER_INFO_CREATE_TABLE "CREATE TABLE IF NOT EXISTS sticker_info(sticker_info_id INTEGER PRIMARY KEY AUTOINCREMENT, app_id TEXT NOT NULL, type INTEGER NOT NULL, uri TEXT NOT NULL, thumbnail TEXT, description TEXT, group_name TEXT NOT NULL, date TEXT NOT NULL, display_type INTEGER)"
#define STICKER_KEYWORD_INFO_CREATE_TABLE "CREATE TABLE IF NOT EXISTS sticker_keyword_info(keyword_id INTEGER PRIMARY KEY AUTOINCREMENT, sticker_info_id INTEGER, keyword TEXT NOT NULL, FOREIGN KEY (sticker_info_id) REFERENCES sticker_info(sticker_info_id) ON DELETE CASCADE)"
#define STICKER_WHITELIST_INFO_CREATE_TABLE "CREATE TABLE IF NOT EXISTS sticker_whitelist_info(whitelist_id INTEGER PRIMARY KEY AUTOINCREMENT, provider_id TEXT NOT NULL, consumer_id TEXT NOT NULL)"
-#define STICKER_DB_INSERT_STICKER_INFO "INSERT INTO sticker_info (app_id, type, uri, thumbnail, description, group_name, date) VALUES (?, ?, ?, ?, ?, ?, DateTime('now','localtime'))"
+#define STICKER_DB_INSERT_STICKER_INFO "INSERT INTO sticker_info (app_id, type, uri, thumbnail, description, group_name, date, display_type) VALUES (?, ?, ?, ?, ?, ?, DateTime('now','localtime'), ?)"
#define STICKER_DB_INSERT_STICKER_KEYWORD_INFO "INSERT INTO sticker_keyword_info (sticker_info_id, keyword) VALUES (?, ?)"
#define STICKER_DB_DELETE_STICKER_INFO "DELETE FROM sticker_info WHERE sticker_info_id = ?"
sqlite3_bind_text(stmt, 4, sticker_info->thumbnail, -1, SQLITE_TRANSIENT);
sqlite3_bind_text(stmt, 5, sticker_info->description, -1, SQLITE_TRANSIENT);
sqlite3_bind_text(stmt, 6, sticker_info->group, -1, SQLITE_TRANSIENT);
+ sqlite3_bind_int(stmt, 7, sticker_info->display_type);
ret = sqlite3_step(stmt);
if (ret != SQLITE_OK && ret != SQLITE_DONE) {
if (tmp_date)
sticker_info->date = strdup((const char *)tmp_date);
+ sticker_info->display_type = sqlite3_column_int(stmt, 8);
+
sqlite3_finalize(stmt);
stmt = NULL;
char *group;
GList *keyword;
char *date;
+ int display_type;
} sticker_info_db;
int stickerd_db_init(void);
#define LOG_TAG "STICKER_PARSER"
#define STICKER_DIRECTORY tzplatform_mkpath(TZ_SYS_SHARE, "sticker-data")
-#define STICKER_INFO_CREATE_TABLE "CREATE TABLE IF NOT EXISTS sticker_info(sticker_info_id INTEGER PRIMARY KEY AUTOINCREMENT, app_id TEXT NOT NULL, type INTEGER NOT NULL, uri TEXT NOT NULL, thumbnail TEXT, description TEXT, group_name TEXT NOT NULL, date TEXT NOT NULL)"
+#define STICKER_INFO_CREATE_TABLE "CREATE TABLE IF NOT EXISTS sticker_info(sticker_info_id INTEGER PRIMARY KEY AUTOINCREMENT, app_id TEXT NOT NULL, type INTEGER NOT NULL, uri TEXT NOT NULL, thumbnail TEXT, description TEXT, group_name TEXT NOT NULL, date TEXT NOT NULL, display_type INTEGER)"
#define STICKER_KEYWORD_INFO_CREATE_TABLE "CREATE TABLE IF NOT EXISTS sticker_keyword_info(keyword_id INTEGER PRIMARY KEY AUTOINCREMENT, sticker_info_id INTEGER, keyword TEXT NOT NULL, FOREIGN KEY (sticker_info_id) REFERENCES sticker_info(sticker_info_id) ON DELETE CASCADE)"
#define STICKER_WHITELIST_INFO_CREATE_TABLE "CREATE TABLE IF NOT EXISTS sticker_whitelist_info(whitelist_id INTEGER PRIMARY KEY AUTOINCREMENT, provider_id TEXT NOT NULL, consumer_id TEXT NOT NULL)"
#define UIFW_ID 502
}
}
-static void __insert_sticker_info(const char *app_id, int type, const char *uri, const char *group, const char *thumbnail, const char *description)
+static void __insert_sticker_info(const char *app_id, int type, const char *uri, const char *group, const char *thumbnail, const char *description, int disp_type)
{
int ret;
sqlite3 *db = NULL;
if (!db)
return;
- ret = sqlite3_prepare_v2(db, "INSERT INTO sticker_info (app_id, type, uri, thumbnail, description, group_name, date) VALUES (?, ?, ?, ?, ?, ?, DateTime('now','localtime'))",-1, &stmt, NULL);
+ ret = sqlite3_prepare_v2(db, "INSERT INTO sticker_info (app_id, type, uri, thumbnail, description, group_name, date, display_type) VALUES (?, ?, ?, ?, ?, ?, DateTime('now','localtime'), ?)",-1, &stmt, NULL);
if (ret == SQLITE_OK) {
sqlite3_bind_text(stmt, 1, app_id, -1, SQLITE_TRANSIENT);
sqlite3_bind_int(stmt, 2, type);
sqlite3_bind_text(stmt, 4, thumbnail, -1, SQLITE_TRANSIENT);
sqlite3_bind_text(stmt, 5, description, -1, SQLITE_TRANSIENT);
sqlite3_bind_text(stmt, 6, group, -1, SQLITE_TRANSIENT);
+ sqlite3_bind_int(stmt, 7, disp_type);
ret = sqlite3_step(stmt);
if (ret != SQLITE_OK && ret != SQLITE_DONE)
thumbnail = __get_string_from_object(info_object, "thumbnail");
description = __get_string_from_object(info_object, "description");
+ int disp_type = __get_int_from_object(info_object, "display_type");
JsonArray *keyword_arr = json_object_get_array_member(info_object, "keyword");
int keyword_arr_len = json_array_get_length(keyword_arr);
char *new_uri = __convert_sticker_uri(uri, appid, app_path);
if (!new_uri)
goto free_memory;
- __insert_sticker_info(appid, type, new_uri, group, thumbnail, description);
+ __insert_sticker_info(appid, type, new_uri, group, thumbnail, description, disp_type);
if (new_uri) {
free(new_uri);
uri_path = NULL;
goto free_memory;
}
- __insert_sticker_info(appid, type, new_uri, group, thumbnail, description);
+ __insert_sticker_info(appid, type, new_uri, group, thumbnail, description, disp_type);
free(new_uri);
new_uri = NULL;
}
}
} else {
- __insert_sticker_info(appid, type, uri, group, thumbnail, description);
+ __insert_sticker_info(appid, type, uri, group, thumbnail, description, disp_type);
}
for (int j = 0; j < keyword_arr_len; j++) {