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

避免在debug模式下调用

This commit is contained in:
sunnylqm
2019-10-04 22:27:33 +08:00
parent c40bf71032
commit 08ac354ba5
3 changed files with 35 additions and 23 deletions

View File

@@ -87,7 +87,7 @@ import _updateConfig from './update.json';
const {appKey} = _updateConfig[Platform.OS];
class MyProject extends Component {
componentWillMount(){
componentDidMount(){
if (isFirstTime) {
Alert.alert('提示', '这是当前版本第一次启动,是否要模拟启动失败?失败将回滚到上一版本', [
{text: '是', onPress: ()=>{throw new Error('模拟启动失败,请重启应用')}},
@@ -109,6 +109,10 @@ class MyProject extends Component {
});
};
checkUpdate = () => {
if (__DEV__) {
// 开发模式不支持热更新,跳过检查
return;
}
checkUpdate(appKey).then(info => {
if (info.expired) {
Alert.alert('提示', '您的应用版本已更新,请前往应用商店下载新的版本', [
@@ -123,7 +127,7 @@ class MyProject extends Component {
]);
}
}).catch(err => {
Alert.alert('提示', '更新失败.');
console.warn(err);
});
};
render() {