react-native-update 10.11.1 → 10.11.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-update",
3
- "version": "10.11.1",
3
+ "version": "10.11.3",
4
4
  "description": "react-native hot update",
5
5
  "main": "src/index",
6
6
  "scripts": {
package/src/client.ts CHANGED
@@ -293,7 +293,7 @@ export class Pushy {
293
293
  },
294
294
  );
295
295
  }
296
- let succeeded = false;
296
+ let succeeded = '';
297
297
  this.report({ type: 'downloading' });
298
298
  let lastError: any;
299
299
  const diffUrl = (await testUrls(diffUrls)) || _diffUrl;
@@ -305,11 +305,11 @@ export class Pushy {
305
305
  hash,
306
306
  originHash: currentVersion,
307
307
  });
308
- succeeded = true;
308
+ succeeded = 'diff';
309
309
  } catch (e: any) {
310
310
  lastError = e;
311
311
  if (__DEV__) {
312
- succeeded = true;
312
+ succeeded = 'diff';
313
313
  } else {
314
314
  log(`diff error: ${e.message}, try pdiff`);
315
315
  }
@@ -323,11 +323,11 @@ export class Pushy {
323
323
  updateUrl: pdiffUrl,
324
324
  hash,
325
325
  });
326
- succeeded = true;
326
+ succeeded = 'pdiff';
327
327
  } catch (e: any) {
328
328
  lastError = e;
329
329
  if (__DEV__) {
330
- succeeded = true;
330
+ succeeded = 'pdiff';
331
331
  } else {
332
332
  log(`pdiff error: ${e.message}, try full patch`);
333
333
  }
@@ -341,11 +341,11 @@ export class Pushy {
341
341
  updateUrl: updateUrl,
342
342
  hash,
343
343
  });
344
- succeeded = true;
344
+ succeeded = 'full';
345
345
  } catch (e: any) {
346
346
  lastError = e;
347
347
  if (__DEV__) {
348
- succeeded = true;
348
+ succeeded = 'full';
349
349
  } else {
350
350
  log(`full patch error: ${e.message}`);
351
351
  }
@@ -367,8 +367,13 @@ export class Pushy {
367
367
  throw lastError;
368
368
  }
369
369
  return;
370
+ } else {
371
+ this.report({
372
+ type: 'downloadSuccess',
373
+ data: { newVersion: hash, diff: succeeded },
374
+ });
370
375
  }
371
- log('downloaded hash:', hash);
376
+ log(`downloaded ${succeeded} hash:`, hash);
372
377
  setLocalHashInfo(hash, {
373
378
  name,
374
379
  description,
package/src/provider.tsx CHANGED
@@ -21,7 +21,7 @@ import {
21
21
  } from './core';
22
22
  import { CheckResult, ProgressData, PushyTestPayload } from './type';
23
23
  import { PushyContext } from './context';
24
- import { URLSearchParams } from 'react-native-url-polyfill';
24
+ import { URL } from 'react-native-url-polyfill';
25
25
 
26
26
  export const PushyProvider = ({
27
27
  client,
@@ -307,7 +307,7 @@ export const PushyProvider = ({
307
307
  if (!url) {
308
308
  return;
309
309
  }
310
- const params = new URLSearchParams(url);
310
+ const params = new URL(url).searchParams;
311
311
  const payload = {
312
312
  type: params.get('type'),
313
313
  data: params.get('data'),
package/src/type.ts CHANGED
@@ -28,6 +28,7 @@ export type EventType =
28
28
  | 'errorChecking'
29
29
  | 'checking'
30
30
  | 'downloading'
31
+ | 'downloadSuccess'
31
32
  | 'errorUpdate'
32
33
  | 'markSuccess'
33
34
  | 'downloadingApk'