Skip to content
This repository was archived by the owner on Dec 13, 2024. It is now read-only.

Commit 733559d

Browse files
lankun1009刘志豪
andauthored
fix:权限删除 (#27)
* refactor:权限删除 * fix:权限删除 --------- Co-authored-by: 刘志豪 <liuzhihao25@huawei.com>
1 parent c030c8a commit 733559d

File tree

1 file changed

+1
-19
lines changed

1 file changed

+1
-19
lines changed

harmony/image_crop_picker/src/main/ets/ImageCropPickerTurboModule.ts

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -224,12 +224,6 @@ export class ImageCropPickerTurboModule extends TurboModule implements TM.ImageC
224224

225225
async openPicker(options?: Options): Promise<Video[] | Video | ImageOrVideo[] | ImageOrVideo | Image [] | Image> {
226226
Logger.info(`${TAG} into openPicker request ${JSON.stringify(options)}`);
227-
let permissionResult = await this.grantPermission();
228-
if (!permissionResult) {
229-
return new Promise(async(res, rej) => {
230-
rej('permission not approved')
231-
})
232-
}
233227
let minFiles = this.isNullOrUndefined(options?.minFiles) ? MinNumber : options.minFiles;
234228
let maxFiles = this.isNullOrUndefined(options?.maxFiles) ? MaxNumber : options.maxFiles;
235229
let isShowSerialNum = this.isNullOrUndefined(options?.showsSelectedCount) ? true : options?.showsSelectedCount;
@@ -391,12 +385,6 @@ export class ImageCropPickerTurboModule extends TurboModule implements TM.ImageC
391385
async openCamera(options?: Options): Promise<Video[] | Video | ImageOrVideo[] | ImageOrVideo | Image [] | Image> {
392386
Logger.info(`${TAG} into openCamera request = ${JSON.stringify(options)}`);
393387
let cropping = this.isNullOrUndefined(options?.cropping) ? false : options?.cropping;
394-
let permissionResult = await this.grantPermission();
395-
if (!permissionResult) {
396-
return new Promise(async(res, rej) => {
397-
rej('permission not approved')
398-
})
399-
}
400388
let quality = options.compressImageQuality;
401389
if (!this.isNullOrUndefined(quality) && !(quality >= 0 && quality <= 1)) {
402390
return new Promise(async(res, rej) => {
@@ -424,7 +412,7 @@ export class ImageCropPickerTurboModule extends TurboModule implements TM.ImageC
424412
let imgOrVideoPath = pickerResult.resultUri;
425413
isImg = this.isImage(imgOrVideoPath);
426414
if (isImg) {
427-
let file = fs.openSync(imgOrVideoPath, fs.OpenMode.CREATE);
415+
let file = fs.openSync(imgOrVideoPath, fs.OpenMode.READ_ONLY);
428416
try {
429417
let dstPath = this.ctx.uiAbilityContext.tempDir + '/rn_image_crop_picker_lib_temp_' + util.generateRandomUUID(true) + '.jpeg';
430418
fs.copyFileSync(file.fd, dstPath, 0);
@@ -648,12 +636,6 @@ export class ImageCropPickerTurboModule extends TurboModule implements TM.ImageC
648636
rej('path is empty')
649637
})
650638
}
651-
let permissionResult = await this.grantPermission();
652-
if (!permissionResult) {
653-
return new Promise(async(res, rej) => {
654-
rej('permission not approved')
655-
})
656-
}
657639
let quality = options.compressImageQuality;
658640
if (!this.isNullOrUndefined(quality) && !(quality >= 0 && quality <= 1)) {
659641
return new Promise(async(res, rej) => {

0 commit comments

Comments
 (0)