@sumaris-net/ngx-components 2.2.2 → 2.2.4
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/doc/changelog.md +3 -0
- package/esm2020/public_api.mjs +3 -1
- package/esm2020/src/app/core/form/form.utils.mjs +1 -2
- package/esm2020/src/app/core/services/platform.service.mjs +6 -4
- package/esm2020/src/app/core/table/table.class.mjs +3 -3
- package/esm2020/src/app/shared/dates.mjs +2 -2
- package/esm2020/src/app/shared/file/json.utils.mjs +33 -0
- package/esm2020/src/app/shared/geolocation/geolocation.utils.mjs +41 -0
- package/esm2020/src/app/shared/material/latlong/testing/latlong.test.mjs +44 -16
- package/fesm2015/sumaris-net.ngx-components.mjs +113 -18
- package/fesm2015/sumaris-net.ngx-components.mjs.map +1 -1
- package/fesm2020/sumaris-net.ngx-components.mjs +114 -15
- package/fesm2020/sumaris-net.ngx-components.mjs.map +1 -1
- package/package.json +1 -1
- package/public_api.d.ts +2 -0
- package/resources/README.md +5 -6
- package/src/app/core/form/form.utils.d.ts +0 -1
- package/src/app/core/table/table.class.d.ts +3 -1
- package/src/app/shared/file/json.utils.d.ts +11 -0
- package/src/app/shared/geolocation/geolocation.utils.d.ts +11 -0
- package/src/app/shared/material/latlong/testing/latlong.test.d.ts +5 -2
- package/plugins/clovelced-plugin-audiomanagement/README.md +0 -66
- package/plugins/cordova-plugin-camera/README.md +0 -703
- package/plugins/cordova-plugin-device/README.md +0 -309
- package/plugins/cordova-plugin-file/README.md +0 -848
- package/plugins/cordova-plugin-file-transfer/README.md +0 -598
- package/plugins/cordova-plugin-file-transfer/doc/de/README.md +0 -311
- package/plugins/cordova-plugin-file-transfer/doc/es/README.md +0 -311
- package/plugins/cordova-plugin-file-transfer/doc/fr/README.md +0 -270
- package/plugins/cordova-plugin-file-transfer/doc/it/README.md +0 -311
- package/plugins/cordova-plugin-file-transfer/doc/ja/README.md +0 -311
- package/plugins/cordova-plugin-file-transfer/doc/ko/README.md +0 -311
- package/plugins/cordova-plugin-file-transfer/doc/pl/README.md +0 -311
- package/plugins/cordova-plugin-file-transfer/doc/zh/README.md +0 -311
- package/plugins/cordova-plugin-ionic-keyboard/README.md +0 -220
- package/plugins/cordova-plugin-ionic-webview/README.md +0 -181
- package/plugins/cordova-plugin-media-capture/README.md +0 -626
- package/plugins/cordova-plugin-splashscreen/README.md +0 -387
- package/plugins/cordova-plugin-statusbar/README.md +0 -341
- package/plugins/cordova-plugin-telerik-imagepicker/README.md +0 -155
- package/plugins/cordova-plugin-whitelist/README.md +0 -185
- package/plugins/cordova-sqlite-storage/README.md +0 -1848
- package/plugins/integrator-cordova-plugin-downloader/README.md +0 -49
|
@@ -1,341 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Statusbar
|
|
3
|
-
description: Control the device status bar.
|
|
4
|
-
---
|
|
5
|
-
<!---
|
|
6
|
-
# license: Licensed to the Apache Software Foundation (ASF) under one
|
|
7
|
-
# or more contributor license agreements. See the NOTICE file
|
|
8
|
-
# distributed with this work for additional information
|
|
9
|
-
# regarding copyright ownership. The ASF licenses this file
|
|
10
|
-
# to you under the Apache License, Version 2.0 (the
|
|
11
|
-
# "License"); you may not use this file except in compliance
|
|
12
|
-
# with the License. You may obtain a copy of the License at
|
|
13
|
-
#
|
|
14
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
15
|
-
#
|
|
16
|
-
# Unless required by applicable law or agreed to in writing,
|
|
17
|
-
# software distributed under the License is distributed on an
|
|
18
|
-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
19
|
-
# KIND, either express or implied. See the License for the
|
|
20
|
-
# specific language governing permissions and limitations
|
|
21
|
-
# under the License.
|
|
22
|
-
-->
|
|
23
|
-
|
|
24
|
-
|AppVeyor|Travis CI|
|
|
25
|
-
|:-:|:-:|
|
|
26
|
-
|[](https://ci.appveyor.com/project/ApacheSoftwareFoundation/cordova-plugin-statusbar)|[](https://travis-ci.org/apache/cordova-plugin-statusbar)|
|
|
27
|
-
|
|
28
|
-
# cordova-plugin-statusbar
|
|
29
|
-
|
|
30
|
-
> The `StatusBar` object provides some functions to customize the iOS and Android StatusBar.
|
|
31
|
-
|
|
32
|
-
## Installation
|
|
33
|
-
|
|
34
|
-
This installation method requires cordova 5.0+
|
|
35
|
-
|
|
36
|
-
cordova plugin add cordova-plugin-statusbar
|
|
37
|
-
Older versions of cordova can still install via the __deprecated__ id
|
|
38
|
-
|
|
39
|
-
cordova plugin add org.apache.cordova.statusbar
|
|
40
|
-
It is also possible to install via repo url directly ( unstable )
|
|
41
|
-
|
|
42
|
-
cordova plugin add https://github.com/apache/cordova-plugin-statusbar.git
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
Preferences
|
|
46
|
-
-----------
|
|
47
|
-
|
|
48
|
-
#### config.xml
|
|
49
|
-
|
|
50
|
-
- __StatusBarOverlaysWebView__ (boolean, defaults to true). Make the statusbar overlay or not overlay the WebView at startup.
|
|
51
|
-
|
|
52
|
-
<preference name="StatusBarOverlaysWebView" value="true" />
|
|
53
|
-
|
|
54
|
-
##### Android Quirks
|
|
55
|
-
|
|
56
|
-
Only supported on Android 5 or later. Earlier versions will ignore this preference.
|
|
57
|
-
|
|
58
|
-
- __StatusBarBackgroundColor__ (color hex string, no default value). Set the background color of the statusbar by a hex string (#RRGGBB) at startup. If this value is not set, the background color will be transparent.
|
|
59
|
-
|
|
60
|
-
<preference name="StatusBarBackgroundColor" value="#000000" />
|
|
61
|
-
|
|
62
|
-
- __StatusBarStyle__ (status bar style, defaults to lightcontent). Set the status bar style. Available options default, lightcontent, blacktranslucent, blackopaque.
|
|
63
|
-
|
|
64
|
-
<preference name="StatusBarStyle" value="lightcontent" />
|
|
65
|
-
|
|
66
|
-
- __StatusBarDefaultScrollToTop__ (boolean, defaults to false). On iOS, allows the Cordova WebView to use default scroll-to-top behavior. Defaults to false so you can listen to the "statusTap" event (described below) and customize the behavior instead.
|
|
67
|
-
|
|
68
|
-
<preference name="StatusBarDefaultScrollToTop" value="false" />
|
|
69
|
-
|
|
70
|
-
### Android Quirks
|
|
71
|
-
The Android 5+ guidelines specify using a different color for the statusbar than your main app color (unlike the uniform statusbar color of many iOS apps), so you may want to set the statusbar color at runtime instead via `StatusBar.backgroundColorByHexString` or `StatusBar.backgroundColorByName`. One way to do that would be:
|
|
72
|
-
```js
|
|
73
|
-
if (cordova.platformId == 'android') {
|
|
74
|
-
StatusBar.backgroundColorByHexString("#333");
|
|
75
|
-
}
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
It is also possible to make the status bar semi-transparent. Android uses hexadecimal ARGB values, which are formatted as #AARRGGBB. That first pair of letters, the AA, represent the alpha channel. You must convert your decimal opacity values to a hexadecimal value. You can read more about it [here](https://stackoverflow.com/questions/5445085/understanding-colors-on-android-six-characters/11019879#11019879).
|
|
79
|
-
|
|
80
|
-
For example, a black status bar with 20% opacity:
|
|
81
|
-
```js
|
|
82
|
-
if (cordova.platformId == 'android') {
|
|
83
|
-
StatusBar.overlaysWebView(true);
|
|
84
|
-
StatusBar.backgroundColorByHexString('#33000000');
|
|
85
|
-
}
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
Hiding at startup
|
|
89
|
-
-----------
|
|
90
|
-
|
|
91
|
-
During runtime you can use the StatusBar.hide function below, but if you want the StatusBar to be hidden at app startup on iOS, you must modify your app's Info.plist file.
|
|
92
|
-
|
|
93
|
-
Add/edit these two attributes if not present. Set **"Status bar is initially hidden"** to **"YES"** and set **"View controller-based status bar appearance"** to **"NO"**. If you edit it manually without Xcode, the keys and values are:
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
<key>UIStatusBarHidden</key>
|
|
97
|
-
<true/>
|
|
98
|
-
<key>UIViewControllerBasedStatusBarAppearance</key>
|
|
99
|
-
<false/>
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
Methods
|
|
103
|
-
-------
|
|
104
|
-
This plugin defines global `StatusBar` object.
|
|
105
|
-
|
|
106
|
-
Although in the global scope, it is not available until after the `deviceready` event.
|
|
107
|
-
|
|
108
|
-
document.addEventListener("deviceready", onDeviceReady, false);
|
|
109
|
-
function onDeviceReady() {
|
|
110
|
-
console.log(StatusBar);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
- StatusBar.overlaysWebView
|
|
114
|
-
- StatusBar.styleDefault
|
|
115
|
-
- StatusBar.styleLightContent
|
|
116
|
-
- StatusBar.styleBlackTranslucent
|
|
117
|
-
- StatusBar.styleBlackOpaque
|
|
118
|
-
- StatusBar.backgroundColorByName
|
|
119
|
-
- StatusBar.backgroundColorByHexString
|
|
120
|
-
- StatusBar.hide
|
|
121
|
-
- StatusBar.show
|
|
122
|
-
|
|
123
|
-
Properties
|
|
124
|
-
--------
|
|
125
|
-
|
|
126
|
-
- StatusBar.isVisible
|
|
127
|
-
|
|
128
|
-
Events
|
|
129
|
-
------
|
|
130
|
-
|
|
131
|
-
- statusTap
|
|
132
|
-
|
|
133
|
-
StatusBar.overlaysWebView
|
|
134
|
-
=================
|
|
135
|
-
|
|
136
|
-
Make the statusbar overlay or not overlay the WebView.
|
|
137
|
-
|
|
138
|
-
StatusBar.overlaysWebView(true);
|
|
139
|
-
|
|
140
|
-
Description
|
|
141
|
-
-----------
|
|
142
|
-
|
|
143
|
-
Set to true to make the statusbar overlay on top of your app. Ensure that you adjust your styling accordingly so that your app's title bar or content is not covered. Set to false to make the statusbar solid and not overlay your app. You can then set the style and background color to suit using the other functions.
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
Supported Platforms
|
|
147
|
-
-------------------
|
|
148
|
-
|
|
149
|
-
- iOS 7+
|
|
150
|
-
- Android 5+
|
|
151
|
-
|
|
152
|
-
Quick Example
|
|
153
|
-
-------------
|
|
154
|
-
|
|
155
|
-
StatusBar.overlaysWebView(true);
|
|
156
|
-
StatusBar.overlaysWebView(false);
|
|
157
|
-
|
|
158
|
-
StatusBar.styleDefault
|
|
159
|
-
=================
|
|
160
|
-
|
|
161
|
-
Use the default statusbar (dark text, for light backgrounds).
|
|
162
|
-
|
|
163
|
-
StatusBar.styleDefault();
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
Supported Platforms
|
|
167
|
-
-------------------
|
|
168
|
-
|
|
169
|
-
- iOS
|
|
170
|
-
- Android 6+
|
|
171
|
-
- Windows Phone 7
|
|
172
|
-
- Windows Phone 8
|
|
173
|
-
- Windows Phone 8.1
|
|
174
|
-
|
|
175
|
-
StatusBar.styleLightContent
|
|
176
|
-
=================
|
|
177
|
-
|
|
178
|
-
Use the lightContent statusbar (light text, for dark backgrounds).
|
|
179
|
-
|
|
180
|
-
StatusBar.styleLightContent();
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
Supported Platforms
|
|
184
|
-
-------------------
|
|
185
|
-
|
|
186
|
-
- iOS
|
|
187
|
-
- Android 6+
|
|
188
|
-
- Windows Phone 7
|
|
189
|
-
- Windows Phone 8
|
|
190
|
-
- Windows Phone 8.1
|
|
191
|
-
|
|
192
|
-
StatusBar.styleBlackTranslucent
|
|
193
|
-
=================
|
|
194
|
-
|
|
195
|
-
Use the blackTranslucent statusbar (light text, for dark backgrounds).
|
|
196
|
-
|
|
197
|
-
StatusBar.styleBlackTranslucent();
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
Supported Platforms
|
|
201
|
-
-------------------
|
|
202
|
-
|
|
203
|
-
- iOS
|
|
204
|
-
- Android 6+
|
|
205
|
-
- Windows Phone 7
|
|
206
|
-
- Windows Phone 8
|
|
207
|
-
- Windows Phone 8.1
|
|
208
|
-
|
|
209
|
-
StatusBar.styleBlackOpaque
|
|
210
|
-
=================
|
|
211
|
-
|
|
212
|
-
Use the blackOpaque statusbar (light text, for dark backgrounds).
|
|
213
|
-
|
|
214
|
-
StatusBar.styleBlackOpaque();
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
Supported Platforms
|
|
218
|
-
-------------------
|
|
219
|
-
|
|
220
|
-
- iOS
|
|
221
|
-
- Android 6+
|
|
222
|
-
- Windows Phone 7
|
|
223
|
-
- Windows Phone 8
|
|
224
|
-
- Windows Phone 8.1
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
StatusBar.backgroundColorByName
|
|
228
|
-
=================
|
|
229
|
-
|
|
230
|
-
On iOS, when you set StatusBar.overlaysWebView to false, you can set the background color of the statusbar by color name.
|
|
231
|
-
|
|
232
|
-
StatusBar.backgroundColorByName("red");
|
|
233
|
-
|
|
234
|
-
Supported color names are:
|
|
235
|
-
|
|
236
|
-
black, darkGray, lightGray, white, gray, red, green, blue, cyan, yellow, magenta, orange, purple, brown
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
Supported Platforms
|
|
240
|
-
-------------------
|
|
241
|
-
|
|
242
|
-
- iOS
|
|
243
|
-
- Android 5+
|
|
244
|
-
- Windows Phone 7
|
|
245
|
-
- Windows Phone 8
|
|
246
|
-
- Windows Phone 8.1
|
|
247
|
-
|
|
248
|
-
StatusBar.backgroundColorByHexString
|
|
249
|
-
=================
|
|
250
|
-
|
|
251
|
-
Sets the background color of the statusbar by a hex string.
|
|
252
|
-
|
|
253
|
-
StatusBar.backgroundColorByHexString("#C0C0C0");
|
|
254
|
-
|
|
255
|
-
CSS shorthand properties are also supported.
|
|
256
|
-
|
|
257
|
-
StatusBar.backgroundColorByHexString("#333"); // => #333333
|
|
258
|
-
StatusBar.backgroundColorByHexString("#FAB"); // => #FFAABB
|
|
259
|
-
|
|
260
|
-
On iOS, when you set StatusBar.overlaysWebView to false, you can set the background color of the statusbar by a hex string (#RRGGBB).
|
|
261
|
-
|
|
262
|
-
On Android, when StatusBar.overlaysWebView is true, and on WP7&8, you can also specify values as #AARRGGBB, where AA is an alpha value.
|
|
263
|
-
|
|
264
|
-
Supported Platforms
|
|
265
|
-
-------------------
|
|
266
|
-
|
|
267
|
-
- iOS
|
|
268
|
-
- Android 5+
|
|
269
|
-
- Windows Phone 7
|
|
270
|
-
- Windows Phone 8
|
|
271
|
-
- Windows Phone 8.1
|
|
272
|
-
|
|
273
|
-
StatusBar.hide
|
|
274
|
-
=================
|
|
275
|
-
|
|
276
|
-
Hide the statusbar.
|
|
277
|
-
|
|
278
|
-
StatusBar.hide();
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
Supported Platforms
|
|
282
|
-
-------------------
|
|
283
|
-
|
|
284
|
-
- iOS
|
|
285
|
-
- Android
|
|
286
|
-
- Windows Phone 7
|
|
287
|
-
- Windows Phone 8
|
|
288
|
-
- Windows Phone 8.1
|
|
289
|
-
|
|
290
|
-
StatusBar.show
|
|
291
|
-
=================
|
|
292
|
-
|
|
293
|
-
Shows the statusbar.
|
|
294
|
-
|
|
295
|
-
StatusBar.show();
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
Supported Platforms
|
|
299
|
-
-------------------
|
|
300
|
-
|
|
301
|
-
- iOS
|
|
302
|
-
- Android
|
|
303
|
-
- Windows Phone 7
|
|
304
|
-
- Windows Phone 8
|
|
305
|
-
- Windows Phone 8.1
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
StatusBar.isVisible
|
|
309
|
-
=================
|
|
310
|
-
|
|
311
|
-
Read this property to see if the statusbar is visible or not.
|
|
312
|
-
|
|
313
|
-
if (StatusBar.isVisible) {
|
|
314
|
-
// do something
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
Supported Platforms
|
|
319
|
-
-------------------
|
|
320
|
-
|
|
321
|
-
- iOS
|
|
322
|
-
- Android
|
|
323
|
-
- Windows Phone 7
|
|
324
|
-
- Windows Phone 8
|
|
325
|
-
- Windows Phone 8.1
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
statusTap
|
|
329
|
-
=========
|
|
330
|
-
|
|
331
|
-
Listen for this event to know if the statusbar was tapped.
|
|
332
|
-
|
|
333
|
-
window.addEventListener('statusTap', function() {
|
|
334
|
-
// scroll-up with document.body.scrollTop = 0; or do whatever you want
|
|
335
|
-
});
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
Supported Platforms
|
|
339
|
-
-------------------
|
|
340
|
-
|
|
341
|
-
- iOS
|
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
cordova-imagePicker
|
|
2
|
-
===================
|
|
3
|
-
|
|
4
|
-
Cordova Plugin For Multiple Image Selection - implemented for iOS and Android 4.0 and above.
|
|
5
|
-
|
|
6
|
-
## Installing the plugin
|
|
7
|
-
|
|
8
|
-
The plugin conforms to the Cordova plugin specification, it can be installed
|
|
9
|
-
using the Cordova / Phonegap command line interface.
|
|
10
|
-
|
|
11
|
-
# without desc
|
|
12
|
-
phonegap plugin add https://github.com/Telerik-Verified-Plugins/ImagePicker.git
|
|
13
|
-
cordova plugin add https://github.com/Telerik-Verified-Plugins/ImagePicker.git
|
|
14
|
-
|
|
15
|
-
# with desc
|
|
16
|
-
phonegap plugin add https://github.com/Telerik-Verified-Plugins/ImagePicker.git --variable PHOTO_LIBRARY_USAGE_DESCRIPTION="your usage message"
|
|
17
|
-
|
|
18
|
-
cordova plugin add https://github.com/Telerik-Verified-Plugins/ImagePicker.git --variable PHOTO_LIBRARY_USAGE_DESCRIPTION="your usage message"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
## Using the plugin
|
|
22
|
-
|
|
23
|
-
The plugin creates the object `window.imagePicker` with the method `getPictures(success, fail, options)`
|
|
24
|
-
|
|
25
|
-
Example - Get Full Size Images (all default options):
|
|
26
|
-
```javascript
|
|
27
|
-
window.imagePicker.getPictures(
|
|
28
|
-
function(results) {
|
|
29
|
-
for (var i = 0; i < results.length; i++) {
|
|
30
|
-
console.log('Image URI: ' + results[i]);
|
|
31
|
-
}
|
|
32
|
-
}, function (error) {
|
|
33
|
-
console.log('Error: ' + error);
|
|
34
|
-
}
|
|
35
|
-
);
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
Example - Get at most 10 images scaled to width of 800:
|
|
39
|
-
```javascript
|
|
40
|
-
window.imagePicker.getPictures(
|
|
41
|
-
function(results) {
|
|
42
|
-
for (var i = 0; i < results.length; i++) {
|
|
43
|
-
console.log('Image URI: ' + results[i]);
|
|
44
|
-
}
|
|
45
|
-
}, function (error) {
|
|
46
|
-
console.log('Error: ' + error);
|
|
47
|
-
}, {
|
|
48
|
-
maximumImagesCount: 10,
|
|
49
|
-
width: 800
|
|
50
|
-
}
|
|
51
|
-
);
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
### Options
|
|
55
|
-
|
|
56
|
-
options = {
|
|
57
|
-
// Android only. Max images to be selected, defaults to 15. If this is set to 1, upon
|
|
58
|
-
// selection of a single image, the plugin will return it.
|
|
59
|
-
maximumImagesCount: int,
|
|
60
|
-
|
|
61
|
-
// max width and height to allow the images to be. Will keep aspect
|
|
62
|
-
// ratio no matter what. So if both are 800, the returned image
|
|
63
|
-
// will be at most 800 pixels wide and 800 pixels tall. If the width is
|
|
64
|
-
// 800 and height 0 the image will be 800 pixels wide if the source
|
|
65
|
-
// is at least that wide.
|
|
66
|
-
width: int,
|
|
67
|
-
height: int,
|
|
68
|
-
|
|
69
|
-
// quality of resized image, defaults to 100
|
|
70
|
-
quality: int (0-100),
|
|
71
|
-
|
|
72
|
-
// output type, defaults to FILE_URIs.
|
|
73
|
-
// available options are
|
|
74
|
-
// window.imagePicker.OutputType.FILE_URI (0) or
|
|
75
|
-
// window.imagePicker.OutputType.BASE64_STRING (1)
|
|
76
|
-
outputType: int
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
### Note for Android Use
|
|
80
|
-
|
|
81
|
-
When outputType is FILE_URI the plugin returns images that are stored in a temporary directory. These images will often not be deleted automatically though. The files should be moved or deleted after you get their filepaths in javascript. If Base64 Strings are being returned, there is nothing to clean up.
|
|
82
|
-
|
|
83
|
-
## Android 6 (M) Permissions
|
|
84
|
-
On Android 6 you need to request permission to read external storage at runtime when targeting API level 23+.
|
|
85
|
-
Even if the `uses-permission` tags for the Calendar are present in `AndroidManifest.xml`.
|
|
86
|
-
|
|
87
|
-
Note that the `hasReadPermission` function will return true when:
|
|
88
|
-
|
|
89
|
-
- You're running this on iOS, or
|
|
90
|
-
- You're targeting an API level lower than 23, or
|
|
91
|
-
- You're using Android < 6, or
|
|
92
|
-
- You've already granted permission.
|
|
93
|
-
|
|
94
|
-
```js
|
|
95
|
-
function hasReadPermission() {
|
|
96
|
-
window.imagePicker.hasReadPermission(
|
|
97
|
-
function(result) {
|
|
98
|
-
// if this is 'false' you probably want to call 'requestReadPermission' now
|
|
99
|
-
alert(result);
|
|
100
|
-
}
|
|
101
|
-
)
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
function requestReadPermission() {
|
|
105
|
-
// no callbacks required as this opens a popup which returns async
|
|
106
|
-
window.imagePicker.requestReadPermission();
|
|
107
|
-
}
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
Note that backward compatibility was added by checking for read permission automatically when `getPictures` is called.
|
|
111
|
-
If permission is needed the plugin will now show the permission request popup.
|
|
112
|
-
The user will then need to allow access and invoke the same method again after doing so.
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
## Libraries used
|
|
116
|
-
|
|
117
|
-
#### ELCImagePicker
|
|
118
|
-
|
|
119
|
-
For iOS this plugin uses the ELCImagePickerController, with slight modifications for the iOS image picker. ELCImagePicker uses the MIT License which can be found in the file LICENSE.
|
|
120
|
-
|
|
121
|
-
https://github.com/B-Sides/ELCImagePickerController
|
|
122
|
-
|
|
123
|
-
#### MultiImageChooser
|
|
124
|
-
|
|
125
|
-
For Android this plugin uses MultiImageChooser, with modifications. MultiImageChooser uses the BSD 2-Clause License which can be found in the file BSD_LICENSE. Some code inside MultImageChooser is licensed under the Apache license which can be found in the file APACHE_LICENSE.
|
|
126
|
-
|
|
127
|
-
https://github.com/derosa/MultiImageChooser
|
|
128
|
-
|
|
129
|
-
#### FakeR
|
|
130
|
-
|
|
131
|
-
Code(FakeR) was also taken from the phonegap BarCodeScanner plugin. This code uses the MIT license.
|
|
132
|
-
|
|
133
|
-
https://github.com/wildabeast/BarcodeScanner
|
|
134
|
-
|
|
135
|
-
## License
|
|
136
|
-
|
|
137
|
-
The MIT License
|
|
138
|
-
|
|
139
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
140
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
141
|
-
in the Software without restriction, including without limitation the rights
|
|
142
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
143
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
144
|
-
furnished to do so, subject to the following conditions:
|
|
145
|
-
|
|
146
|
-
The above copyright notice and this permission notice shall be included in
|
|
147
|
-
all copies or substantial portions of the Software.
|
|
148
|
-
|
|
149
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
150
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
151
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
152
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
153
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
154
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
155
|
-
THE SOFTWARE.
|
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Whitelist
|
|
3
|
-
description: Whitelist external content accessible by your app.
|
|
4
|
-
---
|
|
5
|
-
<!--
|
|
6
|
-
# license: Licensed to the Apache Software Foundation (ASF) under one
|
|
7
|
-
# or more contributor license agreements. See the NOTICE file
|
|
8
|
-
# distributed with this work for additional information
|
|
9
|
-
# regarding copyright ownership. The ASF licenses this file
|
|
10
|
-
# to you under the Apache License, Version 2.0 (the
|
|
11
|
-
# "License"); you may not use this file except in compliance
|
|
12
|
-
# with the License. You may obtain a copy of the License at
|
|
13
|
-
#
|
|
14
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
15
|
-
#
|
|
16
|
-
# Unless required by applicable law or agreed to in writing,
|
|
17
|
-
# software distributed under the License is distributed on an
|
|
18
|
-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
19
|
-
# KIND, either express or implied. See the License for the
|
|
20
|
-
# specific language governing permissions and limitations
|
|
21
|
-
# under the License.
|
|
22
|
-
-->
|
|
23
|
-
|
|
24
|
-
# cordova-plugin-whitelist
|
|
25
|
-
|
|
26
|
-
This plugin implements a whitelist policy for navigating the application webview on Cordova 4.0
|
|
27
|
-
|
|
28
|
-
### Deprecation Notice
|
|
29
|
-
|
|
30
|
-
With the Allow List functionality now integrated into the core of Cordova Android (10.x and greater), this plugin is no longer required.
|
|
31
|
-
|
|
32
|
-
Existing projects using Cordova Android 10 or greater should remove this plugin with the following command:
|
|
33
|
-
|
|
34
|
-
```bash
|
|
35
|
-
cordova plugin rm cordova-plugin-whitelist
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
## Installation
|
|
39
|
-
|
|
40
|
-
You can install whitelist plugin with Cordova CLI, from npm:
|
|
41
|
-
|
|
42
|
-
```
|
|
43
|
-
$ cordova plugin add cordova-plugin-whitelist
|
|
44
|
-
$ cordova prepare
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
## Supported Cordova Platforms
|
|
48
|
-
|
|
49
|
-
* Android 4.0.0 or above
|
|
50
|
-
|
|
51
|
-
## Navigation Whitelist
|
|
52
|
-
|
|
53
|
-
Controls which URLs the WebView itself can be navigated to. Applies to
|
|
54
|
-
top-level navigations only.
|
|
55
|
-
|
|
56
|
-
By default navigations are only allowed to `file://` URLs. To allow others URLs, you must add `<allow-navigation>` tags to your `config.xml`:
|
|
57
|
-
|
|
58
|
-
```xml
|
|
59
|
-
<!-- Allow links to example.com -->
|
|
60
|
-
<allow-navigation href="http://example.com/*" />
|
|
61
|
-
|
|
62
|
-
<!-- Wildcards are allowed for the protocol, as a prefix
|
|
63
|
-
to the host, or as a suffix to the path -->
|
|
64
|
-
<allow-navigation href="*://*.example.com/*" />
|
|
65
|
-
|
|
66
|
-
<!-- A wildcard can be used to whitelist the entire network,
|
|
67
|
-
over HTTP and HTTPS.
|
|
68
|
-
*NOT RECOMMENDED* -->
|
|
69
|
-
<allow-navigation href="*" />
|
|
70
|
-
|
|
71
|
-
<!-- The above is equivalent to these three declarations -->
|
|
72
|
-
<allow-navigation href="http://*/*" />
|
|
73
|
-
<allow-navigation href="https://*/*" />
|
|
74
|
-
<allow-navigation href="data:*" />
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
Quirks: on Android it also applies to iframes for non-http(s) schemes.
|
|
78
|
-
|
|
79
|
-
## Intent Whitelist
|
|
80
|
-
|
|
81
|
-
Controls which URLs the app is allowed to ask the system to open.
|
|
82
|
-
|
|
83
|
-
In `config.xml`, add `<allow-intent>` tags, like this:
|
|
84
|
-
|
|
85
|
-
```xml
|
|
86
|
-
<!-- Allow links to web pages to open in a browser -->
|
|
87
|
-
<allow-intent href="http://*/*" />
|
|
88
|
-
<allow-intent href="https://*/*" />
|
|
89
|
-
|
|
90
|
-
<!-- Allow links to example.com to open in a browser -->
|
|
91
|
-
<allow-intent href="http://example.com/*" />
|
|
92
|
-
|
|
93
|
-
<!-- Wildcards are allowed for the protocol, as a prefix
|
|
94
|
-
to the host, or as a suffix to the path -->
|
|
95
|
-
<allow-intent href="*://*.example.com/*" />
|
|
96
|
-
|
|
97
|
-
<!-- Allow SMS links to open messaging app -->
|
|
98
|
-
<allow-intent href="sms:*" />
|
|
99
|
-
|
|
100
|
-
<!-- Allow tel: links to open the dialer -->
|
|
101
|
-
<allow-intent href="tel:*" />
|
|
102
|
-
|
|
103
|
-
<!-- Allow geo: links to open maps -->
|
|
104
|
-
<allow-intent href="geo:*" />
|
|
105
|
-
|
|
106
|
-
<!-- Allow all unrecognized URLs to open installed apps
|
|
107
|
-
*NOT RECOMMENDED* -->
|
|
108
|
-
<allow-intent href="*" />
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
Without any `<allow-intent>` tags, no requests to external URLs are allowed. However, the default Cordova application includes a quite liberal set of `allow-intent` entries by default. It is advised to narrow this down based on each app's needs.
|
|
112
|
-
|
|
113
|
-
On Android, this equates to sending an intent of type BROWSEABLE.
|
|
114
|
-
|
|
115
|
-
This whitelist does not apply to plugins, only hyperlinks and calls to `window.open()`.
|
|
116
|
-
|
|
117
|
-
Note: `allow-navigation` takes precedence over `allow-intent`. Allowing navigation to all URLs with `<allow-navigation href="*" />` for example has the side effect of "capturing" all intents, so the webview navigates to them instead of triggering e.g. external apps.
|
|
118
|
-
|
|
119
|
-
## Network Request Whitelist
|
|
120
|
-
|
|
121
|
-
Controls which network requests (images, XHRs, etc) are allowed to be made (via cordova native hooks).
|
|
122
|
-
|
|
123
|
-
Note: We suggest you use a Content Security Policy (see below), which is more secure. This whitelist is mostly historical for webviews which do not support CSP.
|
|
124
|
-
|
|
125
|
-
In `config.xml`, add `<access>` tags, like this:
|
|
126
|
-
|
|
127
|
-
```xml
|
|
128
|
-
<!-- Allow images, xhrs, etc. to google.com -->
|
|
129
|
-
<access origin="http://google.com" />
|
|
130
|
-
<access origin="https://google.com" />
|
|
131
|
-
|
|
132
|
-
<!-- Access to the subdomain maps.google.com -->
|
|
133
|
-
<access origin="http://maps.google.com" />
|
|
134
|
-
|
|
135
|
-
<!-- Access to all the subdomains on google.com -->
|
|
136
|
-
<access origin="http://*.google.com" />
|
|
137
|
-
|
|
138
|
-
<!-- Enable requests to content: URLs -->
|
|
139
|
-
<access origin="content:///*" />
|
|
140
|
-
|
|
141
|
-
<!-- Don't block any requests -->
|
|
142
|
-
<access origin="*" />
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
Without any `<access>` tags, only requests to `file://` URLs are allowed. However, the default Cordova application includes `<access origin="*">` by default.
|
|
146
|
-
|
|
147
|
-
Note: Whitelist cannot block network redirects from a whitelisted remote website (i.e. http or https) to a non-whitelisted website. Use CSP rules to mitigate redirects to non-whitelisted websites for webviews that support CSP.
|
|
148
|
-
|
|
149
|
-
Quirk: Android also allows requests to https://ssl.gstatic.com/accessibility/javascript/android/ by default, since this is required for TalkBack to function properly.
|
|
150
|
-
|
|
151
|
-
### Content Security Policy
|
|
152
|
-
|
|
153
|
-
Controls which network requests (images, XHRs, etc) are allowed to be made (via webview directly).
|
|
154
|
-
|
|
155
|
-
On Android and iOS, the network request whitelist (see above) is not able to filter all types of requests (e.g. `<video>` & WebSockets are not blocked). So, in addition to the whitelist, you should use a [Content Security Policy](http://content-security-policy.com/) `<meta>` tag on all of your pages.
|
|
156
|
-
|
|
157
|
-
On Android, support for CSP within the system webview starts with KitKat (but is available on all versions using Crosswalk WebView).
|
|
158
|
-
|
|
159
|
-
Here are some example CSP declarations for your `.html` pages:
|
|
160
|
-
|
|
161
|
-
```html
|
|
162
|
-
<!-- Good default declaration:
|
|
163
|
-
* gap: is required only on iOS (when using UIWebView) and is needed for JS->native communication
|
|
164
|
-
* https://ssl.gstatic.com is required only on Android and is needed for TalkBack to function properly
|
|
165
|
-
* Disables use of eval() and inline scripts in order to mitigate risk of XSS vulnerabilities. To change this:
|
|
166
|
-
* Enable inline JS: add 'unsafe-inline' to default-src
|
|
167
|
-
* Enable eval(): add 'unsafe-eval' to default-src
|
|
168
|
-
-->
|
|
169
|
-
<meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com; style-src 'self' 'unsafe-inline'; media-src *">
|
|
170
|
-
|
|
171
|
-
<!-- Allow everything but only from the same origin and foo.com -->
|
|
172
|
-
<meta http-equiv="Content-Security-Policy" content="default-src 'self' foo.com">
|
|
173
|
-
|
|
174
|
-
<!-- This policy allows everything (eg CSS, AJAX, object, frame, media, etc) except that
|
|
175
|
-
* CSS only from the same origin and inline styles,
|
|
176
|
-
* scripts only from the same origin and inline styles, and eval()
|
|
177
|
-
-->
|
|
178
|
-
<meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'">
|
|
179
|
-
|
|
180
|
-
<!-- Allows XHRs only over HTTPS on the same domain. -->
|
|
181
|
-
<meta http-equiv="Content-Security-Policy" content="default-src 'self' https:">
|
|
182
|
-
|
|
183
|
-
<!-- Allow iframe to https://cordova.apache.org/ -->
|
|
184
|
-
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; frame-src 'self' https://cordova.apache.org">
|
|
185
|
-
```
|