mirror of
https://gitcode.com/gh_mirrors/re/react-native-pushy.git
synced 2025-10-30 04:43:11 +08:00
support multiple versions
This commit is contained in:
@@ -91,7 +91,8 @@ export class Pushy {
|
||||
options = defaultClientOptions;
|
||||
clientType: 'Pushy' | 'Cresc' = 'Pushy';
|
||||
lastChecking?: number;
|
||||
lastRespJson?: Promise<any>;
|
||||
lastRespJson?: Promise<CheckResult>;
|
||||
lastRespText?: Promise<string>;
|
||||
|
||||
version = cInfo.rnu;
|
||||
loggerPromise = (() => {
|
||||
@@ -294,20 +295,23 @@ export class Pushy {
|
||||
this.throwIfEnabled(new Error('errorChecking'));
|
||||
return this.lastRespJson ? await this.lastRespJson : emptyObj;
|
||||
}
|
||||
|
||||
if (resp.status !== 200) {
|
||||
const errorMessage = `${resp.status}: ${resp.statusText}`;
|
||||
this.report({
|
||||
type: 'errorChecking',
|
||||
message: errorMessage,
|
||||
});
|
||||
this.throwIfEnabled(new Error(errorMessage));
|
||||
log('error checking response:', resp.status, await resp.text());
|
||||
return this.lastRespJson ? await this.lastRespJson : emptyObj;
|
||||
}
|
||||
this.lastRespJson = resp.json();
|
||||
|
||||
const result: CheckResult = await this.lastRespJson;
|
||||
|
||||
log('checking result:', result);
|
||||
|
||||
if (resp.status !== 200) {
|
||||
this.report({
|
||||
type: 'errorChecking',
|
||||
message: result.message,
|
||||
});
|
||||
this.throwIfEnabled(new Error(result.message));
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
getBackupEndpoints = async () => {
|
||||
|
||||
Reference in New Issue
Block a user