添加文件下载失败通知给ui 2468/1 2468/head 2469/target/1
authorluozheng <1732036298@qq.com>
Thu, 9 Oct 2025 05:50:15 +0000 (13:50 +0800)
committerluozheng <1732036298@qq.com>
Thu, 9 Oct 2025 05:50:15 +0000 (13:50 +0800)
code/sdk/application/wearable/ln/nativeapp/nativeui/include/uiservice/ui_service.h
code/sdk/application/wearable/ln/nativeapp/nativeui/uiservice/src/ui_service.cpp
code/sdk/zhihui/leiniao/imsl_ln/ln_api.c
code/sdk/zhihui/leiniao/imsl_ln/ln_api_emoji.c
code/sdk/zhihui/leiniao/ln_api_cpp/ln_api_interface.cpp
code/sdk/zhihui/leiniao/ln_api_cpp/ln_api_interface.h

index 4c42149..97d2e73 100644 (file)
@@ -63,6 +63,7 @@ typedef enum {
     HAND_TEXT_UPDATE_NOTIFY, // 更新文本内容通知
     HAND_DOWNLOAD_FILE_NOTIFY, // 下载文件通知
     HAND_DOWNLOAD_SUCCESS_NOTIFY, // 下载成功通知
+    HAND_DOWNLOAD_FAIL_NOTIFY, // 下载失败通知
     MAX_NUM_HANDLER, 
 } UiServiceMsgId;
 
index 6ad44cb..34e9fb5 100644 (file)
@@ -99,6 +99,7 @@ static void HandBindAndUnbindNotify(Request *request);
 static void HandTextUpdateNotify(Request *request);
 static void HandDownloadFileNotify(Request *request);
 static void HandDownloadSuccessNotify(Request *request);
+static void HandDownloadFailNotify(Request *request);
 // 消息处理程序项数组(每个消息类型对应一个处理函数,函数名以 Handle 开头)
 MsgHandlerEntry msgHandlers[] = {
     {HANDLE_JUMP_OTA_VIEW, HandleJumpOtaView},
@@ -114,6 +115,7 @@ MsgHandlerEntry msgHandlers[] = {
     {HAND_TEXT_UPDATE_NOTIFY,HandTextUpdateNotify},
     {HAND_DOWNLOAD_FILE_NOTIFY,HandDownloadFileNotify},
     {HAND_DOWNLOAD_SUCCESS_NOTIFY,HandDownloadSuccessNotify},
+    {HAND_DOWNLOAD_FAIL_NOTIFY,HandDownloadFailNotify},
 };
 /* -------------------------------------------------------------------------- */
 void ScreenTurnOn(int32_t timeout)
@@ -589,6 +591,13 @@ void HandDownloadSuccessNotify(Request *request)
         //     std::bind(&OHOS::ThunderBirdModel::HandleDownloadEmojiSuccess,OHOS::ThunderBirdModel::GetInstance()));
     }
 }
+// 下载失败通知
+void HandDownloadFailNotify(Request *request)
+{
+    WEARABLE_LOGE(WEARABLE_LOG_MODULE_UI_SERVICE, "HandDownloadFailNotify msg_id = %d", request->msgId);
+    int type = *(int *)request->data;
+    WEARABLE_LOGE(WEARABLE_LOG_MODULE_UI_SERVICE, "HandDownloadFailNotify type = %d", type);
+}
 /* -------------------------------------------------------------------------- */
 #ifdef __cplusplus
 }
index 4bd76c6..36160a1 100644 (file)
@@ -1268,6 +1268,7 @@ static void ln_http_server_send_task(void const *arg)
                 else
                 {
                     WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[DEVICE_CHARACTER] 屏保下载失败");
+                    push_download_fail_notification(DOWNLOAD_FILE_TYPE_SCREEN_IMAGE);
                 }
                 /* 释放由发送方分配的指针 */
                 if (req.url)
index f8131ce..d00c8bd 100644 (file)
@@ -468,6 +468,11 @@ static void ln_emoji_download(void *arg)
         push_download_success_notification(DOWNLOAD_FILE_TYPE_EMOJI);
         ln_persist_add_emoji_group(mail.characterId, mail.eyesColor, mail.eyesShape);
     }
+    else
+    {
+        /* 通知ui下载失败 */
+        push_download_fail_notification(DOWNLOAD_FILE_TYPE_EMOJI);
+    }
 }
 
 /* 启动表情下载任务 */
index 3b5d5a5..1e4b9c9 100644 (file)
@@ -233,13 +233,20 @@ void push_download_file_notification(int type)
     SendMsgToUIService(HAND_DOWNLOAD_FILE_NOTIFY, 0, &type, sizeof(type));
 }
 
-// 推送文件下载成功通知到UI
+// 推送文件下载成功通知到UI type: DOWNLOAD_FILE_TYPE_SCREEN_IMAGE, DOWNLOAD_FILE_TYPE_EMOJI
 void push_download_success_notification(int type)
 {
     WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[DOWNLOAD_SUCCESS] type=%d", type);
     SendMsgToUIService(HAND_DOWNLOAD_SUCCESS_NOTIFY, 0, &type, sizeof(type));
 }
 
+// 推送文件下载失败通知到UI type: DOWNLOAD_FILE_TYPE_SCREEN_IMAGE, DOWNLOAD_FILE_TYPE_EMOJI
+void push_download_fail_notification(int type)
+{
+    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[DOWNLOAD_FAIL] type=%d", type);
+    SendMsgToUIService(HAND_DOWNLOAD_FAIL_NOTIFY, 0, &type, sizeof(type));
+}
+
 // 推送文件下载进度通知到UI
 void push_download_progress_notification(int progress)
 {
index a656ed7..ebbcfe3 100644 (file)
@@ -92,8 +92,10 @@ enum {
 };
 // 通知ui需要下载文件了需要切换slice
 void push_download_file_notification(int type);
-// 推送文件下载成功通知到UI
+// 推送文件下载成功通知到UI type: DOWNLOAD_FILE_TYPE_SCREEN_IMAGE, DOWNLOAD_FILE_TYPE_EMOJI
 void push_download_success_notification(int type);
+//推送文件下载失败通知到UI type: DOWNLOAD_FILE_TYPE_SCREEN_IMAGE, DOWNLOAD_FILE_TYPE_EMOJI
+void push_download_fail_notification(int type);
 // 推送文件下载进度通知到UI
 void push_download_progress_notification(int progress);
 #ifdef __cplusplus