Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,8 @@ private Uri getTempImage(Uri u, ByteArrayOutputStream bitmapOutputStream) {
try {
bis = new ByteArrayInputStream(bitmapOutputStream.toByteArray());
newUri = saveImage(u, bis);
} catch (IOException ex) {} finally {
} catch (IOException ex) {
} finally {
if (bis != null) {
try {
bis.close();
Expand Down
5 changes: 4 additions & 1 deletion camera/src/web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
document.body.appendChild(actionSheet);
}
actionSheet.header = options.promptLabelHeader || 'Photo';
actionSheet.cancelable = false;
actionSheet.cancelable = true;
actionSheet.options = [
{ title: options.promptLabelPhoto || 'From Photos' },
{ title: options.promptLabelPicture || 'Take Picture' },
Expand All @@ -36,13 +36,16 @@
this.cameraExperience(options, resolve, reject);
}
});
actionSheet.addEventListener('onCanceled', async () => {
reject(new CapacitorException('User cancelled photos app'));
});
} else {
this.cameraExperience(options, resolve, reject);
}
});
}

async pickImages(_options: GalleryImageOptions): Promise<GalleryPhotos> {

Check warning on line 48 in camera/src/web.ts

View workflow job for this annotation

GitHub Actions / lint (camera)

'_options' is defined but never used
// eslint-disable-next-line no-async-promise-executor
return new Promise<GalleryPhotos>(async (resolve, reject) => {
this.multipleFileInputExperience(resolve, reject);
Expand Down Expand Up @@ -96,8 +99,8 @@
input.type = 'file';
input.hidden = true;
document.body.appendChild(input);
input.addEventListener('change', (_e: any) => {

Check warning on line 102 in camera/src/web.ts

View workflow job for this annotation

GitHub Actions / lint (camera)

'_e' is defined but never used
const file = input.files![0];

Check warning on line 103 in camera/src/web.ts

View workflow job for this annotation

GitHub Actions / lint (camera)

Forbidden non-null assertion
let format = 'jpeg';

if (file.type === 'image/png') {
Expand Down Expand Up @@ -135,7 +138,7 @@
cleanup();
}
});
input.addEventListener('cancel', (_e: any) => {

Check warning on line 141 in camera/src/web.ts

View workflow job for this annotation

GitHub Actions / lint (camera)

'_e' is defined but never used
reject(new CapacitorException('User cancelled photos app'));
cleanup();
});
Expand Down Expand Up @@ -169,11 +172,11 @@
input.hidden = true;
input.multiple = true;
document.body.appendChild(input);
input.addEventListener('change', (_e: any) => {

Check warning on line 175 in camera/src/web.ts

View workflow job for this annotation

GitHub Actions / lint (camera)

'_e' is defined but never used
const photos = [];
// eslint-disable-next-line @typescript-eslint/prefer-for-of
for (let i = 0; i < input.files!.length; i++) {

Check warning on line 178 in camera/src/web.ts

View workflow job for this annotation

GitHub Actions / lint (camera)

Forbidden non-null assertion
const file = input.files![i];

Check warning on line 179 in camera/src/web.ts

View workflow job for this annotation

GitHub Actions / lint (camera)

Forbidden non-null assertion
let format = 'jpeg';

if (file.type === 'image/png') {
Expand All @@ -189,7 +192,7 @@
resolve({ photos });
cleanup();
});
input.addEventListener('cancel', (_e: any) => {

Check warning on line 195 in camera/src/web.ts

View workflow job for this annotation

GitHub Actions / lint (camera)

'_e' is defined but never used
reject(new CapacitorException('User cancelled photos app'));
cleanup();
});
Expand Down
Loading