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); })