Skip to content

Commit fc9d0f7

Browse files
fix:可直接修改uiContext (#6)
Signed-off-by: “leehom6666” <llh_01129@163.com>
1 parent cf6a1e3 commit fc9d0f7

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

harmony/image_editor/src/main/ets/ImageEditorModule.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,10 @@ async function imageEditor(newOptions:ImageCropData, uri: string,uiContext:Conte
166166
await editorPM.getImageInfo().then((imageInfo: image.ImageInfo) => {
167167
getImageInfo = imageInfo
168168
})
169-
let context = uiContext as common.ApplicationContext
170169
let suffix = newOptions.format
171170
suffix = suffix === 'jpeg' || suffix === 'jpg' ? 'jpeg' : suffix
172171
const fileName = `ReactNative_cropped_image_${new Date().getTime()}.${suffix==='jpeg'?'jpg':suffix}`
173-
const path: string = `${context.cacheDir}/${fileName}`
172+
const path: string = `${uiContext.cacheDir}/${fileName}`
174173
let packOpts: image.PackingOption = { format: `image/${suffix}`, quality: newOptions.quality || 90 }
175174
let size = 0
176175
let base64Data = ''
@@ -202,7 +201,7 @@ async function imageEditor(newOptions:ImageCropData, uri: string,uiContext:Conte
202201
editorPM.release()
203202
imageSourceApi.release()
204203
imagePackerApi.release()
205-
context = null
204+
uiContext = null
206205

207206
const result:EditorResult = {
208207
uri: `file://${path}`,

0 commit comments

Comments
 (0)