fix sheet ripple on light theme
This commit is contained in:
parent
3eb3b56e06
commit
e9ecdaebaa
@ -1,70 +0,0 @@
|
|||||||
package com.rscordmobile;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
|
|
||||||
import com.facebook.react.modules.network.OkHttpClientFactory;
|
|
||||||
import com.facebook.react.modules.network.OkHttpClientProvider;
|
|
||||||
import com.facebook.react.modules.network.ReactCookieJarContainer;
|
|
||||||
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.security.KeyStore;
|
|
||||||
import java.security.SecureRandom;
|
|
||||||
import java.security.cert.Certificate;
|
|
||||||
import java.security.cert.CertificateFactory;
|
|
||||||
|
|
||||||
import javax.net.ssl.SSLContext;
|
|
||||||
import javax.net.ssl.TrustManagerFactory;
|
|
||||||
import javax.net.ssl.X509TrustManager;
|
|
||||||
|
|
||||||
import okhttp3.OkHttpClient;
|
|
||||||
|
|
||||||
public class CustomSslFactory implements OkHttpClientFactory {
|
|
||||||
private final Context context;
|
|
||||||
|
|
||||||
public CustomSslFactory(Context context) {
|
|
||||||
this.context = context;
|
|
||||||
}
|
|
||||||
|
|
||||||
private final int[] certResIds = new int[] {
|
|
||||||
R.raw.isrgrootx1,
|
|
||||||
R.raw.isrgrootx2
|
|
||||||
};
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public OkHttpClient createNewNetworkModuleClient() {
|
|
||||||
try {
|
|
||||||
CertificateFactory cf = CertificateFactory.getInstance("X.509");
|
|
||||||
|
|
||||||
KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
|
|
||||||
keyStore.load(null, null);
|
|
||||||
|
|
||||||
for (int i = 0; i < certResIds.length; i++) {
|
|
||||||
InputStream caInput = context.getResources().openRawResource(certResIds[i]);
|
|
||||||
Certificate ca;
|
|
||||||
try {
|
|
||||||
ca = cf.generateCertificate(caInput);
|
|
||||||
} finally {
|
|
||||||
caInput.close();
|
|
||||||
}
|
|
||||||
keyStore.setCertificateEntry("cert_" + i, ca);
|
|
||||||
}
|
|
||||||
|
|
||||||
TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
|
|
||||||
tmf.init(keyStore);
|
|
||||||
X509TrustManager trustManager = (X509TrustManager) tmf.getTrustManagers()[0];
|
|
||||||
|
|
||||||
SSLContext sslContext = SSLContext.getInstance("TLS");
|
|
||||||
sslContext.init(null, tmf.getTrustManagers(), new SecureRandom());
|
|
||||||
|
|
||||||
OkHttpClient client = new OkHttpClient.Builder()
|
|
||||||
.sslSocketFactory(sslContext.getSocketFactory(), trustManager)
|
|
||||||
.hostnameVerifier((hostname, session) -> true)
|
|
||||||
.cookieJar(new ReactCookieJarContainer())
|
|
||||||
.build();
|
|
||||||
|
|
||||||
return client;
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new RuntimeException("Failed to create custom SSL client", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,5 +1,5 @@
|
|||||||
package com.rscordmobile;
|
package com.rscordmobile;
|
||||||
import com.facebook.react.modules.network.OkHttpClientProvider;
|
|
||||||
import android.app.Application;
|
import android.app.Application;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
@ -44,7 +44,6 @@ public class MainApplication extends Application implements ReactApplication {
|
|||||||
@Override
|
@Override
|
||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
OkHttpClientProvider.setOkHttpClientFactory(new CustomSslFactory(this));
|
|
||||||
SoLoader.init(this, /* native exopackage */ false);
|
SoLoader.init(this, /* native exopackage */ false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import { useActionSheet, ActionSheetOptions } from "@expo/react-native-action-sheet";
|
import { useActionSheet, ActionSheetOptions } from "@expo/react-native-action-sheet";
|
||||||
import { useThemeColor } from "../lib/hooks/use-theme-color";
|
import { useThemeColor } from "../lib/hooks/use-theme-color";
|
||||||
import { Platform, BackHandler, useColorScheme } from "react-native";
|
import { useColorScheme } from "../lib/hooks/use-color-scheme";
|
||||||
|
import { Platform, BackHandler } from "react-native";
|
||||||
|
|
||||||
export function useThemedActionSheet() {
|
export function useThemedActionSheet() {
|
||||||
const { showActionSheetWithOptions } = useActionSheet();
|
const { showActionSheetWithOptions } = useActionSheet();
|
||||||
@ -10,7 +11,7 @@ export function useThemedActionSheet() {
|
|||||||
const notifColor = useThemeColor("notification");
|
const notifColor = useThemeColor("notification");
|
||||||
|
|
||||||
const colorScheme = useColorScheme();
|
const colorScheme = useColorScheme();
|
||||||
const rippleColor = colorScheme === "dark" ? "#3a3b3d" : "#d0d2d5";
|
const rippleColor = colorScheme === "dark" ? "#3a3b3d" : "rgba(255, 255, 255)";
|
||||||
|
|
||||||
const show = (options: ActionSheetOptions, callback: (index?: number) => void) => {
|
const show = (options: ActionSheetOptions, callback: (index?: number) => void) => {
|
||||||
if (Platform.OS === "android") {
|
if (Platform.OS === "android") {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user