@kesha-antonov/react-native-background-downloader 2.7.2 → 2.8.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/LICENSE CHANGED
@@ -10,4 +10,4 @@ use this file except in compliance with the License. You may obtain a copy of th
10
10
  Unless required by applicable law or agreed to in writing, software
11
11
  distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12
12
  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13
- License for the specific language governing permissions and limitations under the License.
13
+ License for the specific language governing permissions and limitations under the License.
package/README.md CHANGED
@@ -67,14 +67,14 @@ For anything **`< 0.60`** run the following link command
67
67
  - Add `import com.eko.RNBackgroundDownloaderPackage;` to the imports at the top of the file
68
68
  - Add `new RNBackgroundDownloaderPackage()` to the list returned by the `getPackages()` method
69
69
  2. Append the following lines to `android/settings.gradle`:
70
- ```
71
- include ':react-native-background-downloader'
72
- project(':react-native-background-downloader').projectDir = new File(rootProject.projectDir, '../node_modules/@kesha-antonov/react-native-background-downloader/android')
73
- ```
70
+ ```
71
+ include ':react-native-background-downloader'
72
+ project(':react-native-background-downloader').projectDir = new File(rootProject.projectDir, '../node_modules/@kesha-antonov/react-native-background-downloader/android')
73
+ ```
74
74
  3. Insert the following lines inside the dependencies block in `android/app/build.gradle`:
75
- ```
75
+ ```
76
76
  compile project(':react-native-background-downloader')
77
- ```
77
+ ```
78
78
  </details>
79
79
 
80
80
  ### iOS - Extra Mandatory Step
@@ -105,16 +105,16 @@ import { download, completeHandler } from '@kesha-antonov/react-native-backgroun
105
105
  const jobId = 'file123'
106
106
 
