fix: Catch cloud request errors (#5312)

This commit is contained in:
Diego Mello 2023-11-13 13:23:46 -03:00 committed by GitHub
parent ebcce11342
commit 629b8727d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 23 additions and 9 deletions

View File

@ -147,7 +147,7 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode VERSIONCODE as Integer
versionName "4.42.0"
versionName "4.42.2"
vectorDrawables.useSupportLibrary = true
if (!isFoss) {
manifestPlaceholders = [BugsnagAPIKey: BugsnagAPIKey as String]

View File

@ -10,6 +10,7 @@ import { store } from '../store/auxStore';
import I18n from '../../i18n';
import { SIGNED_SUPPORTED_VERSIONS_PUBLIC_KEY } from '../constants';
import { getServerById } from '../database/services/Server';
import log from './helpers/log';
interface IServerInfoFailure {
success: false;
@ -75,6 +76,14 @@ export async function getServerInfo(server: string): Promise<TServerInfoResult>
const cloudInfo = await getCloudInfo(server);
// Allows airgapped servers to use the app until enforcementStartDate
if (!cloudInfo) {
return {
...jsonRes,
success: true
};
}
// Makes use of signed JWT to get supported versions
const supportedVersionsCloud = verifyJWT(cloudInfo?.signed);
@ -119,7 +128,12 @@ const getUniqueId = async (server: string): Promise<string> => {
};
export const getCloudInfo = async (domain: string): Promise<TCloudInfo | null> => {
const uniqueId = await getUniqueId(domain);
const response = await getSupportedVersionsCloud(uniqueId, domain);
return response.json() as unknown as TCloudInfo;
try {
const uniqueId = await getUniqueId(domain);
const response = await getSupportedVersionsCloud(uniqueId, domain);
return response.json() as unknown as TCloudInfo;
} catch (e) {
log(e);
return null;
}
};

View File

@ -1760,7 +1760,7 @@
INFOPLIST_FILE = NotificationService/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
MARKETING_VERSION = 4.42.0;
MARKETING_VERSION = 4.42.2;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
OTHER_SWIFT_FLAGS = "$(inherited) -D EXPO_CONFIGURATION_DEBUG";
@ -1799,7 +1799,7 @@
INFOPLIST_FILE = NotificationService/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
MARKETING_VERSION = 4.42.0;
MARKETING_VERSION = 4.42.2;
MTL_FAST_MATH = YES;
OTHER_SWIFT_FLAGS = "$(inherited) -D EXPO_CONFIGURATION_RELEASE";
PRODUCT_BUNDLE_IDENTIFIER = chat.rocket.reactnative.NotificationService;

View File

@ -26,7 +26,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>4.42.0</string>
<string>4.42.2</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>

View File

@ -26,7 +26,7 @@
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>4.42.0</string>
<string>4.42.2</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>KeychainGroup</key>

View File

@ -1,6 +1,6 @@
{
"name": "rocket-chat-reactnative",
"version": "4.42.0",
"version": "4.42.2",
"private": true,
"scripts": {
"start": "react-native start",