From e149e4b5fd6267acc82020a486631bc6db371422 Mon Sep 17 00:00:00 2001 From: Laurent Cozic Date: Mon, 29 May 2023 13:15:53 +0100 Subject: [PATCH] Revert "Mobile: Fix "Download interrupted" error" This reverts commit b023f58497b7ab94516b0c66293e3fbb794409c1. Due to: https://discourse.joplinapp.org/t/the-latest-ios-version-of-joplin-12-11-2-works-weird/31045 --- packages/app-mobile/ios/Podfile.lock | 12 ++--- packages/app-mobile/package.json | 2 +- .../app-mobile/services/profiles/index.ts | 2 +- packages/app-mobile/utils/fs-driver-rn.ts | 4 +- packages/app-mobile/utils/shim-init-react.js | 2 +- yarn.lock | 49 +++++++++++++------ 6 files changed, 46 insertions(+), 25 deletions(-) diff --git a/packages/app-mobile/ios/Podfile.lock b/packages/app-mobile/ios/Podfile.lock index 3a81b497e..655dd9f53 100644 --- a/packages/app-mobile/ios/Podfile.lock +++ b/packages/app-mobile/ios/Podfile.lock @@ -290,8 +290,6 @@ PODS: - glog - react-native-alarm-notification (2.11.0): - React - - react-native-blob-util (0.17.3): - - React-Core - react-native-camera (4.2.1): - React-Core - react-native-camera/RCT (= 4.2.1) @@ -398,6 +396,8 @@ PODS: - React-jsi (= 0.70.6) - React-logger (= 0.70.6) - React-perflogger (= 0.70.6) + - rn-fetch-blob (0.12.0): + - React-Core - RNCClipboard (1.5.1): - React-Core - RNCPushNotificationIOS (1.11.0): @@ -499,7 +499,6 @@ DEPENDENCIES: - React-jsinspector (from `../node_modules/react-native/ReactCommon/jsinspector`) - React-logger (from `../node_modules/react-native/ReactCommon/logger`) - "react-native-alarm-notification (from `../node_modules/@joplin/react-native-alarm-notification`)" - - react-native-blob-util (from `../node_modules/react-native-blob-util`) - react-native-camera (from `../node_modules/react-native-camera`) - react-native-document-picker (from `../node_modules/react-native-document-picker`) - react-native-fingerprint-scanner (from `../node_modules/react-native-fingerprint-scanner`) @@ -527,6 +526,7 @@ DEPENDENCIES: - React-RCTVibration (from `../node_modules/react-native/Libraries/Vibration`) - React-runtimeexecutor (from `../node_modules/react-native/ReactCommon/runtimeexecutor`) - ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`) + - rn-fetch-blob (from `../node_modules/rn-fetch-blob`) - "RNCClipboard (from `../node_modules/@react-native-community/clipboard`)" - "RNCPushNotificationIOS (from `../node_modules/@react-native-community/push-notification-ios`)" - "RNDateTimePicker (from `../node_modules/@react-native-community/datetimepicker`)" @@ -604,8 +604,6 @@ EXTERNAL SOURCES: :path: "../node_modules/react-native/ReactCommon/logger" react-native-alarm-notification: :path: "../node_modules/@joplin/react-native-alarm-notification" - react-native-blob-util: - :path: "../node_modules/react-native-blob-util" react-native-camera: :path: "../node_modules/react-native-camera" react-native-document-picker: @@ -660,6 +658,8 @@ EXTERNAL SOURCES: :path: "../node_modules/react-native/ReactCommon/runtimeexecutor" ReactCommon: :path: "../node_modules/react-native/ReactCommon" + rn-fetch-blob: + :path: "../node_modules/rn-fetch-blob" RNCClipboard: :path: "../node_modules/@react-native-community/clipboard" RNCPushNotificationIOS: @@ -723,7 +723,6 @@ SPEC CHECKSUMS: React-jsinspector: 60769e5a0a6d4b32294a2456077f59d0266f9a8b React-logger: 1623c216abaa88974afce404dc8f479406bbc3a0 react-native-alarm-notification: 26527410a6162d07a9dc57f4bbc62e94ff48e65d - react-native-blob-util: 99f4d79189252f597fe0d810c57a3733b1b1dea6 react-native-camera: 3eae183c1d111103963f3dd913b65d01aef8110f react-native-document-picker: 495c444c0c773c6e83a5d91165890ecb1c0a399a react-native-fingerprint-scanner: ac6656f18c8e45a7459302b84da41a44ad96dbbe @@ -751,6 +750,7 @@ SPEC CHECKSUMS: React-RCTVibration: c75ceef7aa60a33b2d5731ebe5800ddde40cefc4 React-runtimeexecutor: 15437b576139df27635400de0599d9844f1ab817 ReactCommon: 349be31adeecffc7986a0de875d7fb0dcf4e251c + rn-fetch-blob: f065bb7ab7fb48dd002629f8bdcb0336602d3cba RNCClipboard: 41d8d918092ae8e676f18adada19104fa3e68495 RNCPushNotificationIOS: 64218f3c776c03d7408284a819b2abfda1834bc8 RNDateTimePicker: 65e1d202799460b286ff5e741d8baf54695e8abd diff --git a/packages/app-mobile/package.json b/packages/app-mobile/package.json index 8400a7898..e5ba25d54 100644 --- a/packages/app-mobile/package.json +++ b/packages/app-mobile/package.json @@ -42,7 +42,6 @@ "react": "18.2.0", "react-native": "0.70.6", "react-native-action-button": "2.8.5", - "react-native-blob-util": "0.17.3", "react-native-camera": "4.2.1", "react-native-dialogbox": "0.6.10", "react-native-document-picker": "8.2.0", @@ -73,6 +72,7 @@ "react-native-webview": "11.26.1", "react-redux": "7.2.9", "redux": "4.2.1", + "rn-fetch-blob": "0.12.0", "stream": "0.0.2", "stream-browserify": "3.0.0", "string-natural-compare": "3.0.1", diff --git a/packages/app-mobile/services/profiles/index.ts b/packages/app-mobile/services/profiles/index.ts index 8252bac1f..12ec7742b 100644 --- a/packages/app-mobile/services/profiles/index.ts +++ b/packages/app-mobile/services/profiles/index.ts @@ -4,7 +4,7 @@ const RNExitApp = require('react-native-exit-app').default; import { Profile, ProfileConfig } from '@joplin/lib/services/profileConfig/types'; import { loadProfileConfig as libLoadProfileConfig, saveProfileConfig as libSaveProfileConfig } from '@joplin/lib/services/profileConfig/index'; -import RNFetchBlob from 'react-native-blob-util'; +import RNFetchBlob from 'rn-fetch-blob'; let dispatch_: Function = null; export const setDispatch = (dispatch: Function) => { diff --git a/packages/app-mobile/utils/fs-driver-rn.ts b/packages/app-mobile/utils/fs-driver-rn.ts index 3c525bcd1..b2a1809c6 100644 --- a/packages/app-mobile/utils/fs-driver-rn.ts +++ b/packages/app-mobile/utils/fs-driver-rn.ts @@ -1,5 +1,5 @@ import FsDriverBase, { ReadDirStatsOptions } from '@joplin/lib/fs-driver-base'; -import RNFetchBlob, { Encoding as RNFetchBlobEncoding } from 'react-native-blob-util'; +const RNFetchBlob = require('rn-fetch-blob').default; const RNFS = require('react-native-fs'); const DocumentPicker = require('react-native-document-picker').default; import { openDocument } from '@joplin/react-native-saf-x'; @@ -32,7 +32,7 @@ export default class FsDriverRN extends FsDriverBase { } // We need to use rn-fetch-blob here due to this bug: // https://github.com/itinance/react-native-fs/issues/700 - return RNFetchBlob.fs.writeFile(path, content, encoding as RNFetchBlobEncoding); + return RNFetchBlob.fs.writeFile(path, content, encoding); } // same as rm -rf diff --git a/packages/app-mobile/utils/shim-init-react.js b/packages/app-mobile/utils/shim-init-react.js index 6b2608724..ddc50c86a 100644 --- a/packages/app-mobile/utils/shim-init-react.js +++ b/packages/app-mobile/utils/shim-init-react.js @@ -1,7 +1,7 @@ const shim = require('@joplin/lib/shim').default; const { GeolocationReact } = require('./geolocation-react.js'); const PoorManIntervals = require('@joplin/lib/PoorManIntervals').default; -const RNFetchBlob = require('react-native-blob-util').default; +const RNFetchBlob = require('rn-fetch-blob').default; const { generateSecureRandom } = require('react-native-securerandom'); const FsDriverRN = require('./fs-driver-rn').default; const { Buffer } = require('buffer'); diff --git a/yarn.lock b/yarn.lock index 9badeaddf..345ba9f96 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5059,7 +5059,6 @@ __metadata: react: 18.2.0 react-native: 0.70.6 react-native-action-button: 2.8.5 - react-native-blob-util: 0.17.3 react-native-camera: 4.2.1 react-native-dialogbox: 0.6.10 react-native-document-picker: 8.2.0 @@ -5090,6 +5089,7 @@ __metadata: react-native-webview: 11.26.1 react-redux: 7.2.9 redux: 4.2.1 + rn-fetch-blob: 0.12.0 stream: 0.0.2 stream-browserify: 3.0.0 string-natural-compare: 3.0.1 @@ -17777,6 +17777,20 @@ __metadata: languageName: node linkType: hard +"glob@npm:7.0.6": + version: 7.0.6 + resolution: "glob@npm:7.0.6" + dependencies: + fs.realpath: ^1.0.0 + inflight: ^1.0.4 + inherits: 2 + minimatch: ^3.0.2 + once: ^1.3.0 + path-is-absolute: ^1.0.0 + checksum: 6ad065f51982f9a76f7052984121c95bca376ea02060b21200ad62b400422b05f0dc331f72da89a73c21a2451cbe9bec16bb17dcf37a516dc51bbbb6efe462a1 + languageName: node + linkType: hard + "glob@npm:8.1.0": version: 8.1.0 resolution: "glob@npm:8.1.0" @@ -27569,19 +27583,6 @@ __metadata: languageName: node linkType: hard -"react-native-blob-util@npm:0.17.3": - version: 0.17.3 - resolution: "react-native-blob-util@npm:0.17.3" - dependencies: - base-64: 0.1.0 - glob: ^7.2.3 - peerDependencies: - react: "*" - react-native: "*" - checksum: 32121a10f6015b97c1a2fd4aa089c68855098b8cfc706c8fa36efb1f8aa601d8275b64ebb3d81877f93d818301891d8cdca2218f09a88b02cf9a374461ed02e2 - languageName: node - linkType: hard - "react-native-camera@npm:4.2.1": version: 4.2.1 resolution: "react-native-camera@npm:4.2.1" @@ -29156,6 +29157,26 @@ __metadata: languageName: node linkType: hard +"rn-fetch-blob@npm:0.12.0": + version: 0.12.0 + resolution: "rn-fetch-blob@npm:0.12.0" + dependencies: + base-64: 0.1.0 + glob: 7.0.6 + checksum: 56e5832be583e97d58f955c0c4f6dcb0eb62c97dde331182c6effb726253731cb555d4a5f6c81079ed2fcb957f81633cbe95b37d326d063405f912506de20ff4 + languageName: node + linkType: hard + +"rn-fetch-blob@patch:rn-fetch-blob@npm%3A0.12.0#./.yarn/patches/rn-fetch-blob-npm-0.12.0-cf02e3c544.patch::locator=root%40workspace%3A.": + version: 0.12.0 + resolution: "rn-fetch-blob@patch:rn-fetch-blob@npm%3A0.12.0#./.yarn/patches/rn-fetch-blob-npm-0.12.0-cf02e3c544.patch::version=0.12.0&hash=9431c2&locator=root%40workspace%3A." + dependencies: + base-64: 0.1.0 + glob: 7.0.6 + checksum: 6535ee347b3e76733a10c3873c14622b35613caa86242536b68f130b75a3379d9bb060ad5c8832d78e639c88869e321c288e5c8e89373cdb0c14f23253c31c50 + languageName: node + linkType: hard + "roarr@npm:^2.15.3": version: 2.15.4 resolution: "roarr@npm:2.15.4"