1
0
mirror of https://gitcode.com/gh_mirrors/re/react-native-pushy.git synced 2025-11-03 14:53:10 +08:00
Code Issues Packages Projects Releases Wiki Activity GitHub Gitee

Update react-native-update to version 10.32.0 in package.json, refactor error handling in DownloadTask and UpdateContext for improved readability, and enhance type definitions in various files for better TypeScript support.

This commit is contained in:
sunnylqm
2025-09-20 12:07:53 +08:00
parent d3a4007763
commit 5028ce31be
9 changed files with 341 additions and 312 deletions

View File

@@ -16,9 +16,9 @@ import { Pushy, Cresc, sharedState } from './client';
import { currentVersion, packageVersion, getCurrentVersionInfo, currentVersionInfo } from './core';
import {
CheckResult,
MixedCheckResult,
ProgressData,
UpdateTestPayload,
VersionInfo,
} from './type';
import { UpdateContext } from './context';
import { URL } from 'react-native-url-polyfill';
@@ -163,7 +163,7 @@ export const UpdateProvider = ({
return;
}
lastChecking.current = now;
let rootInfo: MixedCheckResult | undefined;
let rootInfo: CheckResult | undefined;
try {
rootInfo = await client.checkUpdate(extra);
} catch (e: any) {
@@ -175,8 +175,8 @@ export const UpdateProvider = ({
if (!rootInfo) {
return;
}
const versions = rootInfo.versions || [rootInfo as CheckResult];
delete rootInfo.versions;
const versions = [rootInfo.expVersion, rootInfo].filter(Boolean) as VersionInfo[];
delete rootInfo.expVersion;
for (const versionInfo of versions) {
const info: CheckResult = {
...versionInfo,
@@ -242,7 +242,7 @@ export const UpdateProvider = ({
alertUpdate(
client.t('alert_title'),
client.t('alert_new_version_found', {
name: info.name,
name: info.name!,
description: info.description,
}),
[