mirror of
https://gitcode.com/gh_mirrors/re/react-native-pushy.git
synced 2025-09-16 12:11:39 +08:00
fallback for all
This commit is contained in:
15
src/utils.ts
15
src/utils.ts
@@ -109,11 +109,11 @@ export const assertDev = (matter: string) => {
|
|||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const isAndroid70AndBelow = () => {
|
// export const isAndroid70AndBelow = () => {
|
||||||
// android 7.0 and below devices do not support letsencrypt cert
|
// // android 7.0 and below devices do not support letsencrypt cert
|
||||||
// https://letsencrypt.org/2023/07/10/cross-sign-expiration/
|
// // https://letsencrypt.org/2023/07/10/cross-sign-expiration/
|
||||||
return Platform.OS === 'android' && Platform.Version <= 24;
|
// return Platform.OS === 'android' && Platform.Version <= 24;
|
||||||
};
|
// };
|
||||||
|
|
||||||
export const enhancedFetch = async (
|
export const enhancedFetch = async (
|
||||||
url: string,
|
url: string,
|
||||||
@@ -121,10 +121,7 @@ export const enhancedFetch = async (
|
|||||||
) => {
|
) => {
|
||||||
return fetch(url, params).catch(e => {
|
return fetch(url, params).catch(e => {
|
||||||
log('fetch error', url, e);
|
log('fetch error', url, e);
|
||||||
if (isAndroid70AndBelow()) {
|
log('trying fallback to http');
|
||||||
log(`try fallback to http because android version: ${Platform.Version}`);
|
|
||||||
return fetch(url.replace('https', 'http'), params);
|
return fetch(url.replace('https', 'http'), params);
|
||||||
}
|
|
||||||
throw e;
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user