Skip to content

Commit 2d7127a

Browse files
authored
fix: support deprecated types from Capacitor 2 (#139)
* screen reader * action sheet * more screen reader * wip * export all from definitions * motion * toast * haptics * more screen reader * app * network * app-launcher * wip * filesystem * browser * text-zoom * status-bar * device * clipboard * generate readmes * fmt * update docgen * regen * geolocation * camera * splash-screen * build and format
1 parent ea0d9c9 commit 2d7127a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+1030
-627
lines changed

action-sheet/README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,17 @@ npx cap sync
2525
### showActions(...)
2626

2727
```typescript
28-
showActions(options: ActionSheetOptions) => Promise<ActionSheetResult>
28+
showActions(options: ShowActionsOptions) => Promise<ShowActionsResult>
2929
```
3030

3131
Show an Action Sheet style modal with various options for the user
3232
to select.
3333

3434
| Param | Type |
3535
| ------------- | ----------------------------------------------------------------- |
36-
| **`options`** | <code><a href="#actionsheetoptions">ActionSheetOptions</a></code> |
36+
| **`options`** | <code><a href="#showactionsoptions">ShowActionsOptions</a></code> |
3737

38-
**Returns:** <code>Promise&lt;<a href="#actionsheetresult">ActionSheetResult</a>&gt;</code>
38+
**Returns:** <code>Promise&lt;<a href="#showactionsresult">ShowActionsResult</a>&gt;</code>
3939

4040
**Since:** 1.0.0
4141

@@ -45,35 +45,35 @@ to select.
4545
### Interfaces
4646

4747

48-
#### ActionSheetResult
48+
#### ShowActionsResult
4949

5050
| Prop | Type | Description | Since |
5151
| ----------- | ------------------- | -------------------------------------------- | ----- |
5252
| **`index`** | <code>number</code> | The index of the clicked option (Zero-based) | 1.0.0 |
5353

5454

55-
#### ActionSheetOptions
55+
#### ShowActionsOptions
5656

5757
| Prop | Type | Description | Since |
5858
| ------------- | -------------------------------- | ------------------------------------------------------------------------ | ----- |
5959
| **`title`** | <code>string</code> | The title of the Action Sheet. | 1.0.0 |
6060
| **`message`** | <code>string</code> | A message to show under the title. This option is only supported on iOS. | 1.0.0 |
61-
| **`options`** | <code>ActionSheetOption[]</code> | Options the user can choose from. | 1.0.0 |
61+
| **`options`** | <code>ActionSheetSchema[]</code> | Options the user can choose from. | 1.0.0 |
6262

6363

64-
#### ActionSheetOption
64+
#### ActionSheetSchema
6565

6666
| Prop | Type | Description | Since |
6767
| ----------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ----- |
6868
| **`title`** | <code>string</code> | The title of the option | 1.0.0 |
69-
| **`style`** | <code><a href="#actionsheetoptionstyle">ActionSheetOptionStyle</a></code> | The style of the option This option is only supported on iOS. | 1.0.0 |
69+
| **`style`** | <code><a href="#actionsheetschemastyle">ActionSheetSchemaStyle</a></code> | The style of the option This option is only supported on iOS. | 1.0.0 |
7070
| **`icon`** | <code>string</code> | Icon for the option (ionicon naming convention) This option is only supported on Web. | 1.0.0 |
7171

7272

7373
### Enums
7474

7575

76-
#### ActionSheetOptionStyle
76+
#### ActionSheetSchemaStyle
7777

7878
| Members | Value | Description | Since |
7979
| ----------------- | -------------------------- | ----------------------------------------------------------------------------------------------------------- | ----- |

action-sheet/src/definitions.ts

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export interface ActionSheetOptions {
1+
export interface ShowActionsOptions {
22
/**
33
* The title of the Action Sheet.
44
*
@@ -20,10 +20,10 @@ export interface ActionSheetOptions {
2020
*
2121
* @since 1.0.0
2222
*/
23-
options: ActionSheetOption[];
23+
options: ActionSheetSchema[];
2424
}
2525

26-
export enum ActionSheetOptionStyle {
26+
export enum ActionSheetSchemaStyle {
2727
/**
2828
* Default style of the option.
2929
*
@@ -47,7 +47,7 @@ export enum ActionSheetOptionStyle {
4747
Cancel = 'CANCEL',
4848
}
4949

50-
export interface ActionSheetOption {
50+
export interface ActionSheetSchema {
5151
/**
5252
* The title of the option
5353
*
@@ -62,7 +62,7 @@ export interface ActionSheetOption {
6262
*
6363
* @since 1.0.0
6464
*/
65-
style?: ActionSheetOptionStyle;
65+
style?: ActionSheetSchemaStyle;
6666

6767
/**
6868
* Icon for the option (ionicon naming convention)
@@ -74,7 +74,7 @@ export interface ActionSheetOption {
7474
icon?: string;
7575
}
7676

77-
export interface ActionSheetResult {
77+
export interface ShowActionsResult {
7878
/**
7979
* The index of the clicked option (Zero-based)
8080
*
@@ -90,5 +90,23 @@ export interface ActionSheetPlugin {
9090
*
9191
* @since 1.0.0
9292
*/
93-
showActions(options: ActionSheetOptions): Promise<ActionSheetResult>;
93+
showActions(options: ShowActionsOptions): Promise<ShowActionsResult>;
9494
}
95+
96+
/**
97+
* @deprecated Use `ShowActionsOptions`.
98+
* @since 1.0.0
99+
*/
100+
export type ActionSheetOptions = ShowActionsOptions;
101+
102+
/**
103+
* @deprecated Use `ShowActionsResult`.
104+
* @since 1.0.0
105+
*/
106+
export type ActionSheetResult = ShowActionsResult;
107+
108+
/**
109+
* @deprecated Use `ActionSheetSchema`.
110+
* @since 1.0.0
111+
*/
112+
export type ActionSheetOption = ActionSheetSchema;

action-sheet/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { registerPlugin } from '@capacitor/core';
22

33
import type { ActionSheetPlugin } from './definitions';
4-
import { ActionSheetOptionStyle } from './definitions';
54

65
const ActionSheet = registerPlugin<ActionSheetPlugin>('ActionSheet', {
76
web: () => import('./web').then(m => new m.ActionSheetWeb()),
87
});
98

10-
export { ActionSheet, ActionSheetOptionStyle };
9+
export * from './definitions';
10+
export { ActionSheet };

action-sheet/src/web.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import { WebPlugin } from '@capacitor/core';
22

33
import type {
4-
ActionSheetOptions,
54
ActionSheetPlugin,
6-
ActionSheetResult,
5+
ShowActionsResult,
6+
ShowActionsOptions,
77
} from './definitions';
88

99
export class ActionSheetWeb extends WebPlugin implements ActionSheetPlugin {
10-
async showActions(options: ActionSheetOptions): Promise<ActionSheetResult> {
11-
return new Promise<ActionSheetResult>((resolve, _reject) => {
10+
async showActions(options: ShowActionsOptions): Promise<ShowActionsResult> {
11+
return new Promise<ShowActionsResult>((resolve, _reject) => {
1212
let actionSheet: any = document.querySelector('pwa-action-sheet');
1313
if (!actionSheet) {
1414
actionSheet = document.createElement('pwa-action-sheet');

app-launcher/README.md

Lines changed: 42 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ npx cap sync
1515

1616
* [`canOpenUrl(...)`](#canopenurl)
1717
* [`openUrl(...)`](#openurl)
18+
* [Interfaces](#interfaces)
1819

1920
</docgen-index>
2021

@@ -24,7 +25,7 @@ npx cap sync
2425
### canOpenUrl(...)
2526

2627
```typescript
27-
canOpenUrl(options: { url: string; }) => Promise<{ value: boolean; }>
28+
canOpenUrl(options: CanOpenURLOptions) => Promise<CanOpenURLResult>
2829
```
2930

3031
Check if an app can be opened with the given URL.
@@ -35,11 +36,11 @@ This method always returns false for undeclared schemes, whether or not an appro
3536
app is installed. To learn more about the key, see
3637
[LSApplicationQueriesSchemes](https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/LaunchServicesKeys.html#//apple_ref/doc/plist/info/LSApplicationQueriesSchemes).
3738

38-
| Param | Type |
39-
| ------------- | ----------------------------- |
40-
| **`options`** | <code>{ url: string; }</code> |
39+
| Param | Type |
40+
| ------------- | --------------------------------------------------------------- |
41+
| **`options`** | <code><a href="#canopenurloptions">CanOpenURLOptions</a></code> |
4142

42-
**Returns:** <code>Promise&lt;{ value: boolean; }&gt;</code>
43+
**Returns:** <code>Promise&lt;<a href="#canopenurlresult">CanOpenURLResult</a>&gt;</code>
4344

4445
**Since:** 1.0.0
4546

@@ -49,19 +50,50 @@ app is installed. To learn more about the key, see
4950
### openUrl(...)
5051

5152
```typescript
52-
openUrl(options: { url: string; }) => Promise<{ completed: boolean; }>
53+
openUrl(options: OpenURLOptions) => Promise<OpenURLResult>
5354
```
5455

5556
Open an app with the given URL.
5657

57-
| Param | Type |
58-
| ------------- | ----------------------------- |
59-
| **`options`** | <code>{ url: string; }</code> |
58+
| Param | Type |
59+
| ------------- | --------------------------------------------------------- |
60+
| **`options`** | <code><a href="#openurloptions">OpenURLOptions</a></code> |
6061

61-
**Returns:** <code>Promise&lt;{ completed: boolean; }&gt;</code>
62+
**Returns:** <code>Promise&lt;<a href="#openurlresult">OpenURLResult</a>&gt;</code>
6263

6364
**Since:** 1.0.0
6465

6566
--------------------
6667

68+
69+
### Interfaces
70+
71+
72+
#### CanOpenURLResult
73+
74+
| Prop | Type |
75+
| ----------- | -------------------- |
76+
| **`value`** | <code>boolean</code> |
77+
78+
79+
#### CanOpenURLOptions
80+
81+
| Prop | Type |
82+
| --------- | ------------------- |
83+
| **`url`** | <code>string</code> |
84+
85+
86+
#### OpenURLResult
87+
88+
| Prop | Type |
89+
| --------------- | -------------------- |
90+
| **`completed`** | <code>boolean</code> |
91+
92+
93+
#### OpenURLOptions
94+
95+
| Prop | Type |
96+
| --------- | ------------------- |
97+
| **`url`** | <code>string</code> |
98+
6799
</docgen-api>

app-launcher/src/definitions.ts

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,28 @@ export interface AppLauncherPlugin {
1010
*
1111
* @since 1.0.0
1212
*/
13-
canOpenUrl(options: { url: string }): Promise<{ value: boolean }>;
13+
canOpenUrl(options: CanOpenURLOptions): Promise<CanOpenURLResult>;
1414

1515
/**
1616
* Open an app with the given URL.
1717
*
1818
* @since 1.0.0
1919
*/
20-
openUrl(options: { url: string }): Promise<{ completed: boolean }>;
20+
openUrl(options: OpenURLOptions): Promise<OpenURLResult>;
21+
}
22+
23+
export interface CanOpenURLOptions {
24+
url: string;
25+
}
26+
27+
export interface CanOpenURLResult {
28+
value: boolean;
29+
}
30+
31+
export interface OpenURLOptions {
32+
url: string;
33+
}
34+
35+
export interface OpenURLResult {
36+
completed: boolean;
2137
}

app-launcher/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ const AppLauncher = registerPlugin<AppLauncherPlugin>('AppLauncher', {
66
web: () => import('./web').then(m => new m.AppLauncherWeb()),
77
});
88

9+
export * from './definitions';
910
export { AppLauncher };

app-launcher/src/web.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
import { WebPlugin } from '@capacitor/core';
22

3-
import type { AppLauncherPlugin } from './definitions';
3+
import type {
4+
AppLauncherPlugin,
5+
CanOpenURLOptions,
6+
CanOpenURLResult,
7+
OpenURLOptions,
8+
OpenURLResult,
9+
} from './definitions';
410

511
export class AppLauncherWeb extends WebPlugin implements AppLauncherPlugin {
6-
async canOpenUrl(_options: { url: string }): Promise<{ value: boolean }> {
12+
async canOpenUrl(_options: CanOpenURLOptions): Promise<CanOpenURLResult> {
713
return { value: true };
814
}
915

10-
async openUrl(_options: { url: string }): Promise<{ completed: boolean }> {
16+
async openUrl(_options: OpenURLOptions): Promise<OpenURLResult> {
1117
return { completed: true };
1218
}
1319
}

0 commit comments

Comments
 (0)