@capacitor/browser 1.0.6 → 4.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +53 -0
- package/CapacitorBrowser.podspec +1 -1
- package/README.md +3 -1
- package/android/build.gradle +11 -12
- package/android/src/main/java/com/capacitorjs/plugins/browser/Browser.java +6 -7
- package/dist/docs.json +24 -0
- package/dist/esm/definitions.d.ts +16 -0
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/web.js.map +1 -1
- package/ios/Plugin/BrowserPlugin.m +1 -1
- package/ios/Plugin/BrowserPlugin.swift +6 -2
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,59 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [4.0.0-beta.2](https://github.com/ionic-team/capacitor-plugins/compare/4.0.0-beta.0...4.0.0-beta.2) (2022-07-08)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **browser:** Allow to configure popover size ([#1056](https://github.com/ionic-team/capacitor-plugins/issues/1056)) ([90eb1e5](https://github.com/ionic-team/capacitor-plugins/commit/90eb1e5356aab11103f9b1f56808102ee42f2f1b))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# 4.0.0-beta.0 (2022-06-27)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* add es2017 lib to tsconfig ([#180](https://github.com/ionic-team/capacitor-plugins/issues/180)) ([2c3776c](https://github.com/ionic-team/capacitor-plugins/commit/2c3776c38ca025c5ee965dec10ccf1cdb6c02e2f))
|
|
23
|
+
* correct addListeners links ([#655](https://github.com/ionic-team/capacitor-plugins/issues/655)) ([f9871e7](https://github.com/ionic-team/capacitor-plugins/commit/f9871e7bd53478addb21155e148829f550c0e457))
|
|
24
|
+
* Correct missing source_files path ([#590](https://github.com/ionic-team/capacitor-plugins/issues/590)) ([24e0fc2](https://github.com/ionic-team/capacitor-plugins/commit/24e0fc27cc314049012ab9915fa5e7bfb03313e1))
|
|
25
|
+
* inline source code in esm map files ([#760](https://github.com/ionic-team/capacitor-plugins/issues/760)) ([a960489](https://github.com/ionic-team/capacitor-plugins/commit/a960489a19db0182b90d187a50deff9dfbe51038))
|
|
26
|
+
* Make removeAllListeners return a promise ([#895](https://github.com/ionic-team/capacitor-plugins/issues/895)) ([e5c49d6](https://github.com/ionic-team/capacitor-plugins/commit/e5c49d64445dca70286334e6a0441d8021197b13))
|
|
27
|
+
* remove postpublish scripts ([#656](https://github.com/ionic-team/capacitor-plugins/issues/656)) ([ed6ac49](https://github.com/ionic-team/capacitor-plugins/commit/ed6ac499ebf4a47525071ccbfc36c27503e11f60))
|
|
28
|
+
* **browser:** browserFinished does not fire when closing popovers ([#483](https://github.com/ionic-team/capacitor-plugins/issues/483)) ([fb8dbb8](https://github.com/ionic-team/capacitor-plugins/commit/fb8dbb8dc69d67e2aab72ea3cd5389dc91f9bace))
|
|
29
|
+
* **browser:** prevent crash on popover presentation ([#369](https://github.com/ionic-team/capacitor-plugins/issues/369)) ([a9d4380](https://github.com/ionic-team/capacitor-plugins/commit/a9d43805f35ebaeaaed3285adc2e1f7e1062e009))
|
|
30
|
+
* Migrate plugins from Color.parseColor() to WebColor.parseColor() ([#140](https://github.com/ionic-team/capacitor-plugins/issues/140)) ([26625cf](https://github.com/ionic-team/capacitor-plugins/commit/26625cfefe45b8d1f17ce27efbc8b04f23e99d93))
|
|
31
|
+
* support deprecated types from Capacitor 2 ([#139](https://github.com/ionic-team/capacitor-plugins/issues/139)) ([2d7127a](https://github.com/ionic-team/capacitor-plugins/commit/2d7127a488e26f0287951921a6db47c49d817336))
|
|
32
|
+
* **browser:** don't expose load method ([#128](https://github.com/ionic-team/capacitor-plugins/issues/128)) ([945e59b](https://github.com/ionic-team/capacitor-plugins/commit/945e59b622bad42d33804d0ffb4ca9afcb7f9b07))
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
### Features
|
|
36
|
+
|
|
37
|
+
* add commonjs output format ([#179](https://github.com/ionic-team/capacitor-plugins/issues/179)) ([8e9e098](https://github.com/ionic-team/capacitor-plugins/commit/8e9e09862064b3f6771d7facbc4008e995d9b463))
|
|
38
|
+
* Browser plugin ([#16](https://github.com/ionic-team/capacitor-plugins/issues/16)) ([6ad5597](https://github.com/ionic-team/capacitor-plugins/commit/6ad559768ad853ac11d94e39bac34a4515362735))
|
|
39
|
+
* set targetSDK default value to 31 ([#824](https://github.com/ionic-team/capacitor-plugins/issues/824)) ([3ee10de](https://github.com/ionic-team/capacitor-plugins/commit/3ee10de98067984c1a4e75295d001c5a895c47f4))
|
|
40
|
+
* set targetSDK default value to 32 ([#970](https://github.com/ionic-team/capacitor-plugins/issues/970)) ([fa70d96](https://github.com/ionic-team/capacitor-plugins/commit/fa70d96f141af751aae53ceb5642c46b204f5958))
|
|
41
|
+
* Upgrade gradle to 7.4 ([#826](https://github.com/ionic-team/capacitor-plugins/issues/826)) ([5db0906](https://github.com/ionic-team/capacitor-plugins/commit/5db0906f6264287c4f8e69dbaecf19d4d387824b))
|
|
42
|
+
* Use java 11 ([#910](https://github.com/ionic-team/capacitor-plugins/issues/910)) ([5acb2a2](https://github.com/ionic-team/capacitor-plugins/commit/5acb2a288a413492b163e4e97da46a085d9e4be0))
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
## [1.0.7](https://github.com/ionic-team/capacitor-plugins/compare/@capacitor/browser@1.0.6...@capacitor/browser@1.0.7) (2022-01-19)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
### Bug Fixes
|
|
52
|
+
|
|
53
|
+
* inline source code in esm map files ([#760](https://github.com/ionic-team/capacitor-plugins/issues/760)) ([a960489](https://github.com/ionic-team/capacitor-plugins/commit/a960489a19db0182b90d187a50deff9dfbe51038))
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
6
59
|
## [1.0.6](https://github.com/ionic-team/capacitor-plugins/compare/@capacitor/browser@1.0.5...@capacitor/browser@1.0.6) (2021-11-03)
|
|
7
60
|
|
|
8
61
|
**Note:** Version bump only for package @capacitor/browser
|
package/CapacitorBrowser.podspec
CHANGED
|
@@ -11,7 +11,7 @@ Pod::Spec.new do |s|
|
|
|
11
11
|
s.author = package['author']
|
|
12
12
|
s.source = { :git => 'https://github.com/ionic-team/capacitor-plugins.git', :tag => package['name'] + '@' + package['version'] }
|
|
13
13
|
s.source_files = 'ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}', 'browser/ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}'
|
|
14
|
-
s.ios.deployment_target = '
|
|
14
|
+
s.ios.deployment_target = '13.0'
|
|
15
15
|
s.dependency 'Capacitor'
|
|
16
16
|
s.swift_version = '5.1'
|
|
17
17
|
end
|
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ npx cap sync
|
|
|
17
17
|
|
|
18
18
|
This plugin will use the following project variables (defined in your app's `variables.gradle` file):
|
|
19
19
|
|
|
20
|
-
- `$androidxBrowserVersion`: version of `androidx.browser:browser` (default: `1.
|
|
20
|
+
- `$androidxBrowserVersion`: version of `androidx.browser:browser` (default: `1.4.0`)
|
|
21
21
|
|
|
22
22
|
## Example
|
|
23
23
|
|
|
@@ -146,6 +146,8 @@ Represents the options passed to `open`.
|
|
|
146
146
|
| **`windowName`** | <code>string</code> | Web only: Optional target for browser open. Follows the `target` property for window.open. Defaults to _blank. Ignored on other platforms. | 1.0.0 |
|
|
147
147
|
| **`toolbarColor`** | <code>string</code> | A hex color to which the toolbar color is set. | 1.0.0 |
|
|
148
148
|
| **`presentationStyle`** | <code>'fullscreen' \| 'popover'</code> | iOS only: The presentation style of the browser. Defaults to fullscreen. Ignored on other platforms. | 1.0.0 |
|
|
149
|
+
| **`width`** | <code>number</code> | iOS only: The width the browser when using presentationStyle 'popover' on iPads. Ignored on other platforms. | 4.0.0 |
|
|
150
|
+
| **`height`** | <code>number</code> | iOS only: The height the browser when using presentationStyle 'popover' on iPads. Ignored on other platforms. | 4.0.0 |
|
|
149
151
|
|
|
150
152
|
|
|
151
153
|
#### PluginListenerHandle
|
package/android/build.gradle
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
ext {
|
|
2
|
-
junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.
|
|
3
|
-
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.2
|
|
4
|
-
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.
|
|
5
|
-
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.
|
|
6
|
-
androidxBrowserVersion = project.hasProperty('androidxBrowserVersion') ? rootProject.ext.androidxBrowserVersion : '1.
|
|
2
|
+
junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
|
|
3
|
+
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.4.2'
|
|
4
|
+
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.3'
|
|
5
|
+
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.4.0'
|
|
6
|
+
androidxBrowserVersion = project.hasProperty('androidxBrowserVersion') ? rootProject.ext.androidxBrowserVersion : '1.4.0'
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
buildscript {
|
|
@@ -12,17 +12,17 @@ buildscript {
|
|
|
12
12
|
mavenCentral()
|
|
13
13
|
}
|
|
14
14
|
dependencies {
|
|
15
|
-
classpath 'com.android.tools.build:gradle:
|
|
15
|
+
classpath 'com.android.tools.build:gradle:7.2.1'
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
apply plugin: 'com.android.library'
|
|
20
20
|
|
|
21
21
|
android {
|
|
22
|
-
compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion :
|
|
22
|
+
compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 32
|
|
23
23
|
defaultConfig {
|
|
24
|
-
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion :
|
|
25
|
-
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion :
|
|
24
|
+
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 22
|
|
25
|
+
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 32
|
|
26
26
|
versionCode 1
|
|
27
27
|
versionName "1.0"
|
|
28
28
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
@@ -37,14 +37,13 @@ android {
|
|
|
37
37
|
abortOnError false
|
|
38
38
|
}
|
|
39
39
|
compileOptions {
|
|
40
|
-
sourceCompatibility JavaVersion.
|
|
41
|
-
targetCompatibility JavaVersion.
|
|
40
|
+
sourceCompatibility JavaVersion.VERSION_11
|
|
41
|
+
targetCompatibility JavaVersion.VERSION_11
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
repositories {
|
|
46
46
|
google()
|
|
47
|
-
jcenter()
|
|
48
47
|
mavenCentral()
|
|
49
48
|
}
|
|
50
49
|
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
package com.capacitorjs.plugins.browser;
|
|
2
2
|
|
|
3
|
+
import static androidx.browser.customtabs.CustomTabsIntent.SHARE_STATE_ON;
|
|
4
|
+
|
|
3
5
|
import android.content.ComponentName;
|
|
4
6
|
import android.content.Context;
|
|
5
7
|
import android.content.Intent;
|
|
@@ -7,11 +9,7 @@ import android.net.Uri;
|
|
|
7
9
|
import android.os.Bundle;
|
|
8
10
|
import androidx.annotation.NonNull;
|
|
9
11
|
import androidx.annotation.Nullable;
|
|
10
|
-
import androidx.browser.customtabs
|
|
11
|
-
import androidx.browser.customtabs.CustomTabsClient;
|
|
12
|
-
import androidx.browser.customtabs.CustomTabsIntent;
|
|
13
|
-
import androidx.browser.customtabs.CustomTabsServiceConnection;
|
|
14
|
-
import androidx.browser.customtabs.CustomTabsSession;
|
|
12
|
+
import androidx.browser.customtabs.*;
|
|
15
13
|
|
|
16
14
|
/**
|
|
17
15
|
* The Browser class implements Custom Chrome Tabs. See
|
|
@@ -99,10 +97,11 @@ public class Browser {
|
|
|
99
97
|
public void open(Uri url, @Nullable Integer toolbarColor) {
|
|
100
98
|
CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder(getCustomTabsSession());
|
|
101
99
|
|
|
102
|
-
builder.
|
|
100
|
+
builder.setShareState(SHARE_STATE_ON);
|
|
103
101
|
|
|
104
102
|
if (toolbarColor != null) {
|
|
105
|
-
|
|
103
|
+
CustomTabColorSchemeParams params = new CustomTabColorSchemeParams.Builder().setToolbarColor(toolbarColor.intValue()).build();
|
|
104
|
+
builder.setDefaultColorSchemeParams(params);
|
|
106
105
|
}
|
|
107
106
|
|
|
108
107
|
CustomTabsIntent tabsIntent = builder.build();
|
package/dist/docs.json
CHANGED
|
@@ -177,6 +177,30 @@
|
|
|
177
177
|
"docs": "iOS only: The presentation style of the browser. Defaults to fullscreen.\n\nIgnored on other platforms.",
|
|
178
178
|
"complexTypes": [],
|
|
179
179
|
"type": "'fullscreen' | 'popover' | undefined"
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
"name": "width",
|
|
183
|
+
"tags": [
|
|
184
|
+
{
|
|
185
|
+
"text": "4.0.0",
|
|
186
|
+
"name": "since"
|
|
187
|
+
}
|
|
188
|
+
],
|
|
189
|
+
"docs": "iOS only: The width the browser when using presentationStyle 'popover' on iPads.\n\nIgnored on other platforms.",
|
|
190
|
+
"complexTypes": [],
|
|
191
|
+
"type": "number | undefined"
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
"name": "height",
|
|
195
|
+
"tags": [
|
|
196
|
+
{
|
|
197
|
+
"text": "4.0.0",
|
|
198
|
+
"name": "since"
|
|
199
|
+
}
|
|
200
|
+
],
|
|
201
|
+
"docs": "iOS only: The height the browser when using presentationStyle 'popover' on iPads.\n\nIgnored on other platforms.",
|
|
202
|
+
"complexTypes": [],
|
|
203
|
+
"type": "number | undefined"
|
|
180
204
|
}
|
|
181
205
|
]
|
|
182
206
|
},
|
|
@@ -72,6 +72,22 @@ export interface OpenOptions {
|
|
|
72
72
|
* @since 1.0.0
|
|
73
73
|
*/
|
|
74
74
|
presentationStyle?: 'fullscreen' | 'popover';
|
|
75
|
+
/**
|
|
76
|
+
* iOS only: The width the browser when using presentationStyle 'popover' on iPads.
|
|
77
|
+
*
|
|
78
|
+
* Ignored on other platforms.
|
|
79
|
+
*
|
|
80
|
+
* @since 4.0.0
|
|
81
|
+
*/
|
|
82
|
+
width?: number;
|
|
83
|
+
/**
|
|
84
|
+
* iOS only: The height the browser when using presentationStyle 'popover' on iPads.
|
|
85
|
+
*
|
|
86
|
+
* Ignored on other platforms.
|
|
87
|
+
*
|
|
88
|
+
* @since 4.0.0
|
|
89
|
+
*/
|
|
90
|
+
height?: number;
|
|
75
91
|
}
|
|
76
92
|
/**
|
|
77
93
|
* @deprecated Use `OpenOptions`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["import type { PluginListenerHandle } from '@capacitor/core';\n\nexport interface BrowserPlugin {\n /**\n * Open a page with the specified options.\n *\n * @since 1.0.0\n */\n open(options: OpenOptions): Promise<void>;\n\n /**\n * Web & iOS only: Close an open browser window.\n *\n * No-op on other platforms.\n *\n * @since 1.0.0\n */\n close(): Promise<void>;\n\n /**\n * Android & iOS only: Listen for the browser finished event.\n * It fires when the Browser is closed by the user.\n *\n * @since 1.0.0\n */\n addListener(\n eventName: 'browserFinished',\n listenerFunc: () => void,\n ): Promise<PluginListenerHandle> & PluginListenerHandle;\n\n /**\n * Android & iOS only: Listen for the page loaded event.\n * It's only fired when the URL passed to open method finish loading.\n * It is not invoked for any subsequent page loads.\n *\n * @since 1.0.0\n */\n addListener(\n eventName: 'browserPageLoaded',\n listenerFunc: () => void,\n ): Promise<PluginListenerHandle> & PluginListenerHandle;\n\n /**\n * Remove all native listeners for this plugin.\n *\n * @since 1.0.0\n */\n removeAllListeners(): Promise<void>;\n}\n\n/**\n * Represents the options passed to `open`.\n *\n * @since 1.0.0\n */\nexport interface OpenOptions {\n /**\n * The URL to which the browser is opened.\n *\n * @since 1.0.0\n */\n url: string;\n\n /**\n * Web only: Optional target for browser open. Follows\n * the `target` property for window.open. Defaults\n * to _blank.\n *\n * Ignored on other platforms.\n *\n * @since 1.0.0\n */\n windowName?: string;\n\n /**\n * A hex color to which the toolbar color is set.\n *\n * @since 1.0.0\n */\n toolbarColor?: string;\n\n /**\n * iOS only: The presentation style of the browser. Defaults to fullscreen.\n *\n * Ignored on other platforms.\n *\n * @since 1.0.0\n */\n presentationStyle?: 'fullscreen' | 'popover';\n\n /**\n * iOS only: The width the browser when using presentationStyle 'popover' on iPads.\n *\n * Ignored on other platforms.\n *\n * @since 4.0.0\n */\n width?: number;\n\n /**\n * iOS only: The height the browser when using presentationStyle 'popover' on iPads.\n *\n * Ignored on other platforms.\n *\n * @since 4.0.0\n */\n height?: number;\n}\n\n/**\n * @deprecated Use `OpenOptions`.\n * @since 1.0.0\n */\nexport type BrowserOpenOptions = OpenOptions;\n"]}
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,OAAO,GAAG,cAAc,CAAgB,SAAS,EAAE;IACvD,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,CAAC;CACzD,CAAC,CAAC;AAEH,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,OAAO,EAAE,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,OAAO,GAAG,cAAc,CAAgB,SAAS,EAAE;IACvD,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,CAAC;CACzD,CAAC,CAAC;AAEH,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,OAAO,EAAE,CAAC","sourcesContent":["import { registerPlugin } from '@capacitor/core';\n\nimport type { BrowserPlugin } from './definitions';\n\nconst Browser = registerPlugin<BrowserPlugin>('Browser', {\n web: () => import('./web').then(m => new m.BrowserWeb()),\n});\n\nexport * from './definitions';\nexport { Browser };\n"]}
|
package/dist/esm/web.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI5C,MAAM,OAAO,UAAW,SAAQ,SAAS;IAGvC;QACE,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;IAC1B,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,OAAoB;QAC7B,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,UAAU,IAAI,QAAQ,CAAC,CAAC;IAC9E,CAAC;IAED,KAAK,CAAC,KAAK;QACT,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,IAAI,IAAI,CAAC,WAAW,IAAI,IAAI,EAAE;gBAC5B,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC;gBACzB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;gBACxB,OAAO,EAAE,CAAC;aACX;iBAAM;gBACL,MAAM,CAAC,4BAA4B,CAAC,CAAC;aACtC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAED,MAAM,OAAO,GAAG,IAAI,UAAU,EAAE,CAAC;AAEjC,OAAO,EAAE,OAAO,EAAE,CAAC"}
|
|
1
|
+
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI5C,MAAM,OAAO,UAAW,SAAQ,SAAS;IAGvC;QACE,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;IAC1B,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,OAAoB;QAC7B,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,UAAU,IAAI,QAAQ,CAAC,CAAC;IAC9E,CAAC;IAED,KAAK,CAAC,KAAK;QACT,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,IAAI,IAAI,CAAC,WAAW,IAAI,IAAI,EAAE;gBAC5B,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC;gBACzB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;gBACxB,OAAO,EAAE,CAAC;aACX;iBAAM;gBACL,MAAM,CAAC,4BAA4B,CAAC,CAAC;aACtC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAED,MAAM,OAAO,GAAG,IAAI,UAAU,EAAE,CAAC;AAEjC,OAAO,EAAE,OAAO,EAAE,CAAC","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type { BrowserPlugin, OpenOptions } from './definitions';\n\nexport class BrowserWeb extends WebPlugin implements BrowserPlugin {\n _lastWindow: Window | null;\n\n constructor() {\n super();\n this._lastWindow = null;\n }\n\n async open(options: OpenOptions): Promise<void> {\n this._lastWindow = window.open(options.url, options.windowName || '_blank');\n }\n\n async close(): Promise<void> {\n return new Promise((resolve, reject) => {\n if (this._lastWindow != null) {\n this._lastWindow.close();\n this._lastWindow = null;\n resolve();\n } else {\n reject('No active window to close!');\n }\n });\n }\n}\n\nconst Browser = new BrowserWeb();\n\nexport { Browser };\n"]}
|
|
@@ -4,5 +4,5 @@
|
|
|
4
4
|
CAP_PLUGIN(CAPBrowserPlugin, "Browser",
|
|
5
5
|
CAP_PLUGIN_METHOD(open, CAPPluginReturnPromise);
|
|
6
6
|
CAP_PLUGIN_METHOD(close, CAPPluginReturnPromise);
|
|
7
|
-
CAP_PLUGIN_METHOD(removeAllListeners,
|
|
7
|
+
CAP_PLUGIN_METHOD(removeAllListeners, CAPPluginReturnPromise);
|
|
8
8
|
)
|
|
@@ -28,7 +28,11 @@ public class CAPBrowserPlugin: CAPPlugin {
|
|
|
28
28
|
// display
|
|
29
29
|
DispatchQueue.main.async { [weak self] in
|
|
30
30
|
if style == .popover {
|
|
31
|
-
|
|
31
|
+
if let width = call.getInt("width"), let height = call.getInt("height") {
|
|
32
|
+
self?.setCenteredPopover(viewController, size: CGSize.init(width: width, height: height))
|
|
33
|
+
} else {
|
|
34
|
+
self?.setCenteredPopover(viewController)
|
|
35
|
+
}
|
|
32
36
|
}
|
|
33
37
|
self?.bridge?.presentVC(viewController, animated: true, completion: {
|
|
34
38
|
call.resolve()
|
|
@@ -50,7 +54,7 @@ public class CAPBrowserPlugin: CAPPlugin {
|
|
|
50
54
|
}
|
|
51
55
|
|
|
52
56
|
private func presentationStyle(for style: String?) -> UIModalPresentationStyle {
|
|
53
|
-
if let style = style, style == "popover"
|
|
57
|
+
if let style = style, style == "popover" {
|
|
54
58
|
return .popover
|
|
55
59
|
}
|
|
56
60
|
return .fullScreen
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capacitor/browser",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-beta.2",
|
|
4
4
|
"description": "The Browser API provides the ability to open an in-app browser and subscribe to browser events.",
|
|
5
5
|
"main": "dist/plugin.cjs.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
],
|
|
30
30
|
"scripts": {
|
|
31
31
|
"verify": "npm run verify:ios && npm run verify:android && npm run verify:web",
|
|
32
|
-
"verify:ios": "cd ios && pod install && xcodebuild -workspace Plugin.xcworkspace -scheme Plugin && cd ..",
|
|
32
|
+
"verify:ios": "cd ios && pod install && xcodebuild -workspace Plugin.xcworkspace -scheme Plugin -destination generic/platform=iOS && cd ..",
|
|
33
33
|
"verify:android": "cd android && ./gradlew clean build test && cd ..",
|
|
34
34
|
"verify:web": "npm run build",
|
|
35
35
|
"lint": "npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint",
|
|
@@ -45,10 +45,10 @@
|
|
|
45
45
|
"publish:cocoapod": "pod trunk push ./CapacitorBrowser.podspec --allow-warnings"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@capacitor/android": "
|
|
49
|
-
"@capacitor/core": "
|
|
48
|
+
"@capacitor/android": "next",
|
|
49
|
+
"@capacitor/core": "next",
|
|
50
50
|
"@capacitor/docgen": "0.0.18",
|
|
51
|
-
"@capacitor/ios": "
|
|
51
|
+
"@capacitor/ios": "next",
|
|
52
52
|
"@ionic/eslint-config": "^0.3.0",
|
|
53
53
|
"@ionic/prettier-config": "~1.0.1",
|
|
54
54
|
"@ionic/swiftlint-config": "^1.1.2",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"typescript": "~4.1.5"
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
|
-
"@capacitor/core": "
|
|
64
|
+
"@capacitor/core": "next"
|
|
65
65
|
},
|
|
66
66
|
"prettier": "@ionic/prettier-config",
|
|
67
67
|
"swiftlint": "@ionic/swiftlint-config",
|
|
@@ -79,5 +79,5 @@
|
|
|
79
79
|
"publishConfig": {
|
|
80
80
|
"access": "public"
|
|
81
81
|
},
|
|
82
|
-
"gitHead": "
|
|
82
|
+
"gitHead": "32240b675c12a774920c07a86b4483ecec7a9c8d"
|
|
83
83
|
}
|