107
107
  let task = download({
108
- id: jobId,
109
- url: 'https://link-to-very.large/file.zip',
110
- destination: `${RNBackgroundDownloader.directories.documents}/file.zip`,
111
- metadata: {}
108
+ id: jobId,
109
+ url: 'https://link-to-very.large/file.zip',
110
+ destination: `${RNBackgroundDownloader.directories.documents}/file.zip`,
111
+ metadata: {}
112
112
  }).begin(({ expectedBytes, headers }) => {
113
- console.log(`Going to download ${expectedBytes} bytes!`)
113
+ console.log(`Going to download ${expectedBytes} bytes!`)
114
114
  }).progress(percent => {
115
- console.log(`Downloaded: ${percent * 100}%`)
115
+ console.log(`Downloaded: ${percent * 100}%`)
116
116
  }).done(() => {
117
- console.log('Download is done!')
117
+ console.log('Download is done!')
118
118
 
119
119
  // PROCESS YOUR STUFF
120
120
 
@@ -122,7 +122,7 @@ let task = download({
122
122
  if (Platform.OS === 'ios')
123
123
  completeHandler(jobId)
124
124
  }).error(error => {
125
- console.log('Download canceled due to error: ', error);
125
+ console.log('Download canceled due to error: ', error);
126
126
  })
127
127
 
128
128
  // Pause the task
@@ -148,14 +148,14 @@ import RNBackgroundDownloader from '@kesha-antonov/react-native-background-downl
148
148
 
149
149
  let lostTasks = await RNBackgroundDownloader.checkForExistingDownloads()
150
150
  for (let task of lostTasks) {
151
- console.log(`Task ${task.id} was found!`)
152
- task.progress(percent => {
153
- console.log(`Downloaded: ${percent * 100}%`)
154
- }).done(() => {
155
- console.log('Download is done!')
156
- }).error(error => {
157
- console.log('Download canceled due to error: ', error)
158
- })
151
+ console.log(`Task ${task.id} was found!`)
152
+ task.progress(percent => {
153
+ console.log(`Downloaded: ${percent * 100}%`)
154
+ }).done(() => {
155
+ console.log('Download is done!')
156
+ }).error(error => {
157
+ console.log('Download canceled due to error: ', error)
158
+ })
159
159
  }
160
160
  ```
161
161
 
@@ -167,7 +167,7 @@ If you need to send custom headers with your download request, you can do in it
167
167
  1) Globally using `RNBackgroundDownloader.setHeaders()`:
168
168
  ```javascript
169
169
  RNBackgroundDownloader.setHeaders({
170
- Authorization: 'Bearer 2we$@$@Ddd223'
170
+ Authorization: 'Bearer 2we$@$@Ddd223'
171
171
  })
172
172
  ```
173
173
  This way, all downloads with have the given headers.
@@ -175,20 +175,20 @@ This way, all downloads with have the given headers.
175
175
  2) Per download by passing a headers object in the options of `RNBackgroundDownloader.download()`:
176
176
  ```javascript
177
177
  let task = RNBackgroundDownloader.download({
178
- id: 'file123',
179
- url: 'https://link-to-very.large/file.zip'
180
- destination: `${RNBackgroundDownloader.directories.documents}/file.zip`,
181
- headers: {
182
- Authorization: 'Bearer 2we$@$@Ddd223'
183
- }
178
+ id: 'file123',
179
+ url: 'https://link-to-very.large/file.zip'
180
+ destination: `${RNBackgroundDownloader.directories.documents}/file.zip`,
181
+ headers: {
182
+ Authorization: 'Bearer 2we$@$@Ddd223'
183
+ }
184
184
  }).begin(({ expectedBytes, headers }) => {
185
- console.log(`Going to download ${expectedBytes} bytes!`)
185
+ console.log(`Going to download ${expectedBytes} bytes!`)
186
186
  }).progress(percent => {
187
- console.log(`Downloaded: ${percent * 100}%`)
187
+ console.log(`Downloaded: ${percent * 100}%`)
188
188
  }).done(() => {
189
- console.log('Download is done!')
189
+ console.log('Download is done!')
190
190
  }).error(error => {
191
- console.log('Download canceled due to error: ', error)
191
+ console.log('Download canceled due to error: ', error)
192
192
  })
193
193
  ```
194
194
  Headers given in the `download` function are **merged** with the ones given in `setHeaders`.
@@ -266,7 +266,7 @@ Either stop all tasks:
266
266
  ```javascript
267
267
  const tasks = await checkForExistingDownloads()
268
268
  for (const task of tasks)
269
- task.stop()
269
+ task.stop()
270
270
  ```
271
271
 
272
272
  Or re-attach them:
@@ -274,11 +274,11 @@ Or re-attach them:
274
274
  ```javascript
275
275
  const tasks = await checkForExistingDownloads()
276
276
  for (const task of tasks) {
277
- task.pause()
278
- //
279
- // YOUR LOGIC OF RE-ATTACHING DOWLOADS TO YOUR STUFF
280
- // ...
281
- //
277
+ task.pause()
278
+ //
279
+ // YOUR LOGIC OF RE-ATTACHING DOWLOADS TO YOUR STUFF
280
+ // ...
281
+ //
282
282
  }
283
283
  ```
284
284
 
@@ -289,10 +289,10 @@ for (const task of tasks) {
289
289
  ```javascript
290
290
 
291
291
  function handleAppStateChange (appState) {
292
- if (appState !== 'active')
293
- return
292
+ if (appState !== 'active')
293
+ return
294
294
 
295
- ensureDownloadsAreRunning()
295
+ ensureDownloadsAreRunning()
296
296
  }
297
297
 
298
298
  const appStateChangeListener = AppState.addEventListener('change', handleAppStateChange)
@@ -321,6 +321,31 @@ Resumes a pause download
321
321
  ### `stop()`
322
322
  Stops the download for good and removes the file that was written so far
323
323
 
324
+ ### `initDownloader(options)`
325
+
326
+ Init android downloader with options
327
+
328
+ **options**
329
+
330
+ An object containing options properties
331
+
332
+ | Property | Type | Required | Platforms | Info |
333
+ | ------------- | ------------------------------------------------ | :------: | :-------: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
334
+ | `type` | String | | Android | Downloader type: 'parallel' or 'sequential'. Default: 'sequential'. 'parallel' seems to cause lots of ANRs, so be careful |
335
+
336
+ **Usage**
337
+
338
+ ```javascript
339
+ import { initDownloader } from '@kesha-antonov/react-native-background-downloader'
340
+
341
+ ...
342
+ // SOMEWHERE AT APP STARTUP
343
+
344
+ useEffect(() => {
345
+ initDownloader({ type: 'parallel' })
346
+ }, [])
347
+ ```
348
+
324
349
  ## Constants
325
350
 
326
351
  ### directories
@@ -1,19 +1,21 @@
1
1
  apply plugin: 'com.android.library'
2
2
 
3
+ def useAndroidX = (project.hasProperty('android.useAndroidX')) ? project.property('android.useAndroidX') : false
4
+
3
5
  def safeExtGet(prop, fallback) {
4
6
  rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
5
7
  }
6
8
 
7
9
  android {
8
- compileSdkVersion safeExtGet("compileSdkVersion", 33)
10
+ compileSdkVersion safeExtGet('compileSdkVersion', 33)
9
11
 
10
12
  defaultConfig {
11
13
  minSdkVersion safeExtGet('minSdkVersion', 21)
12
14
  targetSdkVersion safeExtGet('targetSdkVersion', 33)
13
15
  versionCode 1
14
- versionName "1.0"
16
+ versionName '1.0'
15
17
  ndk {
16
- abiFilters "armeabi-v7a", "x86"
18
+ abiFilters 'armeabi-v7a', 'x86'
17
19
  }
18
20
  }
19
21
  }
@@ -21,11 +23,11 @@ android {
21
23
  dependencies {
22
24
  //noinspection GradleDynamicVersion
23
25
  implementation 'com.facebook.react:react-native:+'
24
- if (project.properties['android.useAndroidX'] == 'true' || project.properties['android.useAndroidX'] == true) {
25
- api "com.github.tonyofrancis.Fetch:xfetch2:3.1.6"
26
- implementation "com.github.tonyofrancis.Fetch:xfetch2okhttp:3.1.6"
26
+ if (useAndroidX) {
27
+ api 'com.github.tonyofrancis.Fetch:xfetch2:3.1.6'
28
+ implementation 'com.github.tonyofrancis.Fetch:xfetch2okhttp:3.1.6'
27
29
  } else {
28
- api "com.tonyodev.fetch2:fetch2:3.0.12"
29
- implementation "com.tonyodev.fetch2okhttp:fetch2okhttp:3.0.12"
30
+ api 'com.tonyodev.fetch2:fetch2:3.0.12'
31
+ implementation 'com.tonyodev.fetch2okhttp:fetch2okhttp:3.0.12'
30
32
  }
31
33
  }
@@ -3,4 +3,3 @@
3
3
  package="com.eko">
4
4
 
5
5
  </manifest>
6
-
@@ -8,6 +8,7 @@ import com.facebook.react.bridge.Promise;
8
8
  import com.facebook.react.bridge.ReactApplicationContext;
9
9
  import com.facebook.react.bridge.ReactContextBaseJavaModule;
10
10
  import com.facebook.react.bridge.ReactMethod;
11
+ import com.facebook.react.bridge.Arguments;
11
12
  import com.facebook.react.bridge.ReadableMap;
12
13
  import com.facebook.react.bridge.ReadableMapKeySetIterator;
13
14
  import com.facebook.react.bridge.WritableArray;
@@ -87,19 +88,8 @@ public class RNBackgroundDownloaderModule extends ReactContextBaseJavaModule imp
87
88
  public RNBackgroundDownloaderModule(ReactApplicationContext reactContext) {
88
89
  super(reactContext);
89
90
 
90
- OkHttpClient okHttpClient = new OkHttpClient.Builder().build();
91
- final Downloader okHttpDownloader = new OkHttpDownloader(okHttpClient,
92
- Downloader.FileDownloaderType.PARALLEL);
93
-
94
- loadConfigMap();
95
- FetchConfiguration fetchConfiguration = new FetchConfiguration.Builder(this.getReactApplicationContext())
96
- .setDownloadConcurrentLimit(4)
97
- .setHttpDownloader(okHttpDownloader)
98
- .enableRetryOnNetworkGain(true)
99
- .setHttpDownloader(new HttpUrlConnectionDownloader(Downloader.FileDownloaderType.PARALLEL))
100
- .build();
101
- fetch = Fetch.Impl.getInstance(fetchConfiguration);
102
- fetch.addListener(this);
91
+ ReadableMap emptyMap = Arguments.createMap();
92
+ this.initDownloader(emptyMap);
103
93
  }
104
94
 
105
95
  @Override
@@ -152,7 +142,33 @@ public class RNBackgroundDownloaderModule extends ReactContextBaseJavaModule imp
152
142
  constants.put("PriorityLow", Priority.LOW.getValue());
153
143
  constants.put("OnlyWifi", NetworkType.WIFI_ONLY.getValue());
154
144
  constants.put("AllNetworks", NetworkType.ALL.getValue());
155
- return constants;
145
+ return constants;
146
+ }
147
+
148
+ @ReactMethod
149
+ public void initDownloader(ReadableMap options) {
150
+ if (fetch != null) {
151
+ fetch.close();
152
+ fetch = null;
153
+ }
154
+
155
+ Downloader.FileDownloaderType downloaderType = options.getString("type") == "parallel"
156
+ ? Downloader.FileDownloaderType.PARALLEL
157
+ : Downloader.FileDownloaderType.SEQUENTIAL;
158
+
159
+ OkHttpClient okHttpClient = new OkHttpClient.Builder().build();
160
+ final Downloader okHttpDownloader = new OkHttpDownloader(okHttpClient,
161
+ downloaderType);
162
+
163
+ loadConfigMap();
164
+ FetchConfiguration fetchConfiguration = new FetchConfiguration.Builder(this.getReactApplicationContext())
165
+ .setDownloadConcurrentLimit(4)
166
+ .setHttpDownloader(okHttpDownloader)
167
+ .enableRetryOnNetworkGain(true)
168
+ .setHttpDownloader(new HttpUrlConnectionDownloader(downloaderType))
169
+ .build();
170
+ fetch = Fetch.Impl.getInstance(fetchConfiguration);
171
+ fetch.addListener(this);
156
172
  }
157
173
 
158
174
  private void removeFromMaps(int requestId) {
@@ -19,4 +19,4 @@ public class RNBackgroundDownloaderPackage implements ReactPackage {
19
19
  public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
20
20
  return Collections.emptyList();
21
21
  }
22
- }
22
+ }
package/index.d.ts CHANGED
@@ -76,6 +76,11 @@ export interface DownloadTask {
76
76
  export type CheckForExistingDownloads = () => Promise<DownloadTask[]>;
77
77
  export type EnsureDownloadsAreRunning = () => Promise<void>;
78
78
 
79
+ export interface InitDownloaderOptions {
80
+ type?: 'parallel' | 'sequential' | null;
81
+ }
82
+ export type InitDownloader = (options: InitDownloaderOptions) => undefined;
83
+
79
84
  export interface DownloadOption {
80
85
  id: string;
81
86
  url: string;
@@ -104,6 +109,7 @@ export interface Priority {
104
109
  export const setHeaders: SetHeaders;
105
110
  export const checkForExistingDownloads: CheckForExistingDownloads;
106
111
  export const ensureDownloadsAreRunning: EnsureDownloadsAreRunning;
112
+ export const initDownloader: InitDownloader;
107
113
  export const download: Download;
108
114
  export const completeHandler: CompleteHandler;
109
115
  export const directories: Directories;
@@ -112,6 +118,7 @@ export const Priority: Priority;
112
118
 
113
119
  export interface RNBackgroundDownloader {
114
120
  setHeaders: SetHeaders;
121
+ initDownloader: InitDownloader;
115
122
  checkForExistingDownloads: CheckForExistingDownloads;
116
123
  ensureDownloadsAreRunning: EnsureDownloadsAreRunning;
117
124
  download: Download;
package/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { NativeModules, NativeEventEmitter } from 'react-native'
1
+ import { NativeModules, NativeEventEmitter, Platform } from 'react-native'
2
2
  import DownloadTask from './lib/DownloadTask'
3
3
 
4
4
  const { RNBackgroundDownloader } = NativeModules
@@ -40,6 +40,11 @@ export function setHeaders (h = {}) {
40
40
  headers = h
41
41
  }
42
42
 
43
+ export function initDownloader (options = {}) {
44
+ if (Platform.OS === 'android')
45
+ RNBackgroundDownloader.initDownloader(options)
46
+ }
47
+
43
48
  export function checkForExistingDownloads () {
44
49
  return RNBackgroundDownloader.checkForExistingDownloads()
45
50
  .then(foundTasks => {
@@ -129,6 +134,7 @@ export const Priority = {
129
134
  }
130
135
 
131
136
  export default {
137
+ initDownloader,
132
138
  download,
133
139
  checkForExistingDownloads,
134
140
  ensureDownloadsAreRunning,
@@ -308,12 +308,12 @@ RCT_EXPORT_METHOD(completeHandler:(nonnull NSString *)jobId
308
308
  rejecter:(RCTPromiseRejectBlock)reject)
309
309
  {
310
310
  NSLog(@"[RNBackgroundDownloader] - [completeHandlerIOS]");
311
- if (storedCompletionHandler) {
312
- [[NSOperationQueue mainQueue] addOperationWithBlock:^{
311
+ [[NSOperationQueue mainQueue] addOperationWithBlock:^{
312
+ if (storedCompletionHandler) {
313
313
  storedCompletionHandler();
314
314
  storedCompletionHandler = nil;
315
- }];
316
- }
315
+ }
316
+ }];
317
317
  resolve(nil);
318
318
  }
319
319
 
@@ -1,254 +1,254 @@
1
1
  // !$*UTF8*$!
2
2
  {
3
- archiveVersion = 1;
4
- classes = {
5
- };
6
- objectVersion = 46;
7
- objects = {
3
+ archiveVersion = 1;
4
+ classes = {
5
+ };
6
+ objectVersion = 46;
7
+ objects = {
8
8
 
9
9
  /* Begin PBXBuildFile section */
10
- B3E7B58A1CC2AC0600A0062D /* RNBackgroundDownloader.m in Sources */ = {isa = PBXBuildFile; fileRef = B3E7B5891CC2AC0600A0062D /* RNBackgroundDownloader.m */; };
10
+ B3E7B58A1CC2AC0600A0062D /* RNBackgroundDownloader.m in Sources */ = {isa = PBXBuildFile; fileRef = B3E7B5891CC2AC0600A0062D /* RNBackgroundDownloader.m */; };
11
11
  /* End PBXBuildFile section */
12
12
 
13
13
  /* Begin PBXCopyFilesBuildPhase section */
14
- 58B511D91A9E6C8500147676 /* CopyFiles */ = {
15
- isa = PBXCopyFilesBuildPhase;
16
- buildActionMask = 2147483647;
17
- dstPath = "include/$(PRODUCT_NAME)";
18
- dstSubfolderSpec = 16;
19
- files = (
20
- );
21
- runOnlyForDeploymentPostprocessing = 0;
22
- };
14
+ 58B511D91A9E6C8500147676 /* CopyFiles */ = {
15
+ isa = PBXCopyFilesBuildPhase;
16
+ buildActionMask = 2147483647;
17
+ dstPath = "include/$(PRODUCT_NAME)";
18
+ dstSubfolderSpec = 16;
19
+ files = (
20
+ );
21
+ runOnlyForDeploymentPostprocessing = 0;
22
+ };
23
23
  /* End PBXCopyFilesBuildPhase section */
24
24
 
25
25
  /* Begin PBXFileReference section */
26
- 134814201AA4EA6300B7C361 /* libRNBackgroundDownloader.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRNBackgroundDownloader.a; sourceTree = BUILT_PRODUCTS_DIR; };
27
- 565BF70F208F2C7C00F66231 /* RNBGDTaskConfig.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNBGDTaskConfig.h; sourceTree = "<group>"; };
28
- B3E7B5881CC2AC0600A0062D /* RNBackgroundDownloader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNBackgroundDownloader.h; sourceTree = "<group>"; };
29
- B3E7B5891CC2AC0600A0062D /* RNBackgroundDownloader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNBackgroundDownloader.m; sourceTree = "<group>"; };
26
+ 134814201AA4EA6300B7C361 /* libRNBackgroundDownloader.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRNBackgroundDownloader.a; sourceTree = BUILT_PRODUCTS_DIR; };
27
+ 565BF70F208F2C7C00F66231 /* RNBGDTaskConfig.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNBGDTaskConfig.h; sourceTree = "<group>"; };
28
+ B3E7B5881CC2AC0600A0062D /* RNBackgroundDownloader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNBackgroundDownloader.h; sourceTree = "<group>"; };
29
+ B3E7B5891CC2AC0600A0062D /* RNBackgroundDownloader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNBackgroundDownloader.m; sourceTree = "<group>"; };
30
30
  /* End PBXFileReference section */
31
31
 
32
32
  /* Begin PBXFrameworksBuildPhase section */
33
- 58B511D81A9E6C8500147676 /* Frameworks */ = {
34
- isa = PBXFrameworksBuildPhase;
35
- buildActionMask = 2147483647;
36
- files = (
37
- );
38
- runOnlyForDeploymentPostprocessing = 0;
39
- };
33
+ 58B511D81A9E6C8500147676 /* Frameworks */ = {
34
+ isa = PBXFrameworksBuildPhase;
35
+ buildActionMask = 2147483647;
36
+ files = (
37
+ );
38
+ runOnlyForDeploymentPostprocessing = 0;
39
+ };
40
40
  /* End PBXFrameworksBuildPhase section */
41
41
 
42
42
  /* Begin PBXGroup section */
43
- 134814211AA4EA7D00B7C361 /* Products */ = {
44
- isa = PBXGroup;
45
- children = (
46
- 134814201AA4EA6300B7C361 /* libRNBackgroundDownloader.a */,
47
- );
48
- name = Products;
49
- sourceTree = "<group>";
50
- };
51
- 58B511D21A9E6C8500147676 = {
52
- isa = PBXGroup;
53
- children = (
54
- 565BF70F208F2C7C00F66231 /* RNBGDTaskConfig.h */,
55
- B3E7B5881CC2AC0600A0062D /* RNBackgroundDownloader.h */,
56
- B3E7B5891CC2AC0600A0062D /* RNBackgroundDownloader.m */,
57
- 134814211AA4EA7D00B7C361 /* Products */,
58
- );
59
- sourceTree = "<group>";
60
- };
43
+ 134814211AA4EA7D00B7C361 /* Products */ = {
44
+ isa = PBXGroup;
45
+ children = (
46
+ 134814201AA4EA6300B7C361 /* libRNBackgroundDownloader.a */,
47
+ );
48
+ name = Products;
49
+ sourceTree = "<group>";
50
+ };
51
+ 58B511D21A9E6C8500147676 = {
52
+ isa = PBXGroup;
53
+ children = (
54
+ 565BF70F208F2C7C00F66231 /* RNBGDTaskConfig.h */,
55
+ B3E7B5881CC2AC0600A0062D /* RNBackgroundDownloader.h */,
56
+ B3E7B5891CC2AC0600A0062D /* RNBackgroundDownloader.m */,
57
+ 134814211AA4EA7D00B7C361 /* Products */,
58
+ );
59
+ sourceTree = "<group>";
60
+ };
61
61
  /* End PBXGroup section */
62
62
 
63
63
  /* Begin PBXNativeTarget section */
64
- 58B511DA1A9E6C8500147676 /* RNBackgroundDownloader */ = {
65
- isa = PBXNativeTarget;
66
- buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RNBackgroundDownloader" */;
67
- buildPhases = (
68
- 58B511D71A9E6C8500147676 /* Sources */,
69
- 58B511D81A9E6C8500147676 /* Frameworks */,
70
- 58B511D91A9E6C8500147676 /* CopyFiles */,
71
- );
72
- buildRules = (
73
- );
74
- dependencies = (
75
- );
76
- name = RNBackgroundDownloader;
77
- productName = RCTDataManager;
78
- productReference = 134814201AA4EA6300B7C361 /* libRNBackgroundDownloader.a */;
79
- productType = "com.apple.product-type.library.static";
80
- };
64
+ 58B511DA1A9E6C8500147676 /* RNBackgroundDownloader */ = {
65
+ isa = PBXNativeTarget;
66
+ buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RNBackgroundDownloader" */;
67
+ buildPhases = (
68
+ 58B511D71A9E6C8500147676 /* Sources */,
69
+ 58B511D81A9E6C8500147676 /* Frameworks */,
70
+ 58B511D91A9E6C8500147676 /* CopyFiles */,
71
+ );
72
+ buildRules = (
73
+ );
74
+ dependencies = (
75
+ );
76
+ name = RNBackgroundDownloader;
77
+ productName = RCTDataManager;
78
+ productReference = 134814201AA4EA6300B7C361 /* libRNBackgroundDownloader.a */;
79
+ productType = "com.apple.product-type.library.static";
80
+ };
81
81
  /* End PBXNativeTarget section */
82
82
 
83
83
  /* Begin PBXProject section */
84
- 58B511D31A9E6C8500147676 /* Project object */ = {
85
- isa = PBXProject;
86
- attributes = {
87
- LastUpgradeCheck = 0610;
88
- ORGANIZATIONNAME = Facebook;
89
- TargetAttributes = {
90
- 58B511DA1A9E6C8500147676 = {
91
- CreatedOnToolsVersion = 6.1.1;
92
- };
93
- };
94
- };
95
- buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RNBackgroundDownloader" */;
96
- compatibilityVersion = "Xcode 3.2";
97
- developmentRegion = English;
98
- hasScannedForEncodings = 0;
99
- knownRegions = (
100
- en,
101
- );
102
- mainGroup = 58B511D21A9E6C8500147676;
103
- productRefGroup = 58B511D21A9E6C8500147676;
104
- projectDirPath = "";
105
- projectRoot = "";
106
- targets = (
107
- 58B511DA1A9E6C8500147676 /* RNBackgroundDownloader */,
108
- );
109
- };
84
+ 58B511D31A9E6C8500147676 /* Project object */ = {
85
+ isa = PBXProject;
86
+ attributes = {
87
+ LastUpgradeCheck = 0610;
88
+ ORGANIZATIONNAME = Facebook;
89
+ TargetAttributes = {
90
+ 58B511DA1A9E6C8500147676 = {
91
+ CreatedOnToolsVersion = 6.1.1;
92
+ };
93
+ };
94
+ };
95
+ buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RNBackgroundDownloader" */;
96
+ compatibilityVersion = "Xcode 3.2";
97
+ developmentRegion = English;
98
+ hasScannedForEncodings = 0;
99
+ knownRegions = (
100
+ en,
101
+ );
102
+ mainGroup = 58B511D21A9E6C8500147676;
103
+ productRefGroup = 58B511D21A9E6C8500147676;
104
+ projectDirPath = "";
105
+ projectRoot = "";
106
+ targets = (
107
+ 58B511DA1A9E6C8500147676 /* RNBackgroundDownloader */,
108
+ );
109
+ };
110
110
  /* End PBXProject section */
111
111
 
112
112
  /* Begin PBXSourcesBuildPhase section */
113
- 58B511D71A9E6C8500147676 /* Sources */ = {
114
- isa = PBXSourcesBuildPhase;
115
- buildActionMask = 2147483647;
116
- files = (
117
- B3E7B58A1CC2AC0600A0062D /* RNBackgroundDownloader.m in Sources */,
118
- );
119
- runOnlyForDeploymentPostprocessing = 0;
120
- };
113
+ 58B511D71A9E6C8500147676 /* Sources */ = {
114
+ isa = PBXSourcesBuildPhase;
115
+ buildActionMask = 2147483647;
116
+ files = (
117
+ B3E7B58A1CC2AC0600A0062D /* RNBackgroundDownloader.m in Sources */,
118
+ );
119
+ runOnlyForDeploymentPostprocessing = 0;
120
+ };
121
121
  /* End PBXSourcesBuildPhase section */
122
122
 
123
123
  /* Begin XCBuildConfiguration section */
124
- 58B511ED1A9E6C8500147676 /* Debug */ = {
125
- isa = XCBuildConfiguration;
126
- buildSettings = {
127
- ALWAYS_SEARCH_USER_PATHS = NO;
128
- CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
129
- CLANG_CXX_LIBRARY = "libc++";
130
- CLANG_ENABLE_MODULES = YES;
131
- CLANG_ENABLE_OBJC_ARC = YES;
132
- CLANG_WARN_BOOL_CONVERSION = YES;
133
- CLANG_WARN_CONSTANT_CONVERSION = YES;
134
- CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
135
- CLANG_WARN_EMPTY_BODY = YES;
136
- CLANG_WARN_ENUM_CONVERSION = YES;
137
- CLANG_WARN_INT_CONVERSION = YES;
138
- CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
139
- CLANG_WARN_UNREACHABLE_CODE = YES;
140
- CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
141
- COPY_PHASE_STRIP = NO;
142
- ENABLE_STRICT_OBJC_MSGSEND = YES;
143
- GCC_C_LANGUAGE_STANDARD = gnu99;
144
- GCC_DYNAMIC_NO_PIC = NO;
145
- GCC_OPTIMIZATION_LEVEL = 0;
146
- GCC_PREPROCESSOR_DEFINITIONS = (
147
- "DEBUG=1",
148
- "$(inherited)",
149
- );
150
- GCC_SYMBOLS_PRIVATE_EXTERN = NO;
151
- GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
152
- GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
153
- GCC_WARN_UNDECLARED_SELECTOR = YES;
154
- GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
155
- GCC_WARN_UNUSED_FUNCTION = YES;
156
- GCC_WARN_UNUSED_VARIABLE = YES;
157
- IPHONEOS_DEPLOYMENT_TARGET = 7.0;
158
- MTL_ENABLE_DEBUG_INFO = YES;
159
- ONLY_ACTIVE_ARCH = YES;
160
- SDKROOT = iphoneos;
161
- };
162
- name = Debug;
163
- };
164
- 58B511EE1A9E6C8500147676 /* Release */ = {
165
- isa = XCBuildConfiguration;
166
- buildSettings = {
167
- ALWAYS_SEARCH_USER_PATHS = NO;
168
- CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
169
- CLANG_CXX_LIBRARY = "libc++";
170
- CLANG_ENABLE_MODULES = YES;
171
- CLANG_ENABLE_OBJC_ARC = YES;
172
- CLANG_WARN_BOOL_CONVERSION = YES;
173
- CLANG_WARN_CONSTANT_CONVERSION = YES;
174
- CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
175
- CLANG_WARN_EMPTY_BODY = YES;
176
- CLANG_WARN_ENUM_CONVERSION = YES;
177
- CLANG_WARN_INT_CONVERSION = YES;
178
- CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
179
- CLANG_WARN_UNREACHABLE_CODE = YES;
180
- CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
181
- COPY_PHASE_STRIP = YES;
182
- ENABLE_NS_ASSERTIONS = NO;
183
- ENABLE_STRICT_OBJC_MSGSEND = YES;
184
- GCC_C_LANGUAGE_STANDARD = gnu99;
185
- GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
186
- GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
187
- GCC_WARN_UNDECLARED_SELECTOR = YES;
188
- GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
189
- GCC_WARN_UNUSED_FUNCTION = YES;
190
- GCC_WARN_UNUSED_VARIABLE = YES;
191
- IPHONEOS_DEPLOYMENT_TARGET = 7.0;
192
- MTL_ENABLE_DEBUG_INFO = NO;
193
- SDKROOT = iphoneos;
194
- VALIDATE_PRODUCT = YES;
195
- };
196
- name = Release;
197
- };
198
- 58B511F01A9E6C8500147676 /* Debug */ = {
199
- isa = XCBuildConfiguration;
200
- buildSettings = {
201
- HEADER_SEARCH_PATHS = (
202
- "$(inherited)",
203
- /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
204
- "$(SRCROOT)/../../../React/**",
205
- "$(SRCROOT)/../../react-native/React/**",
206
- );
207
- LIBRARY_SEARCH_PATHS = "$(inherited)";
208
- OTHER_LDFLAGS = "-ObjC";
209
- PRODUCT_NAME = RNBackgroundDownloader;
210
- SKIP_INSTALL = YES;
211
- };
212
- name = Debug;
213
- };
214
- 58B511F11A9E6C8500147676 /* Release */ = {
215
- isa = XCBuildConfiguration;
216
- buildSettings = {
217
- HEADER_SEARCH_PATHS = (
218
- "$(inherited)",
219
- /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
220
- "$(SRCROOT)/../../../React/**",
221
- "$(SRCROOT)/../../react-native/React/**",
222
- );
223
- LIBRARY_SEARCH_PATHS = "$(inherited)";
224
- OTHER_LDFLAGS = "-ObjC";
225
- PRODUCT_NAME = RNBackgroundDownloader;
226
- SKIP_INSTALL = YES;
227
- };
228
- name = Release;
229
- };
124
+ 58B511ED1A9E6C8500147676 /* Debug */ = {
125
+ isa = XCBuildConfiguration;
126
+ buildSettings = {
127
+ ALWAYS_SEARCH_USER_PATHS = NO;
128
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
129
+ CLANG_CXX_LIBRARY = "libc++";
130
+ CLANG_ENABLE_MODULES = YES;
131
+ CLANG_ENABLE_OBJC_ARC = YES;
132
+ CLANG_WARN_BOOL_CONVERSION = YES;
133
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
134
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
135
+ CLANG_WARN_EMPTY_BODY = YES;
136
+ CLANG_WARN_ENUM_CONVERSION = YES;
137
+ CLANG_WARN_INT_CONVERSION = YES;
138
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
139
+ CLANG_WARN_UNREACHABLE_CODE = YES;
140
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
141
+ COPY_PHASE_STRIP = NO;
142
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
143
+ GCC_C_LANGUAGE_STANDARD = gnu99;
144
+ GCC_DYNAMIC_NO_PIC = NO;
145
+ GCC_OPTIMIZATION_LEVEL = 0;
146
+ GCC_PREPROCESSOR_DEFINITIONS = (
147
+ "DEBUG=1",
148
+ "$(inherited)",
149
+ );
150
+ GCC_SYMBOLS_PRIVATE_EXTERN = NO;
151
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
152
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
153
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
154
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
155
+ GCC_WARN_UNUSED_FUNCTION = YES;
156
+ GCC_WARN_UNUSED_VARIABLE = YES;
157
+ IPHONEOS_DEPLOYMENT_TARGET = 7.0;
158
+ MTL_ENABLE_DEBUG_INFO = YES;
159
+ ONLY_ACTIVE_ARCH = YES;
160
+ SDKROOT = iphoneos;
161
+ };
162
+ name = Debug;
163
+ };
164
+ 58B511EE1A9E6C8500147676 /* Release */ = {
165
+ isa = XCBuildConfiguration;
166
+ buildSettings = {
167
+ ALWAYS_SEARCH_USER_PATHS = NO;
168
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
169
+ CLANG_CXX_LIBRARY = "libc++";
170
+ CLANG_ENABLE_MODULES = YES;
171
+ CLANG_ENABLE_OBJC_ARC = YES;
172
+ CLANG_WARN_BOOL_CONVERSION = YES;
173
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
174
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
175
+ CLANG_WARN_EMPTY_BODY = YES;
176
+ CLANG_WARN_ENUM_CONVERSION = YES;
177
+ CLANG_WARN_INT_CONVERSION = YES;
178
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
179
+ CLANG_WARN_UNREACHABLE_CODE = YES;
180
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
181
+ COPY_PHASE_STRIP = YES;
182
+ ENABLE_NS_ASSERTIONS = NO;
183
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
184
+ GCC_C_LANGUAGE_STANDARD = gnu99;
185
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
186
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
187
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
188
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
189
+ GCC_WARN_UNUSED_FUNCTION = YES;
190
+ GCC_WARN_UNUSED_VARIABLE = YES;
191
+ IPHONEOS_DEPLOYMENT_TARGET = 7.0;
192
+ MTL_ENABLE_DEBUG_INFO = NO;
193
+ SDKROOT = iphoneos;
194
+ VALIDATE_PRODUCT = YES;
195
+ };
196
+ name = Release;
197
+ };
198
+ 58B511F01A9E6C8500147676 /* Debug */ = {
199
+ isa = XCBuildConfiguration;
200
+ buildSettings = {
201
+ HEADER_SEARCH_PATHS = (
202
+ "$(inherited)",
203
+ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
204
+ "$(SRCROOT)/../../../React/**",
205
+ "$(SRCROOT)/../../react-native/React/**",
206
+ );
207
+ LIBRARY_SEARCH_PATHS = "$(inherited)";
208
+ OTHER_LDFLAGS = "-ObjC";
209
+ PRODUCT_NAME = RNBackgroundDownloader;
210
+ SKIP_INSTALL = YES;
211
+ };
212
+ name = Debug;
213
+ };
214
+ 58B511F11A9E6C8500147676 /* Release */ = {
215
+ isa = XCBuildConfiguration;
216
+ buildSettings = {
217
+ HEADER_SEARCH_PATHS = (
218
+ "$(inherited)",
219
+ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
220
+ "$(SRCROOT)/../../../React/**",
221
+ "$(SRCROOT)/../../react-native/React/**",
222
+ );
223
+ LIBRARY_SEARCH_PATHS = "$(inherited)";
224
+ OTHER_LDFLAGS = "-ObjC";
225
+ PRODUCT_NAME = RNBackgroundDownloader;
226
+ SKIP_INSTALL = YES;
227
+ };
228
+ name = Release;
229
+ };
230
230
  /* End XCBuildConfiguration section */
231
231
 
232
232
  /* Begin XCConfigurationList section */
233
- 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RNBackgroundDownloader" */ = {
234
- isa = XCConfigurationList;
235
- buildConfigurations = (
236
- 58B511ED1A9E6C8500147676 /* Debug */,
237
- 58B511EE1A9E6C8500147676 /* Release */,
238
- );
239
- defaultConfigurationIsVisible = 0;
240
- defaultConfigurationName = Release;
241
- };
242
- 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RNBackgroundDownloader" */ = {
243
- isa = XCConfigurationList;
244
- buildConfigurations = (
245
- 58B511F01A9E6C8500147676 /* Debug */,
246
- 58B511F11A9E6C8500147676 /* Release */,
247
- );
248
- defaultConfigurationIsVisible = 0;
249
- defaultConfigurationName = Release;
250
- };
233
+ 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RNBackgroundDownloader" */ = {
234
+ isa = XCConfigurationList;
235
+ buildConfigurations = (
236
+ 58B511ED1A9E6C8500147676 /* Debug */,
237
+ 58B511EE1A9E6C8500147676 /* Release */,
238
+ );
239
+ defaultConfigurationIsVisible = 0;
240
+ defaultConfigurationName = Release;
241
+ };
242
+ 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RNBackgroundDownloader" */ = {
243
+ isa = XCConfigurationList;
244
+ buildConfigurations = (
245
+ 58B511F01A9E6C8500147676 /* Debug */,
246
+ 58B511F11A9E6C8500147676 /* Release */,
247
+ );
248
+ defaultConfigurationIsVisible = 0;
249
+ defaultConfigurationName = Release;
250
+ };
251
251
  /* End XCConfigurationList section */
252
- };
253
- rootObject = 58B511D31A9E6C8500147676 /* Project object */;
252
+ };
253
+ rootObject = 58B511D31A9E6C8500147676 /* Project object */;
254
254
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kesha-antonov/react-native-background-downloader",
3
- "version": "2.7.2",
3
+ "version": "2.8.2",
4
4
  "description": "A library for React-Native to help you download large files on iOS and Android both in the foreground and most importantly in the background.",
5
5
  "keywords": [
6
6
  "react-native",
@@ -56,28 +56,28 @@
56
56
  ]
57
57
  },
58
58
  "devDependencies": {
59
- "@babel/core": "^7.20.12",
60
- "@babel/eslint-parser": "^7.19.1",
61
- "@babel/preset-env": "^7.20.2",
62
- "@babel/runtime": "^7.20.13",
59
+ "@babel/core": "^7.22.9",
60
+ "@babel/eslint-parser": "^7.22.9",
61
+ "@babel/preset-env": "^7.22.9",
62
+ "@babel/runtime": "^7.22.6",
63
63
  "@react-native-community/eslint-config": "^3.2.0",
64
- "babel-jest": "^29.4.1",
65
- "eslint": "8.33.0",
66
- "eslint-config-standard": "^17.0.0",
64
+ "babel-jest": "^29.6.1",
65
+ "eslint": "8.44.0",
66
+ "eslint-config-standard": "^17.1.0",
67
67
  "eslint-config-standard-jsx": "^11.0.0",
68
68
  "eslint-plugin-import": "^2.27.5",
69
- "eslint-plugin-n": "^15.6.1",
69
+ "eslint-plugin-n": "^16.0.1",
70
70
  "eslint-plugin-node": "^11.1.0",
71
71
  "eslint-plugin-promise": "^6.1.1",
72
72
  "eslint-plugin-react": "^7.32.2",
73
73
  "eslint-plugin-react-hooks": "^4.6.0",
74
74
  "eslint-plugin-standard": "^5.0.0",
75
- "immer": "^9.0.19",
76
- "jest": "^29.4.1",
75
+ "immer": "^10.0.2",
76
+ "jest": "^29.6.1",
77
77
  "lint-staged": ">=13",
78
- "metro-react-native-babel-preset": "^0.74.1",
78
+ "metro-react-native-babel-preset": "^0.77.0",
79
79
  "react": "18.2.0",
80
- "react-native": "0.71.1",
80
+ "react-native": "0.72.3",
81
81
  "react-native-fs": "^2.20.0",
82
82
  "react-native-vector-icons": "^9.2.0",
83
83
  "react-test-renderer": "18.2.0"