1
0
Code Issues Pull Requests Packages Projects Releases Wiki Activity GitHub Gitee
This commit is contained in:
sunnylqm 2024-08-01 11:00:39 +08:00
parent 5e89fb4a25
commit d666e8c0f3
No known key found for this signature in database
3 changed files with 11 additions and 6 deletions

View File

@ -1,6 +1,6 @@
{
"name": "react-native-update",
"version": "10.11.4",
"version": "10.11.5",
"description": "react-native hot update",
"main": "src/index",
"scripts": {

View File

@ -172,7 +172,6 @@ export class Pushy {
return await this.lastRespJson;
}
this.lastChecking = now;
this.report({ type: 'checking' });
const fetchBody = {
packageVersion,
hash: currentVersion,
@ -183,16 +182,21 @@ export class Pushy {
if (__DEV__) {
delete fetchBody.buildTime;
}
const body = JSON.stringify(fetchBody);
const fetchPayload = {
method: 'POST',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify(fetchBody),
body,
};
let resp;
try {
this.report({
type: 'checking',
message: this.options.appKey + ': ' + body,
});
resp = await fetch(this.getCheckUrl(), fetchPayload);
} catch (e: any) {
this.report({
@ -221,6 +225,8 @@ export class Pushy {
const result: CheckResult = await this.lastRespJson;
log('checking result:', result);
if (resp.status !== 200) {
this.report({
type: 'errorChecking',

View File

@ -290,10 +290,9 @@ export const PushyProvider = ({
);
const parseTestQrCode = useCallback(
(code: string) => {
let payload: PushyTestPayload;
(code: string | PushyTestPayload) => {
try {
payload = JSON.parse(code);
const payload = typeof code === 'string' ? JSON.parse(code) : code;
return parseTestPayload(payload);
} catch {
return false;