From 60e347a78290643960c3af55af444f528c0cf988 Mon Sep 17 00:00:00 2001 From: Henry Heino <46334387+personalizedrefrigerator@users.noreply.github.com> Date: Mon, 29 Jul 2024 14:18:16 -0700 Subject: [PATCH 1/2] Android: Fix crash on opening settings on old versions of Android (#10793) --- packages/app-mobile/utils/getVersionInfoText.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/app-mobile/utils/getVersionInfoText.ts b/packages/app-mobile/utils/getVersionInfoText.ts index 11d598647..e4e72d4b7 100644 --- a/packages/app-mobile/utils/getVersionInfoText.ts +++ b/packages/app-mobile/utils/getVersionInfoText.ts @@ -7,10 +7,11 @@ import { _ } from '@joplin/lib/locale'; const getWebViewVersionText = () => { if (Platform.OS === 'android') { - const constants = NativeModules.SystemVersionInformationModule.getConstants(); + // SystemVersionInformationModule is unavailable on older versions of Android. + const constants = NativeModules.SystemVersionInformationModule?.getConstants(); return [ - _('WebView version: %s', constants.webViewVersion), - _('WebView package: %s', constants.webViewPackage), + _('WebView version: %s', constants?.webViewVersion ?? _('Unknown')), + _('WebView package: %s', constants?.webViewPackage ?? _('Unknown')), ].join('\n'); } return null; From a6cf0a3a8100b82e86a18114ae4f5a4976befd3f Mon Sep 17 00:00:00 2001 From: pedr Date: Mon, 5 Aug 2024 15:36:54 -0300 Subject: [PATCH 2/2] Desktop: Fixes #10740: Improve the reliability of fetching resources (#10826) --- packages/lib/shim-init-node.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/lib/shim-init-node.ts b/packages/lib/shim-init-node.ts index 1ed487236..b3d80845f 100644 --- a/packages/lib/shim-init-node.ts +++ b/packages/lib/shim-init-node.ts @@ -590,6 +590,7 @@ function shimInit(options: ShimInitOptions = null) { cleanUpOnError(error); }); + const requestStart = new Date(); // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const request = http.request(requestOptions, (response: any) => { @@ -629,7 +630,10 @@ function shimInit(options: ShimInitOptions = null) { }); request.on('timeout', () => { - request.destroy(new Error(`Request timed out. Timeout value: ${requestOptions.timeout}ms.`)); + // We choose to not destroy the request when a timeout value is not specified to keep + // the behavior we had before the addition of this event handler. + if (!requestOptions.timeout) return; + request.destroy(new Error(`Request timed out. Timeout value: ${requestOptions.timeout}ms. Actual connection time: ${new Date().getTime() - requestStart.getTime()}ms`)); }); // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied