react-native-blob-util 0.21.2 → 0.21.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
@@ -28,7 +28,7 @@ react-native-blob-util version **0.10.16** and up is only compatible with react
28
28
 
29
29
  ## React Native New Architecture
30
30
  With React Native 0.68.0 the switch to enable the new aritechture was introduced.
31
- Starting with version 0.17.0 this library introduces support for the new architecture as well. Of course the old architecture will still be supproted.
31
+ Starting with version 0.17.0 this library introduces support for the new architecture as well. Of course the old architecture will still be supported.
32
32
  Further information about it and how to use it you can find here: https://reactnative.dev/docs/next/the-new-architecture/landing-page
33
33
 
34
34
  ## Android 10 & 11
@@ -631,13 +631,22 @@ This is a new feature added in `0.9.0` if you're going to open a file path using
631
631
 
632
632
  Download and install an APK programmatically
633
633
 
634
+ Note:
635
+ be sure to specify the path, do not use the default path, because the permission problem causes the installation to fail, parsing the package fails
636
+
637
+ default path: `/data/data/com.android.providers.downloads/cache/xxx.apk` // Will cause parsing of the package to fail,Unable to install APK
638
+
634
639
  ```js
635
640
 
636
641
  const android = ReactNativeBlobUtil.android
642
+ const dirs = ReactNativeBlobUtil.fs.dirs;
643
+ const apkUrl = "http://www.example.com/awesome.apk";
644
+ const fileName = url.substring(url.lastIndexOf('/') + 1);
637
645
 
638
646
  ReactNativeBlobUtil.config({
639
647
  addAndroidDownloads: {
640
648
  useDownloadManager: true,
649
+ path: `${dirs.DownloadDir}/${fileName}`, // <-- Must specify
641
650
  title: 'awesome.apk',
642
651
  description: 'An APK that will be installed',
643
652
  mime: 'application/vnd.android.package-archive',
@@ -72,10 +72,19 @@ public class ReactNativeBlobUtilFileResp extends ResponseBody {
72
72
 
73
73
  @Override
74
74
  public long contentLength() {
75
- if (originalBody.contentLength() > Integer.MAX_VALUE) {
75
+
76
+ /**
77
+ *
78
+ * Okio buffer issue in current version seems to be fixed in the latest versions
79
+ *
80
+ * limiting this was causing the download progress to stop at 2GB size but files still was downloading
81
+ *
82
+ */
83
+
84
+ // if (originalBody.contentLength() > Integer.MAX_VALUE) {
76
85
  // This is a workaround for a bug Okio buffer where it can't handle larger than int.
77
- return Integer.MAX_VALUE;
78
- }
86
+ // return Integer.MAX_VALUE;
87
+ // }
79
88
  return originalBody.contentLength();
80
89
  }
81
90
 
@@ -39,7 +39,7 @@ export default class ReactNativeBlobUtilSession {
39
39
 
40
40
  remove(path:string):ReactNativeBlobUtilSession {
41
41
  let list = sessions[this.name];
42
- for (let i of list) {
42
+ for (let i = 0; i < list.length; i++) {
43
43
  if (list[i] === path) {
44
44
  sessions[this.name].splice(i, 1);
45
45
  break;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-blob-util",
3
- "version": "0.21.2",
3
+ "version": "0.21.3",
4
4
  "description": "A module provides upload, download, and files access API. Supports file stream read/write for process large files.",
5
5
  "main": "index",
6
6
  "scripts": {