1
0
mirror of https://gitcode.com/gh_mirrors/re/react-native-pushy.git synced 2025-09-16 10:51:38 +08:00
Code Issues Packages Projects Releases Wiki Activity GitHub Gitee

chore: cleanup

This commit is contained in:
sunnylqm
2023-09-02 22:40:55 +08:00
parent 6d01ce5152
commit 094eb3f267
2 changed files with 11 additions and 6 deletions

View File

@@ -125,7 +125,6 @@ export const cInfo = {
};
function assertRelease() {
// @ts-expect-error
if (__DEV__) {
throw new Error('react-native-update 只能在 RELEASE 版本中运行.');
}

View File

@@ -1,5 +1,11 @@
import React, { PureComponent } from 'react';
import { Platform, Alert, Linking, AppState } from 'react-native';
import React, { PureComponent, ComponentType } from 'react';
import {
Platform,
Alert,
Linking,
AppState,
NativeEventSubscription,
} from 'react-native';
import {
isFirstTime,
@@ -15,7 +21,7 @@ import {
import { UpdateEventsListener } from './type';
export function simpleUpdate(
WrappedComponent: JSX.Element,
WrappedComponent: ComponentType,
options: { appKey?: string; onEvents?: UpdateEventsListener } = {},
) {
const { appKey, onEvents: eventListeners } = options;
@@ -25,10 +31,10 @@ export function simpleUpdate(
if (typeof eventListeners === 'function') {
onEvents(eventListeners);
}
// @ts-expect-error
return __DEV__
? WrappedComponent
: class AppUpdate extends PureComponent {
stateListener: NativeEventSubscription;
componentDidMount() {
if (isRolledBack) {
Alert.alert('抱歉', '刚刚更新遭遇错误,已为您恢复到更新前版本');
@@ -79,7 +85,7 @@ export function simpleUpdate(
checkUpdate = async () => {
let info;
try {
info = await checkUpdate(appKey);
info = await checkUpdate(appKey!);
} catch (err) {
Alert.alert('更新检查失败', err.message);
return;