1
0
mirror of https://gitcode.com/gh_mirrors/re/react-native-pushy.git synced 2025-09-16 07:01:38 +08:00
Code Issues Packages Projects Releases Wiki Activity GitHub Gitee

fallback for all

This commit is contained in:
sunnylqm
2025-05-21 11:46:40 +08:00
parent 2cf7336b6a
commit e5424591d1

View File

@@ -109,11 +109,11 @@ export const assertDev = (matter: string) => {
return true;
};
export const isAndroid70AndBelow = () => {
// android 7.0 and below devices do not support letsencrypt cert
// https://letsencrypt.org/2023/07/10/cross-sign-expiration/
return Platform.OS === 'android' && Platform.Version <= 24;
};
// export const isAndroid70AndBelow = () => {
// // android 7.0 and below devices do not support letsencrypt cert
// // https://letsencrypt.org/2023/07/10/cross-sign-expiration/
// return Platform.OS === 'android' && Platform.Version <= 24;
// };
export const enhancedFetch = async (
url: string,
@@ -121,10 +121,7 @@ export const enhancedFetch = async (
) => {
return fetch(url, params).catch(e => {
log('fetch error', url, e);
if (isAndroid70AndBelow()) {
log(`try fallback to http because android version: ${Platform.Version}`);
return fetch(url.replace('https', 'http'), params);
}
throw e;
log('trying fallback to http');
return fetch(url.replace('https', 'http'), params);
});
};