v10.5.3
This commit is contained in:
parent
5996a7aa75
commit
e9e67b011c
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "react-native-update",
|
||||
"version": "10.5.2",
|
||||
"version": "10.5.3",
|
||||
"description": "react-native hot update",
|
||||
"main": "src/index",
|
||||
"scripts": {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { CheckResult, PushyOptions, ProgressData, EventType } from './type';
|
||||
import { log, testUrls } from './utils';
|
||||
import { EmitterSubscription, Platform } from 'react-native';
|
||||
import type { PermissionsAndroidStatic } from 'react-native';
|
||||
import { PermissionsAndroid } from './permissions';
|
||||
import {
|
||||
PushyModule,
|
||||
buildTime,
|
||||
@ -371,8 +371,6 @@ export class Pushy {
|
||||
this.report({ type: 'downloadingApk' });
|
||||
if (Platform.Version <= 23) {
|
||||
try {
|
||||
const PermissionsAndroid =
|
||||
require('react-native/Libraries/PermissionsAndroid/PermissionsAndroid') as PermissionsAndroidStatic;
|
||||
const granted = await PermissionsAndroid.request(
|
||||
PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE,
|
||||
);
|
||||
|
13
src/core.ts
13
src/core.ts
@ -1,5 +1,5 @@
|
||||
import { NativeEventEmitter, NativeModules, Platform } from 'react-native';
|
||||
import { log } from './utils';
|
||||
import { EmptyModule, log } from './utils';
|
||||
const {
|
||||
version: v,
|
||||
} = require('react-native/Libraries/Core/ReactNativeVersion');
|
||||
@ -8,17 +8,6 @@ const isTurboModuleEnabled =
|
||||
// @ts-expect-error
|
||||
global.__turboModuleProxy != null;
|
||||
|
||||
const noop = () => {};
|
||||
class EmptyModule {
|
||||
constructor() {
|
||||
return new Proxy(this, {
|
||||
get() {
|
||||
return noop;
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export const PushyModule =
|
||||
Platform.OS === 'web'
|
||||
? new EmptyModule()
|
||||
|
1
src/permissions.native.ts
Normal file
1
src/permissions.native.ts
Normal file
@ -0,0 +1 @@
|
||||
export { PermissionsAndroid } from 'react-native';
|
4
src/permissions.ts
Normal file
4
src/permissions.ts
Normal file
@ -0,0 +1,4 @@
|
||||
import type { PermissionsAndroidStatic } from 'react-native';
|
||||
import { EmptyModule } from './utils';
|
||||
|
||||
export const PermissionsAndroid = new EmptyModule() as PermissionsAndroidStatic;
|
12
src/utils.ts
12
src/utils.ts
@ -1,8 +1,20 @@
|
||||
import { Platform } from 'react-native';
|
||||
|
||||
export function log(...args: any[]) {
|
||||
console.log('pushy: ', ...args);
|
||||
}
|
||||
|
||||
const noop = () => {};
|
||||
export class EmptyModule {
|
||||
constructor() {
|
||||
return new Proxy(this, {
|
||||
get() {
|
||||
return noop;
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const ping =
|
||||
Platform.OS === 'web'
|
||||
? () => Promise.resolve(true)
|
||||
|
Loading…
Reference in New Issue
Block a user