From ccd4cdf328ffc24473fe86155dcdcb6c3894c17d Mon Sep 17 00:00:00 2001 From: XiuYun CHEN Date: Mon, 18 Aug 2025 16:33:10 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=89=E6=8B=A9=E5=A4=9A=E5=BC=A0=E5=9B=BE?= =?UTF-8?q?=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- chatkit_ui/src/main/ets/pages/ChatP2PPage.ets | 10 ++++++---- common/src/main/ets/utils/MediaUtils.ets | 6 +++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/chatkit_ui/src/main/ets/pages/ChatP2PPage.ets b/chatkit_ui/src/main/ets/pages/ChatP2PPage.ets index 8397f44..724473c 100644 --- a/chatkit_ui/src/main/ets/pages/ChatP2PPage.ets +++ b/chatkit_ui/src/main/ets/pages/ChatP2PPage.ets @@ -874,7 +874,7 @@ export struct ChatP2PPage { MediaUtils.showImageVideoPicker().then((results) => { if(results!=null&&results.length>0) { - results.forEach(result=>{ + for (const result of results) { if (result.errorMsg == null && result.uri) { if (result.type === photoAccessHelper.PhotoType.IMAGE) { this.chatViewModel.sendImageMessage(result.uri); @@ -882,7 +882,8 @@ export struct ChatP2PPage { this.chatViewModel.sendVideoMessage(result.uri, result.duration, result.width, result.height); } } - }) + } + } }) @@ -1027,7 +1028,7 @@ export struct ChatP2PPage { MediaUtils.showImageVideoPicker().then((results) => { if(results!=null&&results.length>0) { - results.forEach(result=>{ + for (const result of results) { if (result.errorMsg == null && result.uri) { if (result.type === photoAccessHelper.PhotoType.IMAGE) { this.chatViewModel.sendImageMessage(result.uri); @@ -1035,7 +1036,8 @@ export struct ChatP2PPage { this.chatViewModel.sendVideoMessage(result.uri, result.duration, result.width, result.height); } } - }) + } + } // if (result.errorMsg == null && result.uri) { // if (result.type === photoAccessHelper.PhotoType.IMAGE) { diff --git a/common/src/main/ets/utils/MediaUtils.ets b/common/src/main/ets/utils/MediaUtils.ets index f312423..c8acb6e 100644 --- a/common/src/main/ets/utils/MediaUtils.ets +++ b/common/src/main/ets/utils/MediaUtils.ets @@ -72,9 +72,9 @@ export class MediaUtils { const uri = photoSelectResult.photoUris; let selectResult:SelectResult[]=[] // const uri = photoSelectResult.photoUris[0]; - await uri.forEach(async values=>{ - selectResult.push(await MediaUtils.getMediaInfo(context, values)) - }) + for (const indexUri of uri) { + selectResult.push(await MediaUtils.getMediaInfo(context, indexUri)) + } // const selectResult = MediaUtils.getMediaInfo(context, uri) resolve(selectResult); })