@kesha-antonov/react-native-background-downloader 3.2.2 → 3.2.3

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/README.md CHANGED
@@ -214,6 +214,7 @@ An object containing options properties
214
214
  | `isAllowedOverRoaming` | Boolean | | Android | whether this download may proceed over a roaming connection. By default, roaming is allowed |
215
215
  | `isAllowedOverMetered` | Boolean | | Android | Whether this download may proceed over a metered network connection. By default, metered networks are allowed |
216
216
  | `isNotificationVisible` | Boolean | | Android | Whether to show a download notification or not |
217
+ | `notificationTitle` | String | | Android | Title of the download notification |
217
218
 
218
219
  **returns**
219
220
 
@@ -7,13 +7,15 @@ public class RNBGDTaskConfig implements Serializable {
7
7
  public String url;
8
8
  public String destination;
9
9
  public String metadata = "{}";
10
+ public String notificationTitle;
10
11
  public boolean reportedBegin;
11
12
 
12
- public RNBGDTaskConfig(String id, String url, String destination, String metadata) {
13
+ public RNBGDTaskConfig(String id, String url, String destination, String metadata, String notificationTitle) {
13
14
  this.id = id;
14
15
  this.url = url;
15
16
  this.destination = destination;
16
17
  this.metadata = metadata;
18
+ this.notificationTitle = notificationTitle;
17
19
  this.reportedBegin = false;
18
20
  }
19
21
  }
@@ -258,6 +258,7 @@ public class RNBackgroundDownloaderModule extends ReactContextBaseJavaModule {
258
258
  String destination = options.getString("destination");
259
259
  ReadableMap headers = options.getMap("headers");
260
260
  String metadata = options.getString("metadata");
261
+ String notificationTitle = options.getString("notificationTitle");
261
262
  int progressIntervalScope = options.getInt("progressInterval");
262
263
  if (progressIntervalScope > 0) {
263
264
  progressInterval = progressIntervalScope;
@@ -281,6 +282,10 @@ public class RNBackgroundDownloaderModule extends ReactContextBaseJavaModule {
281
282
  request.setRequiresCharging(false);
282
283
  }
283
284
 
285
+ if (notificationTitle != null) {
286
+ request.setTitle(notificationTitle);
287
+ }
288
+
284
289
  if (headers != null) {
285
290
  ReadableMapKeySetIterator iterator = headers.keySetIterator();
286
291
  while (iterator.hasNextKey()) {
@@ -295,7 +300,7 @@ public class RNBackgroundDownloaderModule extends ReactContextBaseJavaModule {
295
300
  request.setDestinationInExternalFilesDir(this.getReactApplicationContext(), null, filename);
296
301
 
297
302
  long downloadId = downloader.download(request);
298
- RNBGDTaskConfig config = new RNBGDTaskConfig(id, url, destination, metadata);
303
+ RNBGDTaskConfig config = new RNBGDTaskConfig(id, url, destination, metadata, notificationTitle);
299
304
 
300
305
  synchronized (sharedLock) {
301
306
  configIdToDownloadId.put(id, downloadId);
package/index.d.ts CHANGED
@@ -112,6 +112,7 @@ export interface DownloadOption {
112
112
  isAllowedOverRoaming?: boolean;
113
113
  isAllowedOverMetered?: boolean;
114
114
  isNotificationVisible?: boolean;
115
+ notificationTitle?: string;
115
116
  }
116
117
 
117
118
  export type Download = (options: DownloadOption) => DownloadTask;
package/index.ts CHANGED
@@ -122,6 +122,7 @@ type DownloadOptions = {
122
122
  isAllowedOverRoaming?: boolean,
123
123
  isAllowedOverMetered?: boolean,
124
124
  isNotificationVisible?: boolean;
125
+ notificationTitle?: string,
125
126
  }
126
127
 
127
128
  export function download (options: DownloadOptions) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kesha-antonov/react-native-background-downloader",
3
- "version": "3.2.2",
3
+ "version": "3.2.3",
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",