mirror of
https://gitcode.com/gh_mirrors/re/react-native-pushy.git
synced 2025-11-02 06:13:11 +08:00
fix: return type
This commit is contained in:
@@ -132,7 +132,7 @@ function assertRelease() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let lastChecking = Date.now();
|
let lastChecking = Date.now();
|
||||||
let lastResult: CheckResult;
|
let lastResult: CheckResult = {};
|
||||||
export async function checkUpdate(APPKEY: string, isRetry?: boolean) {
|
export async function checkUpdate(APPKEY: string, isRetry?: boolean) {
|
||||||
assertRelease();
|
assertRelease();
|
||||||
const now = Date.now();
|
const now = Date.now();
|
||||||
@@ -148,7 +148,7 @@ export async function checkUpdate(APPKEY: string, isRetry?: boolean) {
|
|||||||
blockUpdate.until * 1000,
|
blockUpdate.until * 1000,
|
||||||
).toLocaleString()}"之后重试。`,
|
).toLocaleString()}"之后重试。`,
|
||||||
});
|
});
|
||||||
return;
|
return lastResult;
|
||||||
}
|
}
|
||||||
report({ type: 'checking' });
|
report({ type: 'checking' });
|
||||||
let resp;
|
let resp;
|
||||||
@@ -172,12 +172,13 @@ export async function checkUpdate(APPKEY: string, isRetry?: boolean) {
|
|||||||
type: 'errorChecking',
|
type: 'errorChecking',
|
||||||
message: '无法连接更新服务器,请检查网络连接后重试',
|
message: '无法连接更新服务器,请检查网络连接后重试',
|
||||||
});
|
});
|
||||||
return;
|
return lastResult;
|
||||||
}
|
}
|
||||||
await tryBackupEndpoints();
|
await tryBackupEndpoints();
|
||||||
return checkUpdate(APPKEY, true);
|
return checkUpdate(APPKEY, true);
|
||||||
}
|
}
|
||||||
const result: CheckResult = await resp.json();
|
const result: CheckResult = await resp.json();
|
||||||
|
|
||||||
lastResult = result;
|
lastResult = result;
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
checkOperation(result.op);
|
checkOperation(result.op);
|
||||||
@@ -188,7 +189,7 @@ export async function checkUpdate(APPKEY: string, isRetry?: boolean) {
|
|||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
message: result.message,
|
message: result.message,
|
||||||
});
|
});
|
||||||
return;
|
return lastResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@@ -26,7 +26,8 @@ export interface UpdateAvailableResult {
|
|||||||
export type CheckResult =
|
export type CheckResult =
|
||||||
| ExpiredResult
|
| ExpiredResult
|
||||||
| UpTodateResult
|
| UpTodateResult
|
||||||
| UpdateAvailableResult;
|
| UpdateAvailableResult
|
||||||
|
| {};
|
||||||
|
|
||||||
export interface ProgressData {
|
export interface ProgressData {
|
||||||
hash: string;
|
hash: string;
|
||||||
|
|||||||
Reference in New Issue
Block a user