Skip to content

Commit

Permalink
refactor(file-picker): remove File interface (#151)
Browse files Browse the repository at this point in the history
  • Loading branch information
robingenz authored Feb 27, 2024
1 parent a8e0940 commit f102470
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
5 changes: 5 additions & 0 deletions .changeset/lucky-onions-wait.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@capawesome/capacitor-file-picker': major
---

refactor: remove `File` interface
4 changes: 4 additions & 0 deletions packages/file-picker/BREAKING.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ This is a comprehensive list of the breaking changes introduced in the major ver

The `multiple` property has been replaced by a new `limit` property in the `PickFilesOptions` and `PickMediaOptions` interfaces.

### `File` interface

The `File` interface has been replaced by the `PickedFile` interface.

## Version 5.x.x

### Capacitor 5
Expand Down
10 changes: 1 addition & 9 deletions packages/file-picker/src/definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,7 @@ export interface PickFilesResult {
files: PickedFile[];
}

/**
* @since 0.5.3
*/
export type PickedFile = File;

/**
* @deprecated Use `PickedFile` instead.
*/
export interface File {
export interface PickedFile {
/**
* The Blob instance of the file.
*
Expand Down
4 changes: 2 additions & 2 deletions packages/file-picker/src/web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { WebPlugin } from '@capacitor/core';
import type {
ConvertHeicToJpegOptions,
ConvertHeicToJpegResult,
File as FileModel,
FilePickerPlugin,
PickFilesOptions,
PickFilesResult,
Expand All @@ -13,6 +12,7 @@ import type {
PickMediaResult,
PickVideosOptions,
PickVideosResult,
PickedFile,
} from './definitions';

export class FilePickerWeb extends WebPlugin implements FilePickerPlugin {
Expand All @@ -33,7 +33,7 @@ export class FilePickerWeb extends WebPlugin implements FilePickerPlugin {
files: [],
};
for (const pickedFile of pickedFiles) {
const file: FileModel = {
const file: PickedFile = {
blob: pickedFile,
modifiedAt: pickedFile.lastModified,
mimeType: this.getMimeTypeFromUrl(pickedFile),
Expand Down

0 comments on commit f102470

Please sign in to comment.