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