Skip to content

Commit

Permalink
v10.11.5
Browse files Browse the repository at this point in the history
  • Loading branch information
sunnylqm committed Aug 1, 2024
1 parent 5e89fb4 commit d666e8c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
10 changes: 8 additions & 2 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ export class Pushy {
return await this.lastRespJson;
}
this.lastChecking = now;
this.report({ type: 'checking' });
const fetchBody = {
packageVersion,
hash: currentVersion,
Expand All @@ -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({
Expand Down Expand Up @@ -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',
Expand Down
5 changes: 2 additions & 3 deletions src/provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit d666e8c

Please sign in to comment.