diff --git a/.eslintrc b/.eslintrc
index 322c735..f32d546 100644
--- a/.eslintrc
+++ b/.eslintrc
@@ -318,7 +318,7 @@
// https://eslint.org/docs/rules/key-spacing
"key-spacing": [
- "warn",
+ "warn",
{
"singleLine": {
"beforeColon": false,
@@ -492,4 +492,4 @@
"parserOptions": {
"sourceType": "module"
}
-}
\ No newline at end of file
+}
diff --git a/.gitignore b/.gitignore
index 9cadbfe..3cd0782 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,7 +8,7 @@
node_modules/
npm-debug.log
yarn-error.log
-
+
# Xcode
#
@@ -29,7 +29,7 @@ DerivedData
*.ipa
*.xcuserstate
project.xcworkspace
-
+
# Android/IntelliJ
#
@@ -43,4 +43,3 @@ local.properties
buck-out/
\.buckd/
*.keystore
-
\ No newline at end of file
diff --git a/LICENSE b/LICENSE
index 64bf1bd..67c050c 100644
--- a/LICENSE
+++ b/LICENSE
@@ -10,4 +10,4 @@ use this file except in compliance with the License. You may obtain a copy of th
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-License for the specific language governing permissions and limitations under the License.
\ No newline at end of file
+License for the specific language governing permissions and limitations under the License.
diff --git a/README.md b/README.md
index 9dbeb51..f8c7d1c 100644
--- a/README.md
+++ b/README.md
@@ -67,14 +67,14 @@ For anything **`< 0.60`** run the following link command
- Add `import com.eko.RNBackgroundDownloaderPackage;` to the imports at the top of the file
- Add `new RNBackgroundDownloaderPackage()` to the list returned by the `getPackages()` method
2. Append the following lines to `android/settings.gradle`:
- ```
- include ':react-native-background-downloader'
- project(':react-native-background-downloader').projectDir = new File(rootProject.projectDir, '../node_modules/@kesha-antonov/react-native-background-downloader/android')
- ```
+ ```
+ include ':react-native-background-downloader'
+ project(':react-native-background-downloader').projectDir = new File(rootProject.projectDir, '../node_modules/@kesha-antonov/react-native-background-downloader/android')
+ ```
3. Insert the following lines inside the dependencies block in `android/app/build.gradle`:
- ```
+ ```
compile project(':react-native-background-downloader')
- ```
+ ```
### iOS - Extra Mandatory Step
@@ -105,16 +105,16 @@ import { download, completeHandler } from '@kesha-antonov/react-native-backgroun
const jobId = 'file123'
let task = download({
- id: jobId,
- url: 'https://link-to-very.large/file.zip',
- destination: `${RNBackgroundDownloader.directories.documents}/file.zip`,
- metadata: {}
+ id: jobId,
+ url: 'https://link-to-very.large/file.zip',
+ destination: `${RNBackgroundDownloader.directories.documents}/file.zip`,
+ metadata: {}
}).begin(({ expectedBytes, headers }) => {
- console.log(`Going to download ${expectedBytes} bytes!`)
+ console.log(`Going to download ${expectedBytes} bytes!`)
}).progress(percent => {
- console.log(`Downloaded: ${percent * 100}%`)
+ console.log(`Downloaded: ${percent * 100}%`)
}).done(() => {
- console.log('Download is done!')
+ console.log('Download is done!')
// PROCESS YOUR STUFF
@@ -122,7 +122,7 @@ let task = download({
if (Platform.OS === 'ios')
completeHandler(jobId)
}).error(error => {
- console.log('Download canceled due to error: ', error);
+ console.log('Download canceled due to error: ', error);
})
// Pause the task
@@ -148,14 +148,14 @@ import RNBackgroundDownloader from '@kesha-antonov/react-native-background-downl
let lostTasks = await RNBackgroundDownloader.checkForExistingDownloads()
for (let task of lostTasks) {
- console.log(`Task ${task.id} was found!`)
- task.progress(percent => {
- console.log(`Downloaded: ${percent * 100}%`)
- }).done(() => {
- console.log('Download is done!')
- }).error(error => {
- console.log('Download canceled due to error: ', error)
- })
+ console.log(`Task ${task.id} was found!`)
+ task.progress(percent => {
+ console.log(`Downloaded: ${percent * 100}%`)
+ }).done(() => {
+ console.log('Download is done!')
+ }).error(error => {
+ console.log('Download canceled due to error: ', error)
+ })
}
```
@@ -175,20 +175,20 @@ This way, all downloads with have the given headers.
2) Per download by passing a headers object in the options of `RNBackgroundDownloader.download()`:
```javascript
let task = RNBackgroundDownloader.download({
- id: 'file123',
- url: 'https://link-to-very.large/file.zip'
- destination: `${RNBackgroundDownloader.directories.documents}/file.zip`,
- headers: {
- Authorization: 'Bearer 2we$@$@Ddd223'
- }
+ id: 'file123',
+ url: 'https://link-to-very.large/file.zip'
+ destination: `${RNBackgroundDownloader.directories.documents}/file.zip`,
+ headers: {
+ Authorization: 'Bearer 2we$@$@Ddd223'
+ }
}).begin(({ expectedBytes, headers }) => {
- console.log(`Going to download ${expectedBytes} bytes!`)
+ console.log(`Going to download ${expectedBytes} bytes!`)
}).progress(percent => {
- console.log(`Downloaded: ${percent * 100}%`)
+ console.log(`Downloaded: ${percent * 100}%`)
}).done(() => {
- console.log('Download is done!')
+ console.log('Download is done!')
}).error(error => {
- console.log('Download canceled due to error: ', error)
+ console.log('Download canceled due to error: ', error)
})
```
Headers given in the `download` function are **merged** with the ones given in `setHeaders`.
@@ -266,7 +266,7 @@ Either stop all tasks:
```javascript
const tasks = await checkForExistingDownloads()
for (const task of tasks)
- task.stop()
+ task.stop()
```
Or re-attach them:
@@ -274,11 +274,11 @@ Or re-attach them:
```javascript
const tasks = await checkForExistingDownloads()
for (const task of tasks) {
- task.pause()
- //
- // YOUR LOGIC OF RE-ATTACHING DOWLOADS TO YOUR STUFF
- // ...
- //
+ task.pause()
+ //
+ // YOUR LOGIC OF RE-ATTACHING DOWLOADS TO YOUR STUFF
+ // ...
+ //
}
```
@@ -289,10 +289,10 @@ for (const task of tasks) {
```javascript
function handleAppStateChange (appState) {
- if (appState !== 'active')
- return
+ if (appState !== 'active')
+ return
- ensureDownloadsAreRunning()
+ ensureDownloadsAreRunning()
}
const appStateChangeListener = AppState.addEventListener('change', handleAppStateChange)
diff --git a/android/.classpath b/android/.classpath
index eb19361..bf7c5bb 100644
--- a/android/.classpath
+++ b/android/.classpath
@@ -1,6 +1,6 @@
-
-
-
+
+
+
diff --git a/android/.project b/android/.project
index 5d6f073..bdc98b9 100644
--- a/android/.project
+++ b/android/.project
@@ -1,23 +1,23 @@
- react-native-background-downloader
- Project react-native-background-downloader created by Buildship.
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
- org.eclipse.buildship.core.gradleprojectbuilder
-
-
-
-
-
- org.eclipse.jdt.core.javanature
- org.eclipse.buildship.core.gradleprojectnature
-
+ react-native-background-downloader
+ Project react-native-background-downloader created by Buildship.
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.eclipse.buildship.core.gradleprojectbuilder
+
+
+
+
+
+ org.eclipse.jdt.core.javanature
+ org.eclipse.buildship.core.gradleprojectnature
+
diff --git a/android/src/main/AndroidManifest.xml b/android/src/main/AndroidManifest.xml
index 005b242..357e2e7 100644
--- a/android/src/main/AndroidManifest.xml
+++ b/android/src/main/AndroidManifest.xml
@@ -3,4 +3,3 @@
package="com.eko">
-
\ No newline at end of file
diff --git a/android/src/main/java/com/eko/RNBackgroundDownloaderPackage.java b/android/src/main/java/com/eko/RNBackgroundDownloaderPackage.java
index 642cd7b..e49a00b 100644
--- a/android/src/main/java/com/eko/RNBackgroundDownloaderPackage.java
+++ b/android/src/main/java/com/eko/RNBackgroundDownloaderPackage.java
@@ -19,4 +19,4 @@ public class RNBackgroundDownloaderPackage implements ReactPackage {
public List createViewManagers(ReactApplicationContext reactContext) {
return Collections.emptyList();
}
-}
\ No newline at end of file
+}
diff --git a/example/android/app/src/main/res/drawable/rn_edit_text_material.xml b/example/android/app/src/main/res/drawable/rn_edit_text_material.xml
index f35d996..73b37e4 100644
--- a/example/android/app/src/main/res/drawable/rn_edit_text_material.xml
+++ b/example/android/app/src/main/res/drawable/rn_edit_text_material.xml
@@ -20,7 +20,7 @@
android:insetBottom="@dimen/abc_edit_text_inset_bottom_material">
-