From d0057bd4c4558668e3c54c3f717c8cfcd99a60d8 Mon Sep 17 00:00:00 2001 From: InHong Han Date: Tue, 12 May 2020 10:42:46 +0900 Subject: [PATCH 01/16] Update package version to 0.1.46 Change-Id: I3f420ed2d840f73a12c82dce46154db70273d32e --- packaging/capi-ui-sticker.spec | 2 +- receiver/tizen-manifest.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packaging/capi-ui-sticker.spec b/packaging/capi-ui-sticker.spec index c3f1454..fa59d3f 100644 --- a/packaging/capi-ui-sticker.spec +++ b/packaging/capi-ui-sticker.spec @@ -1,6 +1,6 @@ Name: capi-ui-sticker Summary: Sticker client library and daemon -Version: 0.1.45 +Version: 0.1.46 Release: 1 Group: Graphics & UI Framework/Input License: Apache-2.0 diff --git a/receiver/tizen-manifest.xml b/receiver/tizen-manifest.xml index 2a9bd06..307d7db 100644 --- a/receiver/tizen-manifest.xml +++ b/receiver/tizen-manifest.xml @@ -1,5 +1,5 @@ - + -- 2.7.4 From c831b0b50625fb9164fb3d07fc438c27c61ffcc9 Mon Sep 17 00:00:00 2001 From: InHong Han Date: Thu, 14 May 2020 15:52:45 +0900 Subject: [PATCH 02/16] Modified to not change return value Change-Id: Ie0ca9082d13018cef06b7e45a80c0a07ecea3622 --- client/sticker_data.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/client/sticker_data.c b/client/sticker_data.c index 5b6b7ae..cb5c427 100644 --- a/client/sticker_data.c +++ b/client/sticker_data.c @@ -318,9 +318,9 @@ cleanup: _free_sticker_data(handle); if (gdbus_connection) { - ret = sticker_dbus_shutdown(gdbus_connection, &server_watcher_id, &server_monitor_id, &monitor_id, STICKER_CLIENT_LIB_PROVIDER); - if (ret != STICKER_ERROR_NONE) - LOGE("Failed to finalize dbus : %d", ret); + int ret_err = sticker_dbus_shutdown(gdbus_connection, &server_watcher_id, &server_monitor_id, &monitor_id, STICKER_CLIENT_LIB_PROVIDER); + if (ret_err != STICKER_ERROR_NONE) + LOGE("Failed to finalize dbus : %d", ret_err); g_object_unref(gdbus_connection); } -- 2.7.4 From 9cb6a838f4c8b34a5be6ff857ed39a19aae4b927 Mon Sep 17 00:00:00 2001 From: InHong Han Date: Thu, 14 May 2020 15:55:47 +0900 Subject: [PATCH 03/16] Update package version to 0.1.47 Change-Id: Iccd9d7d4e0354c24a23196e7a26f5d4357a4487f --- packaging/capi-ui-sticker.spec | 2 +- receiver/tizen-manifest.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packaging/capi-ui-sticker.spec b/packaging/capi-ui-sticker.spec index fa59d3f..acfd81d 100644 --- a/packaging/capi-ui-sticker.spec +++ b/packaging/capi-ui-sticker.spec @@ -1,6 +1,6 @@ Name: capi-ui-sticker Summary: Sticker client library and daemon -Version: 0.1.46 +Version: 0.1.47 Release: 1 Group: Graphics & UI Framework/Input License: Apache-2.0 diff --git a/receiver/tizen-manifest.xml b/receiver/tizen-manifest.xml index 307d7db..a788ce2 100644 --- a/receiver/tizen-manifest.xml +++ b/receiver/tizen-manifest.xml @@ -1,5 +1,5 @@ - + -- 2.7.4 From 0705df06a179d918e03837b53abdfa325fe5c533 Mon Sep 17 00:00:00 2001 From: InHong Han Date: Fri, 15 May 2020 12:35:58 +0900 Subject: [PATCH 04/16] Delete all bitmoji stickers before synchronizing them Change-Id: I09540680be692fd10aba742593a9c688b011d825 --- receiver/src/ft.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/receiver/src/ft.cpp b/receiver/src/ft.cpp index 044c21e..4e03352 100644 --- a/receiver/src/ft.cpp +++ b/receiver/src/ft.cpp @@ -754,7 +754,15 @@ on_data_received(sap_socket_h socket, unsigned short int channel_id, unsigned in send_sync_start_response(result_code); - if (result_code == SYNC_START_RSP_NO_STICKER) { + if(result_code == SYNC_START_RSP_SUCCESS) { + if (current_request.category == string("bitmoji")) { + LOGD("Delete all bitmoji stickers"); + if (create_sticker_provider_handle() == STICKER_ERROR_NONE) { + delete_all_bitmoji_stickers(); + destroy_sticker_provider_handle(); + } + } + } else if (result_code == SYNC_START_RSP_NO_STICKER) { if (!process_request_queue()) { #ifdef VCONFKEY_STICKER_SUPPORTED_FEATURE int feature_flag = 0; -- 2.7.4 From 7eb1ffdbfc90ebd868b15e2385c6f622ec26e2b3 Mon Sep 17 00:00:00 2001 From: InHong Han Date: Fri, 15 May 2020 15:27:31 +0900 Subject: [PATCH 05/16] Fix the issue no_sticker message was not delivered after OOBE Change-Id: I83fde1a99c224f25b345d05a00918fd3143e8dba --- receiver/src/ft.cpp | 42 ++++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/receiver/src/ft.cpp b/receiver/src/ft.cpp index 4e03352..1ab77b0 100644 --- a/receiver/src/ft.cpp +++ b/receiver/src/ft.cpp @@ -634,7 +634,7 @@ static void send_sync_start_response(int result_code) int feature_flag = 0; string response_to_app; switch (result_code) { - case SYNC_START_RSP_SUCCESS || SYNC_START_RSP_BITMOJI_ALL_DELETE: + case SYNC_START_RSP_SUCCESS: { response_to_app = "success"; if (current_request.category == string("arsticker")) @@ -646,6 +646,18 @@ static void send_sync_start_response(int result_code) case SYNC_START_RSP_NO_STICKER: response_to_app = "no_sticker"; break; + case SYNC_START_RSP_BITMOJI_ALL_DELETE: + { + int is_synced = 0; + if (vconf_get_int(VCONFKEY_STICKER_SYNC_COMPLETE, &is_synced) != 0) + LOGW("Failed to read sync completion"); + + if (is_synced == VCONFKEY_STICKER_SYNC_COMPLETE_NONE) + response_to_app = "no_sticker"; + else + response_to_app = "success"; + break; + } default: response_to_app = "unknown_error"; break; @@ -752,9 +764,8 @@ on_data_received(sap_socket_h socket, unsigned short int channel_id, unsigned in int result_code = json_object_get_int_member(root_obj, "resultCode"); LOGD("result : %s, resultCode : %d", result.c_str(), result_code); - send_sync_start_response(result_code); - if(result_code == SYNC_START_RSP_SUCCESS) { + send_sync_start_response(result_code); if (current_request.category == string("bitmoji")) { LOGD("Delete all bitmoji stickers"); if (create_sticker_provider_handle() == STICKER_ERROR_NONE) { @@ -762,7 +773,15 @@ on_data_received(sap_socket_h socket, unsigned short int channel_id, unsigned in destroy_sticker_provider_handle(); } } - } else if (result_code == SYNC_START_RSP_NO_STICKER) { + } else { + if (result_code == SYNC_START_RSP_BITMOJI_ALL_DELETE) { + LOGD("Delete all bitmoji stickers"); + if (create_sticker_provider_handle() == STICKER_ERROR_NONE) { + delete_all_bitmoji_stickers(); + destroy_sticker_provider_handle(); + } + } + if (!process_request_queue()) { #ifdef VCONFKEY_STICKER_SUPPORTED_FEATURE int feature_flag = 0; @@ -788,25 +807,12 @@ on_data_received(sap_socket_h socket, unsigned short int channel_id, unsigned in LOGW("No vconf supported feature"); #endif /* VCONFKEY_STICKER_SUPPORTED_FEATURE */ + send_sync_start_response(result_code); set_sync_progressing(FALSE); save_last_sync_time(); quit(); } - } else if (result_code == SYNC_START_RSP_BITMOJI_ALL_DELETE) { - LOGD("Delete all bitmoji stickers"); - if (create_sticker_provider_handle() == STICKER_ERROR_NONE) { - delete_all_bitmoji_stickers(); - destroy_sticker_provider_handle(); - } - - set_sync_progressing(FALSE); - save_last_sync_time(); - - if (!process_request_queue()) { - sync_success_cnt = 0; - quit(); - } } } else if (msg_id == STICKER_SEND_START_REQ) { LOGD("msg : %s", msg_id.c_str()); -- 2.7.4 From 2181271e0c24c11226cb2ebed7fdf3326adb4e56 Mon Sep 17 00:00:00 2001 From: InHong Han Date: Fri, 15 May 2020 15:30:35 +0900 Subject: [PATCH 06/16] Update package version to 0.1.48 Change-Id: I437fb131fb57044a34661d6d51b2dad7c9c6eb20 --- packaging/capi-ui-sticker.spec | 2 +- receiver/tizen-manifest.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packaging/capi-ui-sticker.spec b/packaging/capi-ui-sticker.spec index acfd81d..652ec6c 100644 --- a/packaging/capi-ui-sticker.spec +++ b/packaging/capi-ui-sticker.spec @@ -1,6 +1,6 @@ Name: capi-ui-sticker Summary: Sticker client library and daemon -Version: 0.1.47 +Version: 0.1.48 Release: 1 Group: Graphics & UI Framework/Input License: Apache-2.0 diff --git a/receiver/tizen-manifest.xml b/receiver/tizen-manifest.xml index a788ce2..fdf99da 100644 --- a/receiver/tizen-manifest.xml +++ b/receiver/tizen-manifest.xml @@ -1,5 +1,5 @@ - + -- 2.7.4 From 54e45a83c8caca4af16e43b672f0a8140171fb0f Mon Sep 17 00:00:00 2001 From: InHong Han Date: Fri, 15 May 2020 20:20:55 +0900 Subject: [PATCH 07/16] Change sticker directory to TZ_USER_SHARE Change-Id: If2652a9659688a1638d4643e53081bbb16855395 --- client/sticker_dbus.c | 2 +- packaging/capi-ui-sticker.spec | 10 +++++----- server/stickerd_data_manager.c | 2 +- sticker-parser/sticker-parser.c | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/client/sticker_dbus.c b/client/sticker_dbus.c index 6cf0088..ff54639 100644 --- a/client/sticker_dbus.c +++ b/client/sticker_dbus.c @@ -23,7 +23,7 @@ #endif #define LOG_TAG "STICKER_DBUS" -#define STICKER_DIRECTORY tzplatform_mkpath(TZ_SYS_SHARE, "sticker-data") +#define STICKER_DIRECTORY tzplatform_mkpath(TZ_USER_SHARE, "sticker-data") static int is_server_started = 0; static CLIENT_LIB last_req_lib = STICKER_CLIENT_LIB_NONE; diff --git a/packaging/capi-ui-sticker.spec b/packaging/capi-ui-sticker.spec index 652ec6c..0f880c6 100644 --- a/packaging/capi-ui-sticker.spec +++ b/packaging/capi-ui-sticker.spec @@ -101,7 +101,7 @@ export FFLAGS+=" -DTIZEN_DEBUG_ENABLE -fvisibility=hidden" -DCOMPANION_MODE=true \ %endif -DCMAKE_INSTALL_PREFIX=/usr -DLIBDIR=%{_libdir} -DBINDIR=%{_bindir} -DINCLUDEDIR=%{_includedir} \ - -DTZ_SYS_RO_SHARE=%TZ_SYS_RO_SHARE -DTZ_SYS_BIN=%TZ_SYS_BIN -DTZ_SYS_SHARE=%TZ_SYS_SHARE \ + -DTZ_SYS_RO_SHARE=%TZ_SYS_RO_SHARE -DTZ_SYS_BIN=%TZ_SYS_BIN -DTZ_USER_SHARE=%TZ_USER_SHARE \ -DTZ_SYS_RO_APP=%TZ_SYS_RO_APP -DTZ_SYS_RO_PACKAGES=%TZ_SYS_RO_PACKAGES make %{?jobs:-j%jobs} @@ -142,10 +142,10 @@ install -m 0644 gcov-obj/* %{buildroot}%{_datadir}/gcov/obj %post /sbin/ldconfig -mkdir -p -m 0775 %{TZ_SYS_SHARE}/sticker-data -chown -R ui_fw:ui_fw %{TZ_SYS_SHARE}/sticker-data -chsmack -t %{TZ_SYS_SHARE}/sticker-data -chsmack -a "System::Shared" %{TZ_SYS_SHARE}/sticker-data +mkdir -p -m 0775 %{TZ_USER_SHARE}/sticker-data +chown -R ui_fw:ui_fw %{TZ_USER_SHARE}/sticker-data +chsmack -t %{TZ_USER_SHARE}/sticker-data +chsmack -a "System::Shared" %{TZ_USER_SHARE}/sticker-data %postun -p /sbin/ldconfig diff --git a/server/stickerd_data_manager.c b/server/stickerd_data_manager.c index c731971..60b1a22 100644 --- a/server/stickerd_data_manager.c +++ b/server/stickerd_data_manager.c @@ -39,7 +39,7 @@ #endif #define LOG_TAG "STICKERD_DATA_MANAGER" -#define STICKER_DIRECTORY tzplatform_mkpath(TZ_SYS_SHARE, "sticker-data") +#define STICKER_DIRECTORY tzplatform_mkpath(TZ_USER_SHARE, "sticker-data") #define MAX_ERROR_BUFFER 256 static GHashTable *_monitoring_hash = NULL; diff --git a/sticker-parser/sticker-parser.c b/sticker-parser/sticker-parser.c index a9c92ea..3b25fca 100644 --- a/sticker-parser/sticker-parser.c +++ b/sticker-parser/sticker-parser.c @@ -40,7 +40,7 @@ #endif #define LOG_TAG "STICKER_PARSER" -#define STICKER_DIRECTORY tzplatform_mkpath(TZ_SYS_SHARE, "sticker-data") +#define STICKER_DIRECTORY tzplatform_mkpath(TZ_USER_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, 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)" -- 2.7.4 From cbe27384744716d9a1641f0dee455cc31186f164 Mon Sep 17 00:00:00 2001 From: InHong Han Date: Fri, 15 May 2020 20:24:44 +0900 Subject: [PATCH 08/16] Update package version to 0.1.49 Change-Id: I93b575249dc0622ecb2cfc068f7fbd66e8216607 --- packaging/capi-ui-sticker.spec | 2 +- receiver/tizen-manifest.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packaging/capi-ui-sticker.spec b/packaging/capi-ui-sticker.spec index 0f880c6..cca6428 100644 --- a/packaging/capi-ui-sticker.spec +++ b/packaging/capi-ui-sticker.spec @@ -1,6 +1,6 @@ Name: capi-ui-sticker Summary: Sticker client library and daemon -Version: 0.1.48 +Version: 0.1.49 Release: 1 Group: Graphics & UI Framework/Input License: Apache-2.0 diff --git a/receiver/tizen-manifest.xml b/receiver/tizen-manifest.xml index fdf99da..4eeb56e 100644 --- a/receiver/tizen-manifest.xml +++ b/receiver/tizen-manifest.xml @@ -1,5 +1,5 @@ - + -- 2.7.4 From 9b7f91d94a609ea8cd6c9701b7e418fcb1f8c6fd Mon Sep 17 00:00:00 2001 From: InHong Han Date: Fri, 15 May 2020 22:21:27 +0900 Subject: [PATCH 09/16] Added temporary solution to change sticker directory Change-Id: I364c2b34403af16ab88f42a951ced0b0d4913093 --- client/sticker_dbus.c | 2 +- packaging/capi-ui-sticker.spec | 8 ++++---- server/stickerd_data_manager.c | 2 +- sticker-parser/sticker-parser.c | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/client/sticker_dbus.c b/client/sticker_dbus.c index ff54639..a3c9cfa 100644 --- a/client/sticker_dbus.c +++ b/client/sticker_dbus.c @@ -23,7 +23,7 @@ #endif #define LOG_TAG "STICKER_DBUS" -#define STICKER_DIRECTORY tzplatform_mkpath(TZ_USER_SHARE, "sticker-data") +#define STICKER_DIRECTORY "/opt/usr/share/sticker-data" static int is_server_started = 0; static CLIENT_LIB last_req_lib = STICKER_CLIENT_LIB_NONE; diff --git a/packaging/capi-ui-sticker.spec b/packaging/capi-ui-sticker.spec index cca6428..f0b9a81 100644 --- a/packaging/capi-ui-sticker.spec +++ b/packaging/capi-ui-sticker.spec @@ -142,10 +142,10 @@ install -m 0644 gcov-obj/* %{buildroot}%{_datadir}/gcov/obj %post /sbin/ldconfig -mkdir -p -m 0775 %{TZ_USER_SHARE}/sticker-data -chown -R ui_fw:ui_fw %{TZ_USER_SHARE}/sticker-data -chsmack -t %{TZ_USER_SHARE}/sticker-data -chsmack -a "System::Shared" %{TZ_USER_SHARE}/sticker-data +mkdir -p -m 0775 /opt/usr/share/sticker-data +chown -R ui_fw:ui_fw /opt/usr/share/sticker-data +chsmack -t /opt/usr/share/sticker-data +chsmack -a "User::App::Shared" /opt/usr/share/sticker-data %postun -p /sbin/ldconfig diff --git a/server/stickerd_data_manager.c b/server/stickerd_data_manager.c index 60b1a22..1be9971 100644 --- a/server/stickerd_data_manager.c +++ b/server/stickerd_data_manager.c @@ -39,7 +39,7 @@ #endif #define LOG_TAG "STICKERD_DATA_MANAGER" -#define STICKER_DIRECTORY tzplatform_mkpath(TZ_USER_SHARE, "sticker-data") +#define STICKER_DIRECTORY "/opt/usr/share/sticker-data" #define MAX_ERROR_BUFFER 256 static GHashTable *_monitoring_hash = NULL; diff --git a/sticker-parser/sticker-parser.c b/sticker-parser/sticker-parser.c index 3b25fca..a54e9ab 100644 --- a/sticker-parser/sticker-parser.c +++ b/sticker-parser/sticker-parser.c @@ -40,7 +40,7 @@ #endif #define LOG_TAG "STICKER_PARSER" -#define STICKER_DIRECTORY tzplatform_mkpath(TZ_USER_SHARE, "sticker-data") +#define STICKER_DIRECTORY "/opt/usr/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, 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)" -- 2.7.4 From ac6f8f640d45b5d5acf1dd967c8dfc0cc03d69a8 Mon Sep 17 00:00:00 2001 From: InHong Han Date: Thu, 28 May 2020 13:55:38 +0900 Subject: [PATCH 10/16] Fix the issue sync_stop_result message was not delivered when disconnected with the mobile Change-Id: I113cd6ab396a4a3f13a717930dba512ee7079e0d --- receiver/src/ft.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/receiver/src/ft.cpp b/receiver/src/ft.cpp index 1ab77b0..f243539 100644 --- a/receiver/src/ft.cpp +++ b/receiver/src/ft.cpp @@ -619,6 +619,7 @@ void conn_terminated(sap_peer_agent_h peer_agent, priv->socket = NULL; set_sync_progressing(FALSE); + send_message("sync_stop_result", "cancel"); service_app_exit(); } @@ -1188,6 +1189,7 @@ static void _on_device_status_changed(sap_device_status_e status, switch (status) { case SAP_DEVICE_STATUS_DETACHED: LOGD("device is not connected."); + send_message("sync_stop_result", "cancel"); break; case SAP_DEVICE_STATUS_ATTACHED: LOGD("Attached calling find peer now"); -- 2.7.4 From 86cf72b6f6fe1594ce35c19802ce711f87165be6 Mon Sep 17 00:00:00 2001 From: InHong Han Date: Thu, 28 May 2020 13:57:48 +0900 Subject: [PATCH 11/16] Update package version to 0.1.50 Change-Id: I4725f2e2c283691023b08184e76f48fe051eb298 --- packaging/capi-ui-sticker.spec | 2 +- receiver/tizen-manifest.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packaging/capi-ui-sticker.spec b/packaging/capi-ui-sticker.spec index f0b9a81..11ab9df 100644 --- a/packaging/capi-ui-sticker.spec +++ b/packaging/capi-ui-sticker.spec @@ -1,6 +1,6 @@ Name: capi-ui-sticker Summary: Sticker client library and daemon -Version: 0.1.49 +Version: 0.1.50 Release: 1 Group: Graphics & UI Framework/Input License: Apache-2.0 diff --git a/receiver/tizen-manifest.xml b/receiver/tizen-manifest.xml index 4eeb56e..0f9aed4 100644 --- a/receiver/tizen-manifest.xml +++ b/receiver/tizen-manifest.xml @@ -1,5 +1,5 @@ - + -- 2.7.4 From 7b9a13093ad4a6357c79fbd2365ffc6c8fcafeb5 Mon Sep 17 00:00:00 2001 From: InHong Han Date: Fri, 29 May 2020 17:48:09 +0900 Subject: [PATCH 12/16] Fix the issue AR sticker was not deleted Change-Id: I4d9d03b42cc1efcec64fca87af3c0419b30c11a7 --- receiver/inc/config.h | 2 ++ receiver/src/ft.cpp | 17 +++++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/receiver/inc/config.h b/receiver/inc/config.h index ecc3c10..bafee30 100644 --- a/receiver/inc/config.h +++ b/receiver/inc/config.h @@ -31,4 +31,6 @@ #define THUMBNAIL_WIDTH 96 #define THUMBNAIL_HEIGHT 96 +#define STICKER_DIRECTORY "/opt/usr/share/sticker-data" + #endif /* __CONFIG_H__ */ diff --git a/receiver/src/ft.cpp b/receiver/src/ft.cpp index f243539..b90dad1 100644 --- a/receiver/src/ft.cpp +++ b/receiver/src/ft.cpp @@ -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); } } } -- 2.7.4 From e50ae80e3ac1ef92db907a2a997e7dd40e62b1a2 Mon Sep 17 00:00:00 2001 From: InHong Han Date: Fri, 29 May 2020 18:00:14 +0900 Subject: [PATCH 13/16] Add code to delete all AR emoji stickers Change-Id: Id932afb03d7343e6e791c94b6c957d1c12f8bf4a --- receiver/inc/sticker_info.h | 2 +- receiver/src/ft.cpp | 16 +++++++++++++--- receiver/src/sticker_info.cpp | 13 +++++++------ 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/receiver/inc/sticker_info.h b/receiver/inc/sticker_info.h index 8deac5e..b45eae5 100644 --- a/receiver/inc/sticker_info.h +++ b/receiver/inc/sticker_info.h @@ -21,6 +21,6 @@ void insert_sticker_data(const char *filepath, const char *keyword, const char * int create_sticker_provider_handle(void); void destroy_sticker_provider_handle(void); void delete_sticker_data(const char *fileName); -void delete_all_bitmoji_stickers(); +void delete_all_stickers(const char *groupName); #endif /* __STICKER_INFO_H__ */ diff --git a/receiver/src/ft.cpp b/receiver/src/ft.cpp index b90dad1..32aa136 100644 --- a/receiver/src/ft.cpp +++ b/receiver/src/ft.cpp @@ -67,7 +67,8 @@ using namespace std; enum { SYNC_START_RSP_SUCCESS = 1000, SYNC_START_RSP_NO_STICKER = 1001, - SYNC_START_RSP_BITMOJI_ALL_DELETE = 1002 + SYNC_START_RSP_BITMOJI_ALL_DELETE = 1002, + SYNC_START_RSP_AREMOJI_ALL_DELETE = 1003 }; struct sap_info_s { @@ -659,6 +660,9 @@ static void send_sync_start_response(int result_code) response_to_app = "success"; break; } + case SYNC_START_RSP_AREMOJI_ALL_DELETE: + response_to_app = "success"; + break; default: response_to_app = "unknown_error"; break; @@ -770,7 +774,7 @@ on_data_received(sap_socket_h socket, unsigned short int channel_id, unsigned in if (current_request.category == string("bitmoji")) { LOGD("Delete all bitmoji stickers"); if (create_sticker_provider_handle() == STICKER_ERROR_NONE) { - delete_all_bitmoji_stickers(); + delete_all_stickers("bitmoji"); destroy_sticker_provider_handle(); } } @@ -778,7 +782,13 @@ on_data_received(sap_socket_h socket, unsigned short int channel_id, unsigned in if (result_code == SYNC_START_RSP_BITMOJI_ALL_DELETE) { LOGD("Delete all bitmoji stickers"); if (create_sticker_provider_handle() == STICKER_ERROR_NONE) { - delete_all_bitmoji_stickers(); + delete_all_stickers("bitmoji"); + destroy_sticker_provider_handle(); + } + } else if (result_code == SYNC_START_RSP_AREMOJI_ALL_DELETE) { + LOGD("Delete all AR Emoji stickers"); + if (create_sticker_provider_handle() == STICKER_ERROR_NONE) { + delete_all_stickers("arsticker"); destroy_sticker_provider_handle(); } } diff --git a/receiver/src/sticker_info.cpp b/receiver/src/sticker_info.cpp index 2b59d57..afe989b 100644 --- a/receiver/src/sticker_info.cpp +++ b/receiver/src/sticker_info.cpp @@ -144,23 +144,24 @@ void delete_sticker_data(const char *fileName) LOGE("Failed to delete sticker. ret : %d", ret); } -static void _delete_all_bitmoji_stickers_cb(sticker_data_h data_handle, void *user_data) +static void _delete_all_stickers_cb(sticker_data_h data_handle, void *user_data) { int ret; - char *group = NULL; + char *sticker_group = NULL; + char *del_group = (char *) user_data; - ret = sticker_data_get_group_name(data_handle, &group); + ret = sticker_data_get_group_name(data_handle, &sticker_group); if (ret != STICKER_ERROR_NONE) LOGE("Failed to get group name. ret : %d", ret); - if (strcmp(group, "bitmoji") == 0) { + if (strcmp(sticker_group, del_group) == 0) { ret = sticker_provider_delete_data(sticker_provider, data_handle); if (ret != STICKER_ERROR_NONE) LOGE("Failed to delete sticker. ret : %d", ret); } } -void delete_all_bitmoji_stickers() +void delete_all_stickers(const char *groupName) { int ret; int total_cnt; @@ -170,7 +171,7 @@ void delete_all_bitmoji_stickers() if (ret != STICKER_ERROR_NONE) LOGE("Failed to get sticker count. ret : %d", ret); - ret = sticker_provider_data_foreach_all(sticker_provider, 0, total_cnt, &result, _delete_all_bitmoji_stickers_cb, NULL); + ret = sticker_provider_data_foreach_all(sticker_provider, 0, total_cnt, &result, _delete_all_stickers_cb, (void *)groupName); if (ret != STICKER_ERROR_NONE) LOGE("Failed to retrieve all sticker data. ret : %d", ret); } \ No newline at end of file -- 2.7.4 From f83a2dce6a2d205ed6a8d02536cbf1034856246f Mon Sep 17 00:00:00 2001 From: InHong Han Date: Fri, 29 May 2020 18:14:44 +0900 Subject: [PATCH 14/16] Fix the issue sometimes provider_handle sometimes does not create when removing stickers Change-Id: I38710cb7146439fa20c767fbddb05badebed054d --- receiver/inc/sticker_info.h | 2 +- receiver/src/ft.cpp | 65 +++++++++++++++++-------------------------- receiver/src/main.cpp | 4 +++ receiver/src/sticker_info.cpp | 6 ++-- 4 files changed, 32 insertions(+), 45 deletions(-) diff --git a/receiver/inc/sticker_info.h b/receiver/inc/sticker_info.h index b45eae5..bad7dc3 100644 --- a/receiver/inc/sticker_info.h +++ b/receiver/inc/sticker_info.h @@ -18,7 +18,7 @@ #define __STICKER_INFO_H__ 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 create_sticker_provider_handle(void); void destroy_sticker_provider_handle(void); void delete_sticker_data(const char *fileName); void delete_all_stickers(const char *groupName); diff --git a/receiver/src/ft.cpp b/receiver/src/ft.cpp index 32aa136..ebf7e92 100644 --- a/receiver/src/ft.cpp +++ b/receiver/src/ft.cpp @@ -210,33 +210,30 @@ static void _on_transfer_completed(sap_file_transaction_h file_transaction, } else { LOGI("Succeed to change permission : %s", sticker_data.file_path.c_str()); - if (create_sticker_provider_handle() == STICKER_ERROR_NONE) { - char thumb_path[PATH_MAX]; - char *data_path = NULL; - data_path = app_get_shared_data_path(); - snprintf(thumb_path, sizeof(thumb_path), "%s/thumbnail/%s", data_path, incoming_file_name.c_str()); - sticker_data.thumbnail_path = string(thumb_path); - - if (data_path) - free(data_path); - - int ret = thumbnail_util_extract_to_file(sticker_data.file_path.c_str(), THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT, sticker_data.thumbnail_path.c_str()); - if (ret != THUMBNAIL_UTIL_ERROR_NONE) { - LOGE("Failed to create thumbnail. msg : %s", get_error_message(ret)); - sticker_data.thumbnail_path.clear(); - } + char thumb_path[PATH_MAX]; + char *data_path = NULL; + data_path = app_get_shared_data_path(); + snprintf(thumb_path, sizeof(thumb_path), "%s/thumbnail/%s", data_path, incoming_file_name.c_str()); + sticker_data.thumbnail_path = string(thumb_path); + + if (data_path) + free(data_path); + + int ret = thumbnail_util_extract_to_file(sticker_data.file_path.c_str(), THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT, sticker_data.thumbnail_path.c_str()); + if (ret != THUMBNAIL_UTIL_ERROR_NONE) { + LOGE("Failed to create thumbnail. msg : %s", get_error_message(ret)); + 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(), sticker_data.disp_type.c_str()); - destroy_sticker_provider_handle(); + 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()); - if (unlink(sticker_data.file_path.c_str()) == -1) - LOGE("Failed to remove sticker file"); + if (unlink(sticker_data.file_path.c_str()) == -1) + LOGE("Failed to remove sticker file"); - if (!sticker_data.thumbnail_path.empty()) { - if (unlink(sticker_data.thumbnail_path.c_str()) == -1) - LOGE("Failed to remove sticker thumbnail"); - } + if (!sticker_data.thumbnail_path.empty()) { + if (unlink(sticker_data.thumbnail_path.c_str()) == -1) + LOGE("Failed to remove sticker thumbnail"); } } @@ -773,24 +770,15 @@ on_data_received(sap_socket_h socket, unsigned short int channel_id, unsigned in send_sync_start_response(result_code); if (current_request.category == string("bitmoji")) { LOGD("Delete all bitmoji stickers"); - if (create_sticker_provider_handle() == STICKER_ERROR_NONE) { - delete_all_stickers("bitmoji"); - destroy_sticker_provider_handle(); - } + delete_all_stickers("bitmoji"); } } else { if (result_code == SYNC_START_RSP_BITMOJI_ALL_DELETE) { LOGD("Delete all bitmoji stickers"); - if (create_sticker_provider_handle() == STICKER_ERROR_NONE) { - delete_all_stickers("bitmoji"); - destroy_sticker_provider_handle(); - } + delete_all_stickers("bitmoji"); } else if (result_code == SYNC_START_RSP_AREMOJI_ALL_DELETE) { LOGD("Delete all AR Emoji stickers"); - if (create_sticker_provider_handle() == STICKER_ERROR_NONE) { - delete_all_stickers("arsticker"); - destroy_sticker_provider_handle(); - } + delete_all_stickers("arsticker"); } if (!process_request_queue()) { @@ -854,10 +842,7 @@ on_data_received(sap_socket_h socket, unsigned short int channel_id, unsigned in 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(del_path); - destroy_sticker_provider_handle(); - } + delete_sticker_data(del_path); if (app_id) free(app_id); diff --git a/receiver/src/main.cpp b/receiver/src/main.cpp index 34b9837..dc105d0 100644 --- a/receiver/src/main.cpp +++ b/receiver/src/main.cpp @@ -29,6 +29,7 @@ #include "log.h" #include "config.h" #include "receiver_preference.h" +#include "sticker_info.h" using namespace std; @@ -55,6 +56,8 @@ static bool app_create(void *data) } } + create_sticker_provider_handle(); + return true; } @@ -241,6 +244,7 @@ static void app_terminate(void *data) { /* Release all resources. */ LOGD(""); + destroy_sticker_provider_handle(); deinitialize_sap(); } diff --git a/receiver/src/sticker_info.cpp b/receiver/src/sticker_info.cpp index afe989b..650d880 100644 --- a/receiver/src/sticker_info.cpp +++ b/receiver/src/sticker_info.cpp @@ -118,16 +118,14 @@ insert_sticker_data(const char *filepath, const char *keyword, const char *group } } -int create_sticker_provider_handle(void) +void create_sticker_provider_handle(void) { int ret; ret = sticker_provider_create(&sticker_provider); if (ret != STICKER_ERROR_NONE) { /* Error handling */ - LOGE("Failed to create sticker provider"); + LOGE("Failed to create sticker provider. ret : %d", ret); } - - return ret; } void destroy_sticker_provider_handle(void) -- 2.7.4 From 042aef7a63b407ef39e3272dd0fcc68cbc5fca5e Mon Sep 17 00:00:00 2001 From: InHong Han Date: Fri, 29 May 2020 18:20:50 +0900 Subject: [PATCH 15/16] Update package version to 0.1.51 Change-Id: I2b468e31aeb87f171877cb20b1a5f3e405c082cf --- packaging/capi-ui-sticker.spec | 2 +- receiver/tizen-manifest.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packaging/capi-ui-sticker.spec b/packaging/capi-ui-sticker.spec index 11ab9df..871c986 100644 --- a/packaging/capi-ui-sticker.spec +++ b/packaging/capi-ui-sticker.spec @@ -1,6 +1,6 @@ Name: capi-ui-sticker Summary: Sticker client library and daemon -Version: 0.1.50 +Version: 0.1.51 Release: 1 Group: Graphics & UI Framework/Input License: Apache-2.0 diff --git a/receiver/tizen-manifest.xml b/receiver/tizen-manifest.xml index 0f9aed4..843df8c 100644 --- a/receiver/tizen-manifest.xml +++ b/receiver/tizen-manifest.xml @@ -1,5 +1,5 @@ - + -- 2.7.4 From 2d3243dca6eceddb799e59ef7f37a2c7ccb85ff0 Mon Sep 17 00:00:00 2001 From: InHong Han Date: Wed, 13 May 2020 17:10:56 +0900 Subject: [PATCH 16/16] Add logs for checking sync events Change-Id: I6166b0ea0ba2cffa9b814d82572796954094dcfb --- receiver/src/main.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/receiver/src/main.cpp b/receiver/src/main.cpp index dc105d0..8e04807 100644 --- a/receiver/src/main.cpp +++ b/receiver/src/main.cpp @@ -104,6 +104,7 @@ static bool check_sync_time_condition() LOGD("current time : %f, last_sync_time : %f", ecore_time_unix_get(), last_sync_time); if (ecore_time_unix_get() - last_sync_time > MAX_WAIT_TIME) { + LOGD("Starting manual synchronization"); initialize_sap(); request_show_sync_notification(); result = false; @@ -159,6 +160,7 @@ static void app_control(app_control_h app_control, void *data) if (!is_init_sap()) { if (check_sync_time_condition()) { if (check_battery_condition()) { + LOGD("Starting auto synchronization"); initialize_sap(); request_all_sticker_data("auto", "input"); } -- 2.7.4