Skip to content

Commit 7814184

Browse files
committed
create new branch of feature/electron
1 parent c7fb79c commit 7814184

File tree

5 files changed

+122
-819
lines changed

5 files changed

+122
-819
lines changed

.github/workflows/release-publish.yml

Lines changed: 3 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
on:
22
push:
33
branches:
4-
- v2.0.10
4+
- feature/electron
55
pull_request:
66
branches:
7-
- v2.0.10
7+
- feature/electron
88
jobs:
99
release-windows:
1010
runs-on: windows-latest
@@ -24,44 +24,12 @@ jobs:
2424

2525
- name: Build/release Electron app
2626
uses: samuelmeuli/action-electron-builder@v1
27-
env:
28-
BRANCH: v2.0.10
2927
with:
3028
# GitHub token, automatically provided to the action
3129
# (No need to define this secret in the repo settings)
3230
github_token: ${{ secrets.github_token }}
33-
build_script_name: packElectron:win
31+
build_script_name: releaseElectron:win
3432

3533
# If the commit is tagged with a version (e.g. "v1.0.0"),
3634
# release the app after building
3735
release: ${{ startsWith(github.ref, 'refs/tags/v') }}
38-
39-
# release-mac:
40-
# runs-on: ${{ matrix.os }}
41-
#
42-
# strategy:
43-
# matrix:
44-
# os: macos-latest
45-
#
46-
# steps:
47-
# - name: Check out Git repository
48-
# uses: actions/checkout@v1
49-
#
50-
# - name: Install Node.js, NPM and Yarn
51-
# uses: actions/setup-node@v1
52-
# with:
53-
# node-version: 10
54-
#
55-
# - name: Build/release Electron app
56-
# uses: samuelmeuli/action-electron-builder@v1
57-
# env:
58-
# BRANCH: v2.0.10
59-
# with:
60-
# # GitHub token, automatically provided to the action
61-
# # (No need to define this secret in the repo settings)
62-
# github_token: ${{ secrets.github_token }}
63-
# build_script_name: packElectron:mac
64-
#
65-
# # If the commit is tagged with a version (e.g. "v1.0.0"),
66-
# # release the app after building
67-
# release: ${{ startsWith(github.ref, 'refs/tags/v') }}

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"main": "packages/apps-electron/build/electron.js",
55
"description": "An Apps portal into the Polkadot network",
66
"author": "chainx-org",
7-
"version": "2.1.4",
7+
"version": "2.1.5",
88
"license": "Apache-2",
99
"private": true,
1010
"homepage": ".",
@@ -43,7 +43,8 @@
4343
"build:electronMain": "cd packages/apps-electron && NODE_ENV=production webpack --config webpack.main.config.js",
4444
"packElectron:test": "yarn build:release:electron && electron-builder --dir",
4545
"packElectron:mac": "yarn build:release:electron && electron-builder build --mac",
46-
"packElectron:win": "yarn build:release:electron && yarn clean:electronRelease && electron-builder build --win -p always",
46+
"packElectron:win": "yarn build:release:electron && electron-builder build --win",
47+
"releaseElectron:win": "yarn build:release:electron && yarn clean:electronRelease && electron-builder build --win -p always",
4748
"packElectron:linux": "yarn build:release:electron && electron-builder build --linux",
4849
"packElectron": "yarn build:release:electron && yarn clean:electronRelease && electron-builder build -mwl",
4950
"docs": "echo \"skipping docs\"",

packages/apps-electron/src/electron/window.ts

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -28,29 +28,33 @@ export function createWindow(environment: string): Promise<unknown> {
2828

2929

3030
async function getRelease() {
31-
const {data} = await axios.get('https://api.github.com/repos/chainx-org/chainx-dapp-wallet-v2/releases/latest');
32-
const fileNameList: string[] = await data.assets.map((file: any) => file.name);
33-
const fileNameToDownload: string | string[] = await fileNameList.filter((fileName: string) => (fileName.indexOf('.exe') !== -1 || fileName.indexOf('.dmg') !== -1) && fileName.indexOf('.blockmap') === -1);
34-
const filesToDownload = await data.assets.filter((file: any) => file.name === fileNameToDownload[0] || file.name === fileNameToDownload[1]);
35-
const latestVersion = data.tag_name.slice(1)
36-
const fileOfWin = filesToDownload.find((file: any) => file.name.indexOf('.exe') !== -1)
37-
const fileOfMac = filesToDownload.find((file: any) => file.name.indexOf('.dmg') !== -1)
38-
39-
if (packageJson.version !== latestVersion) {
40-
41-
require('electron')
42-
.dialog
43-
.showMessageBox(win, {
44-
title: '温馨提示',
45-
message: `您访问的版本不是最新版本哦,如果可以,请使用我们的最新版本,点击下方按钮进入下载页面:`,
46-
buttons: ['mac 下载入口', 'windows 下载入口']
47-
}).then((index) => {
48-
if (index.response === 0) {
49-
shell.openExternal(fileOfWin.browser_download_url);
50-
} else if (index.response === 1) {
51-
shell.openExternal(fileOfMac.browser_download_url);
52-
}
53-
});
31+
try{
32+
const {data} = await axios.get('https://api.github.com/repos/chainx-org/chainx-dapp-wallet-v2/releases/latest');
33+
const fileNameList: string[] = await data.assets.map((file: any) => file.name);
34+
const fileNameToDownload: string | string[] = await fileNameList.filter((fileName: string) => (fileName.indexOf('.exe') !== -1 || fileName.indexOf('.dmg') !== -1) && fileName.indexOf('.blockmap') === -1);
35+
const filesToDownload = await data.assets.filter((file: any) => file.name === fileNameToDownload[0] || file.name === fileNameToDownload[1]);
36+
const latestVersion = data.tag_name.slice(1)
37+
const fileOfWin = filesToDownload.find((file: any) => file.name.indexOf('.exe') !== -1)
38+
const fileOfMac = filesToDownload.find((file: any) => file.name.indexOf('.dmg') !== -1)
39+
40+
if (packageJson.version !== latestVersion) {
41+
42+
require('electron')
43+
.dialog
44+
.showMessageBox(win, {
45+
title: '温馨提示',
46+
message: `您访问的版本不是最新版本哦,如果可以,请使用我们的最新版本,点击下方按钮进入下载页面:`,
47+
buttons: ['mac 下载入口', 'windows 下载入口']
48+
}).then((index) => {
49+
if (index.response === 0) {
50+
shell.openExternal(fileOfWin.browser_download_url);
51+
} else if (index.response === 1) {
52+
shell.openExternal(fileOfMac.browser_download_url);
53+
}
54+
});
55+
}
56+
}catch (err) {
57+
console.log(err)
5458
}
5559
}
5660

packages/apps/public/locales/zh/translation.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1605,6 +1605,10 @@
16051605
"Chinese Node": "中国节点",
16061606
"Overseas Node": "海外节点",
16071607
"Test Node": "测试节点",
1608+
"Prompt": "温馨提示",
1609+
"The version you are visiting is not the latest version. If you can, please use our latest version and click the button below to enter the download page:": "您访问的版本不是最新版本哦,如果可以,请使用我们的最新版本,点击下方按钮进入下载页面:",
1610+
"Download entry of mac": "mac 下载入口",
1611+
"Download entry of windows": "windows 下载入口",
16081612
"{{balance}} voted": "{{balance}} 投票",
16091613
"{{blocks}} blocks": "{{blocks}} 区块",
16101614
"{{count}} key/value pairs encoded for submission": "{{count}}为提交而编码的密钥/值对",

0 commit comments

Comments
 (0)