Compare commits
7 Commits
develop
...
themed-ico
Author | SHA1 | Date |
---|---|---|
GleidsonDaniel | 6d2322fee7 | |
GleidsonDaniel | 83f170d7b3 | |
GleidsonDaniel | 43d8405579 | |
GleidsonDaniel | 6c5b1808c6 | |
GleidsonDaniel | 04c1a0fc12 | |
GleidsonDaniel | 18d09e62f6 | |
GleidsonDaniel | faee10af2c |
|
@ -1,4 +1,4 @@
|
|||
#!/bin/sh
|
||||
. "$(dirname "$0")/_/husky.sh"
|
||||
|
||||
npm run precommit
|
||||
# npm run precommit
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="731.4286"
|
||||
android:viewportHeight="731.4286">
|
||||
<group android:translateX="109.71429"
|
||||
android:translateY="109.71429">
|
||||
<group>
|
||||
<clip-path android:pathData="M0,0h512v512h-512z M 0,0"/>
|
||||
<path
|
||||
android:pathData="M404.999,208.068C396.342,194.624 384.207,182.722 368.953,172.683C339.479,153.318 300.753,142.65 259.908,142.65C246.261,142.65 232.816,143.837 219.765,146.187C211.667,138.391 202.2,131.378 192.173,125.836C154.971,107.29 122.187,114.196 105.623,120.152C100.181,122.11 98.502,128.993 102.527,133.146C114.209,145.202 133.536,169.029 128.785,190.696C110.315,209.551 100.3,232.287 100.3,255.959C100.3,280.083 110.315,302.818 128.785,321.674C133.536,343.341 114.209,367.18 102.527,379.236C98.514,383.377 100.181,390.259 105.623,392.217C122.187,398.174 154.971,405.092 192.185,386.545C202.212,381.004 211.679,373.991 219.777,366.195C232.828,368.544 246.273,369.731 259.92,369.731C300.777,369.731 339.503,359.075 368.965,339.71C384.219,329.671 396.354,317.782 405.011,304.325C414.657,289.35 419.539,273.225 419.539,256.422C419.527,239.169 414.645,223.055 404.999,208.068ZM258.241,341.787C240.58,341.787 223.742,339.508 208.392,335.391L197.174,346.177C191.077,352.039 183.932,357.343 176.478,361.52C166.606,366.349 156.853,368.995 147.207,369.79C147.755,368.806 148.255,367.809 148.791,366.812C160.032,346.165 163.069,327.607 157.889,311.148C139.502,296.707 128.475,278.22 128.475,258.083C128.475,211.865 186.576,174.392 258.241,174.392C329.905,174.392 388.018,211.865 388.018,258.083C388.018,304.314 329.917,341.787 258.241,341.787Z"
|
||||
/>
|
||||
<path
|
||||
android:pathData="M196.162,238.837C185.6,238.837 177.038,247.333 177.038,257.811C177.038,268.288 185.6,276.784 196.162,276.784C206.725,276.784 215.287,268.288 215.287,257.811C215.287,247.333 206.725,238.837 196.162,238.837Z"
|
||||
/>
|
||||
<path
|
||||
android:pathData="M257.717,238.837C247.154,238.837 238.592,247.333 238.592,257.811C238.592,268.288 247.154,276.784 257.717,276.784C268.279,276.784 276.842,268.288 276.842,257.811C276.842,247.333 268.279,238.837 257.717,238.837Z"
|
||||
/>
|
||||
<path
|
||||
android:pathData="M319.282,238.837C308.72,238.837 300.158,247.333 300.158,257.811C300.158,268.288 308.72,276.784 319.282,276.784C329.845,276.784 338.407,268.288 338.407,257.811C338.407,247.333 329.845,238.837 319.282,238.837Z"
|
||||
/>
|
||||
</group>
|
||||
</group>
|
||||
</vector>
|
|
@ -2,4 +2,5 @@
|
|||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background"/>
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
|
||||
<foreground android:drawable="@drawable/ic_launcher_monochrome"/>
|
||||
</adaptive-icon>
|
|
@ -2,4 +2,5 @@
|
|||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background"/>
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
|
||||
<foreground android:drawable="@drawable/ic_launcher_monochrome"/>
|
||||
</adaptive-icon>
|
|
@ -0,0 +1,24 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="731.4286"
|
||||
android:viewportHeight="731.4286">
|
||||
<group android:translateX="109.71429"
|
||||
android:translateY="109.71429">
|
||||
<group>
|
||||
<clip-path android:pathData="M0,0h512v512h-512z M 0,0"/>
|
||||
<path
|
||||
android:pathData="M404.999,208.068C396.342,194.624 384.207,182.722 368.953,172.683C339.479,153.318 300.753,142.65 259.908,142.65C246.261,142.65 232.816,143.837 219.765,146.187C211.667,138.391 202.2,131.378 192.173,125.836C154.971,107.29 122.187,114.196 105.623,120.152C100.181,122.11 98.502,128.993 102.527,133.146C114.209,145.202 133.536,169.029 128.785,190.696C110.315,209.551 100.3,232.287 100.3,255.959C100.3,280.083 110.315,302.818 128.785,321.674C133.536,343.341 114.209,367.18 102.527,379.236C98.514,383.377 100.181,390.259 105.623,392.217C122.187,398.174 154.971,405.092 192.185,386.545C202.212,381.004 211.679,373.991 219.777,366.195C232.828,368.544 246.273,369.731 259.92,369.731C300.777,369.731 339.503,359.075 368.965,339.71C384.219,329.671 396.354,317.782 405.011,304.325C414.657,289.35 419.539,273.225 419.539,256.422C419.527,239.169 414.645,223.055 404.999,208.068ZM258.241,341.787C240.58,341.787 223.742,339.508 208.392,335.391L197.174,346.177C191.077,352.039 183.932,357.343 176.478,361.52C166.606,366.349 156.853,368.995 147.207,369.79C147.755,368.806 148.255,367.809 148.791,366.812C160.032,346.165 163.069,327.607 157.889,311.148C139.502,296.707 128.475,278.22 128.475,258.083C128.475,211.865 186.576,174.392 258.241,174.392C329.905,174.392 388.018,211.865 388.018,258.083C388.018,304.314 329.917,341.787 258.241,341.787Z"
|
||||
/>
|
||||
<path
|
||||
android:pathData="M196.162,238.837C185.6,238.837 177.038,247.333 177.038,257.811C177.038,268.288 185.6,276.784 196.162,276.784C206.725,276.784 215.287,268.288 215.287,257.811C215.287,247.333 206.725,238.837 196.162,238.837Z"
|
||||
/>
|
||||
<path
|
||||
android:pathData="M257.717,238.837C247.154,238.837 238.592,247.333 238.592,257.811C238.592,268.288 247.154,276.784 257.717,276.784C268.279,276.784 276.842,268.288 276.842,257.811C276.842,247.333 268.279,238.837 257.717,238.837Z"
|
||||
/>
|
||||
<path
|
||||
android:pathData="M319.282,238.837C308.72,238.837 300.158,247.333 300.158,257.811C300.158,268.288 308.72,276.784 319.282,276.784C329.845,276.784 338.407,268.288 338.407,257.811C338.407,247.333 329.845,238.837 319.282,238.837Z"
|
||||
/>
|
||||
</group>
|
||||
</group>
|
||||
</vector>
|
|
@ -2,4 +2,5 @@
|
|||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background"/>
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
|
||||
<foreground android:drawable="@drawable/ic_launcher_monochrome"/>
|
||||
</adaptive-icon>
|
|
@ -2,4 +2,5 @@
|
|||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background"/>
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
|
||||
<foreground android:drawable="@drawable/ic_launcher_monochrome"/>
|
||||
</adaptive-icon>
|
|
@ -12,8 +12,8 @@ buildscript {
|
|||
ext {
|
||||
buildToolsVersion = "31.0.0"
|
||||
minSdkVersion = 23
|
||||
compileSdkVersion = 31
|
||||
targetSdkVersion = 31
|
||||
compileSdkVersion = 33
|
||||
targetSdkVersion = 33
|
||||
if (System.properties['os.arch'] == "aarch64") {
|
||||
// For M1 Users we need to use the NDK 24 which added support for aarch64
|
||||
ndkVersion = "24.0.8215888"
|
||||
|
@ -43,7 +43,7 @@ buildscript {
|
|||
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.0'
|
||||
classpath 'com.bugsnag:bugsnag-android-gradle-plugin:7.+'
|
||||
}
|
||||
classpath("com.android.tools.build:gradle:7.0.4")
|
||||
classpath("com.android.tools.build:gradle:7.4.1")
|
||||
classpath("com.facebook.react:react-native-gradle-plugin")
|
||||
classpath("de.undercouch:gradle-download-task:4.1.2")
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#Tue Feb 28 17:35:18 BRT 2023
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip
|
||||
zipStorePath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
|
@ -3,7 +3,7 @@ import { PermissionsAndroid, StyleSheet, View } from 'react-native';
|
|||
import { connect } from 'react-redux';
|
||||
import { StackNavigationOptions, StackNavigationProp } from '@react-navigation/stack';
|
||||
import { RouteProp } from '@react-navigation/native';
|
||||
import CameraRoll from '@react-native-community/cameraroll';
|
||||
import CameraRoll from '@react-native-camera-roll/camera-roll';
|
||||
import * as mime from 'react-native-mime-types';
|
||||
import RNFetchBlob from 'rn-fetch-blob';
|
||||
import { Video, ResizeMode } from 'expo-av';
|
||||
|
|
30
package.json
30
package.json
|
@ -28,16 +28,16 @@
|
|||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"@bugsnag/react-native": "^7.10.5",
|
||||
"@bugsnag/react-native": "^7.19.0",
|
||||
"@codler/react-native-keyboard-aware-scroll-view": "^2.0.1",
|
||||
"@gorhom/bottom-sheet": "^4.3.1",
|
||||
"@hookform/resolvers": "^2.9.10",
|
||||
"@nozbe/watermelondb": "0.23.0",
|
||||
"@react-native-async-storage/async-storage": "^1.17.11",
|
||||
"@react-native-camera-roll/camera-roll": "^5.2.4",
|
||||
"@react-native-clipboard/clipboard": "^1.8.5",
|
||||
"@react-native-community/art": "^1.2.0",
|
||||
"@react-native-community/blur": "^4.1.0",
|
||||
"@react-native-community/cameraroll": "4.1.2",
|
||||
"@react-native-community/datetimepicker": "3.5.2",
|
||||
"@react-native-community/hooks": "2.6.0",
|
||||
"@react-native-community/netinfo": "6.0.0",
|
||||
|
@ -62,15 +62,15 @@
|
|||
"commonmark-react-renderer": "git+https://github.com/RocketChat/commonmark-react-renderer.git",
|
||||
"dequal": "^2.0.3",
|
||||
"ejson": "^2.2.3",
|
||||
"expo": "^46.0.9",
|
||||
"expo-apple-authentication": "4.2.1",
|
||||
"expo-av": "11.2.3",
|
||||
"expo-file-system": "14.0.0",
|
||||
"expo-haptics": "11.2.0",
|
||||
"expo-keep-awake": "10.1.1",
|
||||
"expo-local-authentication": "12.2.0",
|
||||
"expo-video-thumbnails": "6.3.0",
|
||||
"expo-web-browser": "10.2.1",
|
||||
"expo": "^48.0.4",
|
||||
"expo-apple-authentication": "6.0.1",
|
||||
"expo-av": "13.2.1",
|
||||
"expo-file-system": "15.2.2",
|
||||
"expo-haptics": "12.2.1",
|
||||
"expo-keep-awake": "12.0.1",
|
||||
"expo-local-authentication": "13.2.1",
|
||||
"expo-video-thumbnails": "7.2.1",
|
||||
"expo-web-browser": "12.1.1",
|
||||
"hoist-non-react-statics": "3.3.2",
|
||||
"i18n-js": "3.9.2",
|
||||
"js-base64": "3.6.1",
|
||||
|
@ -80,7 +80,7 @@
|
|||
"moment": "2.29.4",
|
||||
"pretty-bytes": "5.6.0",
|
||||
"prop-types": "15.7.2",
|
||||
"react": "17.0.2",
|
||||
"react": "18.2.0",
|
||||
"react-hook-form": "^7.34.2",
|
||||
"react-native": "RocketChat/react-native#51266d5ab8b4c3f04c0e8f207ea5db6056647104",
|
||||
"react-native-animatable": "^1.3.3",
|
||||
|
@ -94,7 +94,7 @@
|
|||
"react-native-easy-toast": "^1.2.0",
|
||||
"react-native-fast-image": "RocketChat/react-native-fast-image.git#bump-version",
|
||||
"react-native-file-viewer": "^2.1.4",
|
||||
"react-native-gesture-handler": "2.4.2",
|
||||
"react-native-gesture-handler": "2.9.0",
|
||||
"react-native-image-crop-picker": "RocketChat/react-native-image-crop-picker",
|
||||
"react-native-image-progress": "^1.1.1",
|
||||
"react-native-keycommands": "2.0.3",
|
||||
|
@ -125,7 +125,7 @@
|
|||
"react-native-svg": "^12.3.0",
|
||||
"react-native-ui-lib": "RocketChat/react-native-ui-lib",
|
||||
"react-native-vector-icons": "9.1.0",
|
||||
"react-native-webview": "10.3.2",
|
||||
"react-native-webview": "11.26.1",
|
||||
"react-redux": "^8.0.5",
|
||||
"reactotron-react-native": "^5.0.3",
|
||||
"redux": "4.2.0",
|
||||
|
@ -200,7 +200,7 @@
|
|||
"identity-obj-proxy": "^3.0.0",
|
||||
"jest": "^28.1.3",
|
||||
"jest-cli": "^28.1.3",
|
||||
"jest-expo": "^46.0.1",
|
||||
"jest-expo": "^48.0.1",
|
||||
"metro-react-native-babel-preset": "^0.67.0",
|
||||
"mocha": "9.0.1",
|
||||
"otp.js": "1.2.0",
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
diff --git a/node_modules/react-native-webview/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java b/node_modules/react-native-webview/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java
|
||||
index ab869cf..08ce7ce 100644
|
||||
index 9cfe821..db4c23c 100644
|
||||
--- a/node_modules/react-native-webview/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java
|
||||
+++ b/node_modules/react-native-webview/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java
|
||||
@@ -84,6 +84,12 @@ import java.util.Map;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
@@ -102,6 +102,12 @@ import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
+import java.security.cert.X509Certificate;
|
||||
+import java.security.PrivateKey;
|
||||
|
@ -15,27 +15,26 @@ index ab869cf..08ce7ce 100644
|
|||
/**
|
||||
* Manages instances of {@link WebView}
|
||||
* <p>
|
||||
@@ -140,6 +146,8 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
|
||||
protected @Nullable String mUserAgent = null;
|
||||
@@ -165,6 +171,7 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
|
||||
protected @Nullable String mUserAgentWithApplicationName = null;
|
||||
|
||||
protected @Nullable String mDownloadingMessage = null;
|
||||
protected @Nullable String mLackPermissionToDownloadMessage = null;
|
||||
+ private static String certificateAlias = null;
|
||||
+
|
||||
|
||||
public RNCWebViewManager() {
|
||||
mWebViewConfig = new WebViewConfig() {
|
||||
public void configWebView(WebView webView) {
|
||||
@@ -151,6 +159,10 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
|
||||
@@ -177,6 +184,10 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
|
||||
mWebViewConfig = webViewConfig;
|
||||
}
|
||||
|
||||
+ public static void setCertificateAlias(String alias) {
|
||||
+ certificateAlias = alias;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
protected static void dispatchEvent(WebView webView, Event event) {
|
||||
ReactContext reactContext = (ReactContext) webView.getContext();
|
||||
EventDispatcher eventDispatcher =
|
||||
@@ -562,7 +574,7 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
|
||||
@Override
|
||||
public String getName() {
|
||||
return REACT_CLASS;
|
||||
@@ -687,7 +698,7 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
|
||||
@Override
|
||||
protected void addEventEmitters(ThemedReactContext reactContext, WebView view) {
|
||||
// Do not register default touch emitter and let WebView implementation handle touches
|
||||
|
@ -44,7 +43,7 @@ index ab869cf..08ce7ce 100644
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -742,12 +754,56 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
|
||||
@@ -907,6 +918,7 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
|
||||
|
||||
protected static class RNCWebViewClient extends WebViewClient {
|
||||
|
||||
|
@ -52,57 +51,55 @@ index ab869cf..08ce7ce 100644
|
|||
protected boolean mLastLoadFailed = false;
|
||||
protected @Nullable
|
||||
ReadableArray mUrlPrefixesForDefaultIntent;
|
||||
protected RNCWebView.ProgressChangedFilter progressChangedFilter = null;
|
||||
@@ -914,6 +926,46 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
|
||||
protected @Nullable String ignoreErrFailedForThisURL = null;
|
||||
protected @Nullable BasicAuthCredential basicAuthCredential = null;
|
||||
|
||||
+ public RNCWebViewClient(ReactContext reactContext) {
|
||||
+ this.reactContext = reactContext;
|
||||
+ this.reactContext = reactContext;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void onReceivedClientCertRequest(WebView view, ClientCertRequest request) {
|
||||
+ class SslStuff {
|
||||
+ PrivateKey privKey;
|
||||
+ X509Certificate[] certChain;
|
||||
+ @Override
|
||||
+ public void onReceivedClientCertRequest(WebView view, ClientCertRequest request) {
|
||||
+ class SslStuff {
|
||||
+ PrivateKey privKey;
|
||||
+ X509Certificate[] certChain;
|
||||
+
|
||||
+ public SslStuff(PrivateKey privKey, X509Certificate[] certChain) {
|
||||
+ this.privKey = privKey;
|
||||
+ this.certChain = certChain;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (certificateAlias != null) {
|
||||
+ AsyncTask<Void, Void, SslStuff> task = new AsyncTask<Void, Void, SslStuff>() {
|
||||
+ @Override
|
||||
+ protected SslStuff doInBackground(Void... params) {
|
||||
+ try {
|
||||
+ PrivateKey privKey = KeyChain.getPrivateKey(reactContext, certificateAlias);
|
||||
+ X509Certificate[] certChain = KeyChain.getCertificateChain(reactContext, certificateAlias);
|
||||
+
|
||||
+ return new SslStuff(privKey, certChain);
|
||||
+ } catch (Exception e) {
|
||||
+ return null;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ protected void onPostExecute(SslStuff sslStuff) {
|
||||
+ if (sslStuff != null) {
|
||||
+ request.proceed(sslStuff.privKey, sslStuff.certChain);
|
||||
+ }
|
||||
+ }
|
||||
+ };
|
||||
+ task.execute();
|
||||
+ } else {
|
||||
+ super.onReceivedClientCertRequest(view, request);
|
||||
+ }
|
||||
+ }
|
||||
+ public SslStuff(PrivateKey privKey, X509Certificate[] certChain) {
|
||||
+ this.privKey = privKey;
|
||||
+ this.certChain = certChain;
|
||||
+ }
|
||||
+ }
|
||||
+ if (certificateAlias != null) {
|
||||
+ AsyncTask<Void, Void, SslStuff> task = new AsyncTask<Void, Void, SslStuff>() {
|
||||
+ @Override
|
||||
+ protected SslStuff doInBackground(Void... params) {
|
||||
+ try {
|
||||
+ PrivateKey privKey = KeyChain.getPrivateKey(reactContext, certificateAlias);
|
||||
+ X509Certificate[] certChain = KeyChain.getCertificateChain(reactContext, certificateAlias);
|
||||
+ return new SslStuff(privKey, certChain);
|
||||
+ } catch (Exception e) {
|
||||
+ return null;
|
||||
+ }
|
||||
+ }
|
||||
+ @Override
|
||||
+ protected void onPostExecute(SslStuff sslStuff) {
|
||||
+ if (sslStuff != null) {
|
||||
+ request.proceed(sslStuff.privKey, sslStuff.certChain);
|
||||
+ }
|
||||
+ }
|
||||
+ };
|
||||
+ task.execute();
|
||||
+ } else {
|
||||
+ super.onReceivedClientCertRequest(view, request);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
public void setIgnoreErrFailedForThisURL(@Nullable String url) {
|
||||
ignoreErrFailedForThisURL = url;
|
||||
}
|
||||
diff --git a/node_modules/react-native-webview/apple/RNCWebView.m b/node_modules/react-native-webview/apple/RNCWebView.m
|
||||
index 02b4238..e0635ed 100644
|
||||
index 7570d8d..0cc28fc 100644
|
||||
--- a/node_modules/react-native-webview/apple/RNCWebView.m
|
||||
+++ b/node_modules/react-native-webview/apple/RNCWebView.m
|
||||
@@ -17,6 +17,9 @@
|
||||
|
@ -115,8 +112,8 @@ index 02b4238..e0635ed 100644
|
|||
static NSTimer *keyboardTimer;
|
||||
static NSString *const HistoryShimName = @"ReactNativeHistoryShim";
|
||||
static NSString *const MessageHandlerName = @"ReactNativeWebView";
|
||||
@@ -737,6 +740,68 @@ static NSDictionary* customCertificatesForHost;
|
||||
customCertificatesForHost = certificates;
|
||||
@@ -963,6 +966,68 @@ + (void)setCustomCertificatesForHost:(nullable NSDictionary*)certificates {
|
||||
customCertificatesForHost = certificates;
|
||||
}
|
||||
|
||||
+-(NSURLCredential *)getUrlCredential:(NSURLAuthenticationChallenge *)challenge path:(NSString *)path password:(NSString *)password
|
||||
|
@ -184,37 +181,37 @@ index 02b4238..e0635ed 100644
|
|||
- (void) webView:(WKWebView *)webView
|
||||
didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
|
||||
completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential * _Nullable))completionHandler
|
||||
@@ -746,7 +811,32 @@ static NSDictionary* customCertificatesForHost;
|
||||
host = webView.URL.host;
|
||||
}
|
||||
if ([[challenge protectionSpace] authenticationMethod] == NSURLAuthenticationMethodClientCertificate) {
|
||||
- completionHandler(NSURLSessionAuthChallengeUseCredential, clientAuthenticationCredential);
|
||||
+ NSString *host = challenge.protectionSpace.host;
|
||||
@@ -972,7 +1037,32 @@ - (void) webView:(WKWebView *)webView
|
||||
host = webView.URL.host;
|
||||
}
|
||||
if ([[challenge protectionSpace] authenticationMethod] == NSURLAuthenticationMethodClientCertificate) {
|
||||
- completionHandler(NSURLSessionAuthChallengeUseCredential, clientAuthenticationCredential);
|
||||
+ NSString *host = challenge.protectionSpace.host;
|
||||
+
|
||||
+ // Read the clientSSL info from MMKV
|
||||
+ __block NSDictionary *clientSSL;
|
||||
+ SecureStorage *secureStorage = [[SecureStorage alloc] init];
|
||||
+ // Read the clientSSL info from MMKV
|
||||
+ __block NSDictionary *clientSSL;
|
||||
+ SecureStorage *secureStorage = [[SecureStorage alloc] init];
|
||||
+
|
||||
+ // https://github.com/ammarahm-ed/react-native-mmkv-storage/blob/master/src/loader.js#L31
|
||||
+ NSString *key = [secureStorage getSecureKey:[self stringToHex:@"com.MMKV.default"]];
|
||||
+ NSURLCredential *credential = [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust];
|
||||
+ // https://github.com/ammarahm-ed/react-native-mmkv-storage/blob/master/src/loader.js#L31
|
||||
+ NSString *key = [secureStorage getSecureKey:[self stringToHex:@"com.MMKV.default"]];
|
||||
+ NSURLCredential *credential = [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust];
|
||||
+
|
||||
+ if (key == NULL) {
|
||||
+ return completionHandler(NSURLSessionAuthChallengePerformDefaultHandling, credential);
|
||||
+ }
|
||||
+ if (key == NULL) {
|
||||
+ return completionHandler(NSURLSessionAuthChallengePerformDefaultHandling, credential);
|
||||
+ }
|
||||
+
|
||||
+ NSData *cryptKey = [key dataUsingEncoding:NSUTF8StringEncoding];
|
||||
+ MMKV *mmkv = [MMKV mmkvWithID:@"default" cryptKey:cryptKey mode:MMKVMultiProcess];
|
||||
+ clientSSL = [mmkv getObjectOfClass:[NSDictionary class] forKey:host];
|
||||
+ NSData *cryptKey = [key dataUsingEncoding:NSUTF8StringEncoding];
|
||||
+ MMKV *mmkv = [MMKV mmkvWithID:@"default" cryptKey:cryptKey mode:MMKVMultiProcess];
|
||||
+ clientSSL = [mmkv getObjectOfClass:[NSDictionary class] forKey:host];
|
||||
+
|
||||
+
|
||||
+ if (clientSSL != (id)[NSNull null]) {
|
||||
+ NSString *path = [clientSSL objectForKey:@"path"];
|
||||
+ NSString *password = [clientSSL objectForKey:@"password"];
|
||||
+ credential = [self getUrlCredential:challenge path:path password:password];
|
||||
+ }
|
||||
+ if (clientSSL != (id)[NSNull null]) {
|
||||
+ NSString *path = [clientSSL objectForKey:@"path"];
|
||||
+ NSString *password = [clientSSL objectForKey:@"password"];
|
||||
+ credential = [self getUrlCredential:challenge path:path password:password];
|
||||
+ }
|
||||
+
|
||||
+ completionHandler(NSURLSessionAuthChallengeUseCredential, credential);
|
||||
return;
|
||||
}
|
||||
if ([[challenge protectionSpace] serverTrust] != nil && customCertificatesForHost != nil && host != nil) {
|
||||
+ completionHandler(NSURLSessionAuthChallengeUseCredential, credential);
|
||||
return;
|
||||
}
|
||||
if ([[challenge protectionSpace] serverTrust] != nil && customCertificatesForHost != nil && host != nil) {
|
Loading…
Reference in New Issue