Skip to content

Commit 072508d

Browse files
MayankLogicieljanpiotimbru31erisubreautek
authored
Updated Repo for using updated plugin. (#1)
* Add or update GitHub pull request and issue template * docs: undeprecate the plugin (apache#267) Co-authored-by: エリス <[email protected]> * fix(ios): re-implement user agent overwrite (apache#268) This closes apache#263 apache#258 * chore(npm): adds ignore list (apache#269) * fix!: remove deprecated platforms (apache#270) * chore: bump version to 2.0.0-dev (apache#273) * chore: package cleanup (apache#272) * refactor(eslint): use cordova-eslint /w fix (apache#275) * chore: adds package-lock file (apache#274) * doc: Improve progressEvent documentation (apache#280) Co-authored-by: Jan Piotrowski <[email protected]> Co-authored-by: Tim Brust <[email protected]> Co-authored-by: エリス <[email protected]> Co-authored-by: Norman Breau <[email protected]>
1 parent 5d8891c commit 072508d

31 files changed

+3823
-4816
lines changed

.eslintrc.yml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
root: true
19+
extends: '@cordova/eslint-config/browser'
20+
21+
overrides:
22+
- files: [tests/**/*.js]
23+
extends: '@cordova/eslint-config/node-tests'

.github/ISSUE_TEMPLATE.md

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<!--
2+
Please have a look at the issue templates you get when you click "New issue" in the GitHub UI.
3+
We very much prefer issues created by using one of these templates.
4+
-->
5+
6+
### Issue Type
7+
<!-- Please check the boxes by putting an x in the [ ] like so: [x] -->
8+
9+
- [ ] Bug Report
10+
- [ ] Feature Request
11+
- [ ] Support Question
12+
13+
## Description
14+
15+
## Information
16+
<!-- Include all relevant information that might help understand and reproduce the problem -->
17+
18+
### Command or Code
19+
<!-- What command or code is needed to reproduce the problem? -->
20+
21+
### Environment, Platform, Device
22+
<!-- In what environment, on what platform or on which device are you experiencing the issue? -->
23+
24+
25+
26+
### Version information
27+
<!--
28+
What are relevant versions you are using?
29+
For example:
30+
Cordova: Cordova CLI, Cordova Platforms, Cordova Plugins
31+
Other Frameworks: Ionic Framework and CLI version
32+
Operating System, Android Studio, Xcode etc.
33+
-->
34+
35+
36+
37+
## Checklist
38+
<!-- Please check the boxes by putting an `x` in the `[ ]` like so: `[x]` -->
39+
40+
- [ ] I searched for already existing GitHub issues about this
41+
- [ ] I updated all Cordova tooling to their most recent version
42+
- [ ] I included all the necessary information above

.github/ISSUE_TEMPLATE/BUG_REPORT.md

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
name: 🐛 Bug Report
3+
about: If something isn't working as expected.
4+
5+
---
6+
7+
# Bug Report
8+
9+
## Problem
10+
11+
### What is expected to happen?
12+
13+
14+
15+
### What does actually happen?
16+
17+
18+
19+
## Information
20+
<!-- Include all relevant information that might help understand and reproduce the problem -->
21+
22+
23+
24+
### Command or Code
25+
<!-- What command or code is needed to reproduce the problem? -->
26+
27+
28+
29+
### Environment, Platform, Device
30+
<!-- In what environment, on what platform or on which device are you experiencing the issue? -->
31+
32+
33+
34+
### Version information
35+
<!--
36+
What are relevant versions you are using?
37+
For example:
38+
Cordova: Cordova CLI, Cordova Platforms, Cordova Plugins
39+
Other Frameworks: Ionic Framework and CLI version
40+
Operating System, Android Studio, Xcode etc.
41+
-->
42+
43+
44+
45+
## Checklist
46+
<!-- Please check the boxes by putting an x in the [ ] like so: [x] -->
47+
48+
- [ ] I searched for existing GitHub issues
49+
- [ ] I updated all Cordova tooling to most recent version
50+
- [ ] I included all the necessary information above
+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
name: 🚀 Feature Request
3+
about: A suggestion for a new functionality
4+
5+
---
6+
7+
# Feature Request
8+
9+
## Motivation Behind Feature
10+
<!-- Why should this feature be implemented? What problem does it solve? -->
11+
12+
13+
14+
## Feature Description
15+
<!--
16+
Describe your feature request in detail
17+
Please provide any code examples or screenshots of what this feature would look like
18+
Are there any drawbacks? Will this break anything for existing users?
19+
-->
20+
21+
22+
23+
## Alternatives or Workarounds
24+
<!--
25+
Describe alternatives or workarounds you are currently using
26+
Are there ways to do this with existing functionality?
27+
-->
28+
29+
+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
name: 💬 Support Question
3+
about: If you have a question, please check out our Slack or StackOverflow!
4+
5+
---
6+
7+
<!------------^ Click "Preview" for a nicer view! -->
8+
9+
Apache Cordova uses GitHub Issues as a feature request and bug tracker _only_.
10+
For usage and support questions, please check out the resources below. Thanks!
11+
12+
---
13+
14+
You can get answers to your usage and support questions about **Apache Cordova** on:
15+
16+
* Slack Community Chat: https://cordova.slack.com (you can sign-up at http://slack.cordova.io/)
17+
* StackOverflow: https://stackoverflow.com/questions/tagged/cordova using the tag `cordova`
18+
19+
---
20+
21+
If you are using a tool that uses Cordova internally, like e.g. Ionic, check their support channels:
22+
23+
* **Ionic Framework**
24+
* [Ionic Community Forum](https://forum.ionicframework.com/)
25+
* [Ionic Worldwide Slack](https://ionicworldwide.herokuapp.com/)
26+
* **PhoneGap**
27+
* [PhoneGap Developer Community](https://forums.adobe.com/community/phonegap)

.github/PULL_REQUEST_TEMPLATE.md

+20-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<!--
2-
Please make sure the checklist boxes are all checked before submitting the PR. The checklist
3-
is intended as a quick reference, for complete details please see our Contributor Guidelines:
2+
Please make sure the checklist boxes are all checked before submitting the PR. The checklist is intended as a quick reference, for complete details please see our Contributor Guidelines:
43
54
http://cordova.apache.org/contribute/contribute_guidelines.html
65
@@ -10,13 +9,27 @@ Thanks!
109
### Platforms affected
1110

1211

13-
### What does this PR do?
1412

13+
### Motivation and Context
14+
<!-- Why is this change required? What problem does it solve? -->
15+
<!-- If it fixes an open issue, please link to the issue here. -->
16+
17+
18+
19+
### Description
20+
<!-- Describe your changes in detail -->
21+
22+
23+
24+
### Testing
25+
<!-- Please describe in detail how you tested your changes. -->
1526

16-
### What testing has been done on this change?
1727

1828

1929
### Checklist
20-
- [ ] [Reported an issue](http://cordova.apache.org/contribute/issues.html) in the JIRA database
21-
- [ ] Commit message follows the format: "CB-3232: (android) Fix bug with resolving file paths", where CB-xxxx is the JIRA ID & "android" is the platform affected.
22-
- [ ] Added automated test coverage as appropriate for this change.
30+
31+
- [ ] I've run the tests to see all new and existing tests pass
32+
- [ ] I added automated test coverage as appropriate for this change
33+
- [ ] Commit is prefixed with `(platform)` if this change only applies to one platform (e.g. `(android)`)
34+
- [ ] If this Pull Request resolves an issue, I linked to the issue in the text above (and used the correct [keyword to close issues using keywords](https://help.github.com/articles/closing-issues-using-keywords/))
35+
- [ ] I've updated the documentation if necessary

.jscsrc

-23
This file was deleted.

.jshintrc

-19
This file was deleted.

.npmignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.*
2+
tests

README.md

+15-18
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@ description: Upload and download files.
2727

2828
# cordova-plugin-file-transfer
2929

30+
# Usage notice
31+
32+
With the new features introduced in the [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) and the [XMLHttpRequest](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest), this plugin may not be needed any more for your use case. For small file transfers, you probably won't require this plugin. But, if you plan to handle large downloads, suffering from slow saving, timeouts, or crashes, this plugin is better suited for your use case over the Fetch API or the XMLHttpRequest.
33+
34+
Migrating from this plugin to using the new features of [XMLHttpRequest](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest), is explained in this [Cordova blog post](https://cordova.apache.org/blog/2017/10/18/from-filetransfer-to-xhr2.html).
35+
36+
## Description
37+
3038
This plugin allows you to upload and download files.
3139

3240
This plugin defines global `FileTransfer`, `FileUploadOptions` constructors. Although in the global scope, they are not available until after the `deviceready` event.
@@ -42,10 +50,6 @@ function onDeviceReady() {
4250
4351
Report issues with this plugin on the [Apache Cordova issue tracker](https://issues.apache.org/jira/issues/?jql=project%20%3D%20CB%20AND%20status%20in%20%28Open%2C%20%22In%20Progress%22%2C%20Reopened%29%20AND%20resolution%20%3D%20Unresolved%20AND%20component%20%3D%20%22Plugin%20File%20Transfer%22%20ORDER%20BY%20priority%20DESC%2C%20summary%20ASC%2C%20updatedDate%20DESC)
4452

45-
## Deprecated
46-
47-
With the new features introduced in [XMLHttpRequest](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest), this plugin is not needed any more. Migrating from this plugin to using the new features of [XMLHttpRequest](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest), is explained in this [Cordova blog post](https://cordova.apache.org/blog/2017/10/18/from-filetransfer-to-xhr2.html).
48-
4953
## Installation
5054

5155
```bash
@@ -54,19 +58,11 @@ cordova plugin add cordova-plugin-file-transfer
5458

5559
## Supported Platforms
5660

57-
- Amazon Fire OS
5861
- Android
59-
- BlackBerry 10
6062
- Browser
61-
- Firefox OS**
6263
- iOS
63-
- Windows Phone 7 and 8*
6464
- Windows
6565

66-
\* _Do not support `onprogress` nor `abort()`_
67-
68-
\** _Do not support `onprogress`_
69-
7066
# FileTransfer
7167

7268
The `FileTransfer` object provides a way to upload files using an HTTP
@@ -168,12 +164,17 @@ var headers={'headerParam':'headerValue', 'headerParam2':'headerValue2'};
168164
options.headers = headers;
169165

170166
var ft = new FileTransfer();
167+
var progressValue = 0;
171168
ft.onprogress = function(progressEvent) {
172169
if (progressEvent.lengthComputable) {
173-
loadingStatus.setPercentage(progressEvent.loaded / progressEvent.total);
170+
// Calculate the percentage
171+
progressValue = progressEvent.loaded / progressEvent.total;
174172
} else {
175-
loadingStatus.increment();
173+
progressValue++;
176174
}
175+
176+
// Display percentage in the UI
177+
document.getElementByID('progress-value').innerHTML = progressValue;
177178
};
178179
ft.upload(fileURL, uri, win, fail, options);
179180
```
@@ -255,10 +256,6 @@ fileTransfer.download(
255256
);
256257
```
257258

258-
### WP8 Quirks
259-
260-
- Download requests is being cached by native implementation. To avoid caching, pass `if-Modified-Since` header to download method.
261-
262259
### Browser Quirks
263260

264261
- __withCredentials__: _boolean_ that tells the browser to set the withCredentials flag on the XMLHttpRequest

0 commit comments

Comments
 (0)