diff --git a/android/app/build.gradle b/android/app/build.gradle index 3748634f2..67bde36e7 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -223,6 +223,7 @@ dependencies { implementation 'androidx.appcompat:appcompat:1.1.0' implementation 'com.facebook.soloader:soloader:0.10.4' implementation("com.facebook.fresco:animated-gif:2.5.0") + implementation "com.facebook.fresco:imagepipeline-okhttp3:3.1.3" // need this? // react-native-screens was pointing to a newer version of this lib that is currently not supported in our app diff --git a/android/app/src/main/java/chat/rocket/reactnative/networking/SSLPinningModule.java b/android/app/src/main/java/chat/rocket/reactnative/networking/SSLPinningModule.java index b75109caf..a3ecdcf44 100644 --- a/android/app/src/main/java/chat/rocket/reactnative/networking/SSLPinningModule.java +++ b/android/app/src/main/java/chat/rocket/reactnative/networking/SSLPinningModule.java @@ -6,7 +6,9 @@ import com.facebook.react.modules.network.NetworkingModule; import com.facebook.react.modules.network.CustomClientBuilder; import com.facebook.react.modules.network.ReactCookieJarContainer; import com.facebook.react.modules.websocket.WebSocketModule; -// import com.facebook.react.modules.fresco.ReactOkHttpNetworkFetcher; +import com.facebook.drawee.backends.pipeline.Fresco; +import com.facebook.imagepipeline.core.ImagePipelineConfig; +import com.facebook.imagepipeline.backends.okhttp3.OkHttpImagePipelineConfigFactory; import com.facebook.react.bridge.ReactMethod; import com.facebook.react.bridge.Promise; @@ -34,7 +36,7 @@ import java.util.concurrent.TimeUnit; import com.RNFetchBlob.RNFetchBlob; -// import com.reactnativecommunity.webview.RNCWebViewManager; +import com.reactnativecommunity.webview.RNCWebViewManager; import com.dylanvann.fastimage.FastImageOkHttpUrlLoader; @@ -103,11 +105,14 @@ public class SSLPinningModule extends ReactContextBaseJavaModule implements KeyC // Websocket react-native layer WebSocketModule.setCustomClientBuilder(new CustomClient()); // Image networking react-native layer - // ReactOkHttpNetworkFetcher.setOkHttpClient(getOkHttpClient()); + ImagePipelineConfig config = OkHttpImagePipelineConfigFactory + .newBuilder(this.reactContext, getOkHttpClient()) + .build(); + Fresco.initialize(this.reactContext, config); // RNFetchBlob networking layer - // RNFetchBlob.applyCustomOkHttpClient(getOkHttpClient()); + RNFetchBlob.applyCustomOkHttpClient(getOkHttpClient()); // RNCWebView onReceivedClientCertRequest - // RNCWebViewManager.setCertificateAlias(data); + RNCWebViewManager.setCertificateAlias(data); // FastImage Glide network layer FastImageOkHttpUrlLoader.setOkHttpClient(getOkHttpClient()); // Expo AV network layer diff --git a/package.json b/package.json index c31063d4b..706dc34d9 100644 --- a/package.json +++ b/package.json @@ -137,7 +137,7 @@ "remove-markdown": "0.3.0", "reselect": "4.0.0", "rn-extensions-share": "RocketChat/rn-extensions-share", - "rn-fetch-blob": "0.12.0", + "rn-fetch-blob": "^0.12.0", "rn-root-view": "RocketChat/rn-root-view", "semver": "7.3.8", "transliteration": "2.3.5", diff --git a/patches/react-native-webview+11.26.1.patch_ b/patches/react-native-webview+11.26.1.patch similarity index 100% rename from patches/react-native-webview+11.26.1.patch_ rename to patches/react-native-webview+11.26.1.patch diff --git a/patches/rn-fetch-blob+0.12.0.patch b/patches/rn-fetch-blob+0.12.0.patch new file mode 100644 index 000000000..a44ab9cad --- /dev/null +++ b/patches/rn-fetch-blob+0.12.0.patch @@ -0,0 +1,24 @@ +diff --git a/node_modules/rn-fetch-blob/android/src/main/java/com/RNFetchBlob/RNFetchBlob.java b/node_modules/rn-fetch-blob/android/src/main/java/com/RNFetchBlob/RNFetchBlob.java +index 602d51d..920d975 100644 +--- a/node_modules/rn-fetch-blob/android/src/main/java/com/RNFetchBlob/RNFetchBlob.java ++++ b/node_modules/rn-fetch-blob/android/src/main/java/com/RNFetchBlob/RNFetchBlob.java +@@ -38,7 +38,7 @@ import static com.RNFetchBlob.RNFetchBlobConst.GET_CONTENT_INTENT; + + public class RNFetchBlob extends ReactContextBaseJavaModule { + +- private final OkHttpClient mClient; ++ static private OkHttpClient mClient; + + static ReactApplicationContext RCTContext; + private static LinkedBlockingQueue taskQueue = new LinkedBlockingQueue<>(); +@@ -75,6 +75,10 @@ public class RNFetchBlob extends ReactContextBaseJavaModule { + }); + } + ++ public static void applyCustomOkHttpClient(OkHttpClient client) { ++ mClient = client; ++ } ++ + @Override + public String getName() { + return "RNFetchBlob"; diff --git a/yarn.lock b/yarn.lock index 47b7b7281..5829b17f7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -17125,7 +17125,7 @@ rn-extensions-share@RocketChat/rn-extensions-share: version "2.4.1" resolved "https://codeload.github.com/RocketChat/rn-extensions-share/tar.gz/4d7c0e4c2f300e4fb116af7b7cc0dbbc8169150c" -rn-fetch-blob@0.12.0: +rn-fetch-blob@^0.12.0: version "0.12.0" resolved "https://registry.yarnpkg.com/rn-fetch-blob/-/rn-fetch-blob-0.12.0.tgz#ec610d2f9b3f1065556b58ab9c106eeb256f3cba" integrity sha512-+QnR7AsJ14zqpVVUbzbtAjq0iI8c9tCg49tIoKO2ezjzRunN7YL6zFSFSWZm6d+mE/l9r+OeDM3jmb2tBb2WbA==