Skip to content

Commit

Permalink
* Finish backend app update check.
Browse files Browse the repository at this point in the history
  • Loading branch information
MrMYHuang committed Feb 9, 2021
1 parent 7ce1375 commit e1c80d6
Show file tree
Hide file tree
Showing 16 changed files with 316 additions and 17 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,11 @@ https://github.com/MrMYHuang/cbetar2/releases/latest
11. 合成語音選項在Android Chrome無效。( https://stackoverflow.com/a/61366224/631869 )

## <a id='history'>版本歷史</a>
* 2021.02.09:
* PWA 4.23.0:
* [新增] 支援檢查後端app下載進度顯示。
* Backend 13.0.0:
* [新增] 支援檢查後端app更新、下載。
* PWA 4.22.0:
* [新增] 經文頁開啟CBETA Online經文功能。
* PWA 4.21.5:
Expand Down
Empty file.
Empty file.
Empty file.
Empty file.
7 changes: 7 additions & 0 deletions electronBuilderConfigs/deb.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@
"buildElectron/**/*",
"package.json"
],
"extraFiles": [
{
"from": "electronBuilderConfigs",
"to": ".",
"filter": ["IsDeb.txt"]
}
],
"extraResources": [
"buildElectron/*.xsl"
],
Expand Down
5 changes: 5 additions & 0 deletions electronBuilderConfigs/mac.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
"package.json"
],
"extraResources": [
{
"from": "electronBuilderConfigs",
"to": ".",
"filter": ["IsMac.txt"]
},
"buildElectron/*.xsl"
],
"asarUnpack": [
Expand Down
7 changes: 7 additions & 0 deletions electronBuilderConfigs/rpm.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@
"buildElectron/**/*",
"package.json"
],
"extraFiles": [
{
"from": "electronBuilderConfigs",
"to": ".",
"filter": ["IsRpm.txt"]
}
],
"extraResources": [
"buildElectron/*.xsl"
],
Expand Down
6 changes: 5 additions & 1 deletion electronBuilderConfigs/snap.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
"package.json"
],
"extraFiles": [
"electronBuilderConfigs/IsSnap.txt",
{
"from": "electronBuilderConfigs",
"to": ".",
"filter": ["IsSnap.txt"]
}
],
"extraResources": [
"buildElectron/*.xsl"
Expand Down
106 changes: 97 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "cbetar2",
"productName": "電子佛典",
"pwaVersion": "4.22.0",
"version": "12.0.1",
"pwaVersion": "4.23.0",
"version": "13.0.0",
"license": "MIT",
"keywords": [
"CBETA",
Expand Down Expand Up @@ -49,8 +49,12 @@
"extends": "react-app"
},
"dependencies": {
"@types/semver": "^7.3.4",
"axios": "^0.21.1",
"electron-window-state": "^5.0.3",
"libxslt-myh": "^0.9.7"
"libxslt-myh": "^0.9.7",
"node-downloader-helper": "^1.0.17",
"semver": "^7.3.4"
},
"devDependencies": {
"@ionic/react": "^5.5.3",
Expand All @@ -68,7 +72,6 @@
"@types/react-router": "^5.1.8",
"@types/react-router-dom": "^5.1.6",
"@types/uuid": "^8.3.0",
"axios": "^0.21.1",
"customize-cra": "^1.0.0",
"electron": "^11.2.1",
"electron-builder": "^22.9.1",
Expand Down
17 changes: 17 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import DictionaryPage from './pages/DictionaryPage';
import FullTextSearchPage from './pages/FullTextSearchPage';
import ShareTextModal from './components/ShareTextModal';
import WordDictionaryPage from './pages/WordDictionaryPage';
import DownloadModal from './components/DownloadModal';

const electronBackendApi: any = (window as any).electronBackendApi;

Expand Down Expand Up @@ -97,6 +98,7 @@ interface State {
toastMessage: string;
showUpdateAlert: boolean;
showRestoreAppSettingsToast: boolean;
downloadModal: any;
}

class _App extends React.Component<PageProps> {
Expand Down Expand Up @@ -135,6 +137,12 @@ class _AppOrig extends React.Component<AppOrigProps, State> {
val: data.isOn,
});
break;
case 'DownloadingBackend':
this.setState({ downloadModal: { show: true, progress: data.progress / 100 } });
break;
case 'DownloadingBackendDone':
this.setState({ downloadModal: { show: false, progress: this.state.downloadModal.progress } });
break;
}
});
electronBackendApi?.send("toMain", { event: 'ready' });
Expand Down Expand Up @@ -183,6 +191,7 @@ class _AppOrig extends React.Component<AppOrigProps, State> {
showRestoreAppSettingsToast: (queryParams.settings != null && this.originalAppSettingsStr != null) || false,
showToast: false,
toastMessage: '',
downloadModal: { progress: 0, show: false }
};

serviceWorkCallbacks.onUpdate = (registration: ServiceWorkerRegistration) => {
Expand Down Expand Up @@ -385,6 +394,14 @@ class _AppOrig extends React.Component<AppOrigProps, State> {
}}
/>

<DownloadModal
{...{
progress: this.state.downloadModal.progress,
showModal: this.state.downloadModal.show,
...this.props
}}
/>

<IonToast
cssClass='uiFont'
isOpen={this.state.showRestoreAppSettingsToast}
Expand Down
Loading

0 comments on commit e1c80d6

Please sign in to comment.