@kesha-antonov/react-native-background-downloader 3.2.1 → 3.2.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/android/build.gradle
CHANGED
|
@@ -189,10 +189,18 @@ public class RNBackgroundDownloaderModule extends ReactContextBaseJavaModule {
|
|
|
189
189
|
}
|
|
190
190
|
};
|
|
191
191
|
|
|
192
|
-
|
|
193
|
-
|
|
192
|
+
compatRegisterReceiver(context, downloadReceiver, filter, true);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
// TAKEN FROM
|
|
196
|
+
// https://github.com/facebook/react-native/pull/38256/files#diff-d5e21477eeadeb0c536d5870f487a8528f9a16ae928c397fec7b255805cc8ad3
|
|
197
|
+
private void compatRegisterReceiver(Context context, BroadcastReceiver receiver, IntentFilter filter,
|
|
198
|
+
boolean exported) {
|
|
199
|
+
if (Build.VERSION.SDK_INT >= 34 && context.getApplicationInfo().targetSdkVersion >= 34) {
|
|
200
|
+
context.registerReceiver(
|
|
201
|
+
receiver, filter, exported ? Context.RECEIVER_EXPORTED : Context.RECEIVER_NOT_EXPORTED);
|
|
194
202
|
} else {
|
|
195
|
-
context.registerReceiver(
|
|
203
|
+
context.registerReceiver(receiver, filter);
|
|
196
204
|
}
|
|
197
205
|
}
|
|
198
206
|
|
|
@@ -485,11 +493,18 @@ public class RNBackgroundDownloaderModule extends ReactContextBaseJavaModule {
|
|
|
485
493
|
|
|
486
494
|
private void loadDownloadIdToConfigMap() {
|
|
487
495
|
synchronized (sharedLock) {
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
496
|
+
try {
|
|
497
|
+
String str = mmkv.decodeString(getName() + "_downloadIdToConfig");
|
|
498
|
+
if (str != null) {
|
|
499
|
+
Gson gson = new Gson();
|
|
500
|
+
|
|
501
|
+
TypeToken<Map<Long, RNBGDTaskConfig>> mapType = new TypeToken<Map<Long, RNBGDTaskConfig>>() {
|
|
502
|
+
};
|
|
503
|
+
|
|
504
|
+
downloadIdToConfig = (Map<Long, RNBGDTaskConfig>) gson.fromJson(str, mapType);
|
|
505
|
+
}
|
|
506
|
+
} catch (Exception e) {
|
|
507
|
+
Log.e(getName(), "loadDownloadIdToConfigMap: " + Log.getStackTraceString(e));
|
|
493
508
|
}
|
|
494
509
|
}
|
|
495
510
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kesha-antonov/react-native-background-downloader",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.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",
|