mirror of
https://gitcode.com/gh_mirrors/re/react-native-pushy.git
synced 2025-09-16 10:51:38 +08:00
chore: cleanup
This commit is contained in:
@@ -125,7 +125,6 @@ export const cInfo = {
|
||||
};
|
||||
|
||||
function assertRelease() {
|
||||
// @ts-expect-error
|
||||
if (__DEV__) {
|
||||
throw new Error('react-native-update 只能在 RELEASE 版本中运行.');
|
||||
}
|
||||
|
@@ -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;
|
||||
|
Reference in New Issue
Block a user