react-native-update 10.5.2 → 10.5.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.5.2",
3
+ "version": "10.5.3",
4
4
  "description": "react-native hot update",
5
5
  "main": "src/index",
6
6
  "scripts": {
package/src/client.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { CheckResult, PushyOptions, ProgressData, EventType } from './type';
2
2
  import { log, testUrls } from './utils';
3
3
  import { EmitterSubscription, Platform } from 'react-native';
4
- import type { PermissionsAndroidStatic } from 'react-native';
4
+ import { PermissionsAndroid } from './permissions';
5
5
  import {
6
6
  PushyModule,
7
7
  buildTime,
@@ -371,8 +371,6 @@ export class Pushy {
371
371
  this.report({ type: 'downloadingApk' });
372
372
  if (Platform.Version <= 23) {
373
373
  try {
374
- const PermissionsAndroid =
375
- require('react-native/Libraries/PermissionsAndroid/PermissionsAndroid') as PermissionsAndroidStatic;
376
374
  const granted = await PermissionsAndroid.request(
377
375
  PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE,
378
376
  );
package/src/core.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { NativeEventEmitter, NativeModules, Platform } from 'react-native';
2
- import { log } from './utils';
2
+ import { EmptyModule, log } from './utils';
3
3
  const {
4
4
  version: v,
5
5
  } = require('react-native/Libraries/Core/ReactNativeVersion');
@@ -8,17 +8,6 @@ const isTurboModuleEnabled =
8
8
  // @ts-expect-error
9
9
  global.__turboModuleProxy != null;
10
10
 
11
- const noop = () => {};
12
- class EmptyModule {
13
- constructor() {
14
- return new Proxy(this, {
15
- get() {
16
- return noop;
17
- },
18
- });
19
- }
20
- }
21
-
22
11
  export const PushyModule =
23
12
  Platform.OS === 'web'
24
13
  ? new EmptyModule()
@@ -0,0 +1 @@
1
+ export { PermissionsAndroid } from 'react-native';
@@ -0,0 +1,4 @@
1
+ import type { PermissionsAndroidStatic } from 'react-native';
2
+ import { EmptyModule } from './utils';
3
+
4
+ export const PermissionsAndroid = new EmptyModule() as PermissionsAndroidStatic;
package/src/utils.ts CHANGED
@@ -1,8 +1,20 @@
1
1
  import { Platform } from 'react-native';
2
+
2
3
  export function log(...args: any[]) {
3
4
  console.log('pushy: ', ...args);
4
5
  }
5
6
 
7
+ const noop = () => {};
8
+ export class EmptyModule {
9
+ constructor() {
10
+ return new Proxy(this, {
11
+ get() {
12
+ return noop;
13
+ },
14
+ });
15
+ }
16
+ }
17
+
6
18
  const ping =
7
19
  Platform.OS === 'web'
8
20
  ? () => Promise.resolve(true)