소스 검색

[升级][修改]:优化升级组件使用方式

tags/jenkins-front-end-screenad-195-v109^0
hupeng 5 년 전
부모
커밋
54a4b19998
1개의 변경된 파일9개의 추가작업 그리고 1개의 파일을 삭제
  1. +9
    -1
      App.js

+ 9
- 1
App.js 파일 보기

@@ -121,7 +121,7 @@ async codePushUpdate() {
this.codePushStatusDidChange.bind(this),
this.codePushDownloadDidProgress.bind(this)
).then((status: SyncStatus) => {
console.warn(status);
}, (error: any) => {
CodePush.restartApp();
});
@@ -132,28 +132,36 @@ async codePushUpdate() {
codePushStatusDidChange(syncStatus) {
switch(syncStatus) {
case CodePush.SyncStatus.CHECKING_FOR_UPDATE:
console.warn("检查更新");
this.setState({ syncMessage: "检查更新" });
break;
case CodePush.SyncStatus.DOWNLOADING_PACKAGE:
console.warn("下载更新");
this.setState({ syncMessage: "下载更新" });
break;
case CodePush.SyncStatus.AWAITING_USER_ACTION:
console.warn("等待用户操作");
this.setState({ syncMessage: "等待用户操作" });
break;
case CodePush.SyncStatus.INSTALLING_UPDATE:
console.warn("安装更新");
this.setState({ syncMessage: "安装更新" });
break;
case CodePush.SyncStatus.UP_TO_DATE:
console.warn("已更新到最新程序");
this.setState({ syncMessage: "已更新到最新程序", updating: false });
break;
case CodePush.SyncStatus.UPDATE_IGNORED:
console.warn("更新被取消");
this.setState({ syncMessage: "更新被取消", updating: false });
break;
case CodePush.SyncStatus.UPDATE_INSTALLED:
console.warn("更新已安装,重启应用后生效");
this.setState({ syncMessage: "更新已安装,重启应用后生效", updating: false });
CodePush.restartApp();
break;
case CodePush.SyncStatus.UNKNOWN_ERROR:
console.warn("未知错误");
this.setState({ syncMessage: "未知错误", updating: false });
break;
}


불러오는 중...
취소
저장