react-native-update 10.5.2 → 10.5.4
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 +1 -1
- package/src/client.ts +5 -5
- package/src/core.ts +2 -13
- package/src/permissions.native.ts +1 -0
- package/src/permissions.ts +4 -0
- package/src/provider.tsx +3 -0
- package/src/utils.ts +13 -0
package/package.json
CHANGED
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
|
|
4
|
+
import { PermissionsAndroid } from './permissions';
|
|
5
5
|
import {
|
|
6
6
|
PushyModule,
|
|
7
7
|
buildTime,
|
|
@@ -50,8 +50,10 @@ export class Pushy {
|
|
|
50
50
|
version = cInfo.pushy;
|
|
51
51
|
|
|
52
52
|
constructor(options: PushyOptions) {
|
|
53
|
-
if (
|
|
54
|
-
|
|
53
|
+
if (Platform.OS === 'ios' || Platform.OS === 'android') {
|
|
54
|
+
if (!options.appKey) {
|
|
55
|
+
throw new Error('appKey is required');
|
|
56
|
+
}
|
|
55
57
|
}
|
|
56
58
|
this.setOptions(options);
|
|
57
59
|
}
|
|
@@ -371,8 +373,6 @@ export class Pushy {
|
|
|
371
373
|
this.report({ type: 'downloadingApk' });
|
|
372
374
|
if (Platform.Version <= 23) {
|
|
373
375
|
try {
|
|
374
|
-
const PermissionsAndroid =
|
|
375
|
-
require('react-native/Libraries/PermissionsAndroid/PermissionsAndroid') as PermissionsAndroidStatic;
|
|
376
376
|
const granted = await PermissionsAndroid.request(
|
|
377
377
|
PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE,
|
|
378
378
|
);
|
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,20 +8,9 @@ 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
|
+
? emptyModule
|
|
25
14
|
: isTurboModuleEnabled
|
|
26
15
|
? require('./NativePushy').default
|
|
27
16
|
: NativeModules.Pushy;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PermissionsAndroid } from 'react-native';
|
package/src/provider.tsx
CHANGED
package/src/utils.ts
CHANGED
|
@@ -1,8 +1,21 @@
|
|
|
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
|
+
class EmptyModule {
|
|
9
|
+
constructor() {
|
|
10
|
+
return new Proxy(this, {
|
|
11
|
+
get() {
|
|
12
|
+
return noop;
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export const emptyModule = new EmptyModule();
|
|
18
|
+
|
|
6
19
|
const ping =
|
|
7
20
|
Platform.OS === 'web'
|
|
8
21
|
? () => Promise.resolve(true)
|