return result;
}
+static bool process_request_queue()
+{
+ if (ReqQueue.empty())
+ return false;
+
+ StickerRequest request = ReqQueue.front();
+
+ if (request.req_type == REQUEST_TYPE_FEATURE_REQ) {
+ LOGD("[Request feature exchange]");
+ request_sticker_feature();
+ ReqQueue.pop();
+ }
+ else if (request.req_type == REQUEST_TYPE_SYNC) {
+ LOGD("[Request to sync sticker] mode: %s, category: %s, type : %s", request.mode.c_str(),
+ request.category.c_str(),
+ request.type.c_str());
+
+ if (request_sticker_data(request.mode.c_str(), request.category.c_str(), request.type.c_str()))
+ ReqQueue.pop();
+ }
+ else if (request.req_type == REQUEST_TYPE_SHOW_NOTIFICATION) {
+ LOGD("[Request to show notification]");
+ request_show_sync_notification();
+ ReqQueue.pop();
+ }
+
+ return true;
+}
+
void request_all_sticker_data(const char *mode, const char *type)
{
+ StickerRequest pending_request;
+ pending_request.req_type = REQUEST_TYPE_SYNC;
+ pending_request.mode = string(mode);
+ pending_request.type = string(type);
+
#ifdef VCONFKEY_STICKER_SUPPORTED_FEATURE
int feature_flag = 0;
if (vconf_get_int(VCONFKEY_STICKER_SUPPORTED_FEATURE, &feature_flag) == 0)
{
- if (feature_flag & VCONFKEY_STICKER_FEATURE_AREMOJI)
- request_sticker_data(mode, "arsticker", type);
+ if (feature_flag & VCONFKEY_STICKER_FEATURE_AREMOJI) {
+ pending_request.category = string("arsticker");
+ ReqQueue.push(pending_request);
+ }
- if (feature_flag & VCONFKEY_STICKER_FEATURE_BITMOJI)
- request_sticker_data(mode, "bitmoji", type);
+ if (feature_flag & VCONFKEY_STICKER_FEATURE_BITMOJI) {
+ pending_request.category = string("bitmoji");
+ ReqQueue.push(pending_request);
+ }
}
else
LOGW("Failed to get value of VCONFKEY_STICKER_SUPPORTED_FEATURE");
#else
- request_sticker_data(mode, "arsticker", type);
- request_sticker_data(mode, "bitmoji", type);
+ pending_request.category = string("arsticker");
+ ReqQueue.push(pending_request);
+ pending_request.category = string("bitmoji");
+ ReqQueue.push(pending_request);
#endif
+
+ if (priv_data.socket)
+ process_request_queue();
}
void request_sticker_feature()
service_app_exit();
}
-static bool process_request_queue()
-{
- if (ReqQueue.empty())
- return false;
-
- StickerRequest request = ReqQueue.front();
-
- if (request.req_type == REQUEST_TYPE_FEATURE_REQ) {
- LOGD("[Request feature exchange]");
- request_sticker_feature();
- ReqQueue.pop();
- }
- else if (request.req_type == REQUEST_TYPE_SYNC) {
- LOGD("[Request to sync sticker] mode: %s, category: %s, type : %s", request.mode.c_str(),
- request.category.c_str(),
- request.type.c_str());
-
- if (request_sticker_data(request.mode.c_str(), request.category.c_str(), request.type.c_str()))
- ReqQueue.pop();
- }
- else if (request.req_type == REQUEST_TYPE_SHOW_NOTIFICATION) {
- LOGD("[Request to show notification]");
- request_show_sync_notification();
- ReqQueue.pop();
- }
-
- return true;
-}
-
static void quit()
{
job_progress = FALSE;