Skip to content

Commit

Permalink
修复上个版本不同设备的绑定码文件重复的问题,检查是否绑定之后,再次检查相应的绑定码文件是否存在,如果不存在提示用户输入绑定码
Browse files Browse the repository at this point in the history
  • Loading branch information
wofwq committed Apr 6, 2022
1 parent 29212d8 commit 54f9008
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 3 deletions.
23 changes: 23 additions & 0 deletions src/api/devicemanagerapi.js
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,29 @@ export function exportBindCode() {
}

}

export function isExistBindCodeFile() {
const response = getUserPath();
if (response.isSuccess) {
//存储路径
const bindCodePath = response.result +getSeid().result+ "bindCode.json"
try {
return {
isSuccess: true,
//返回是否存在当前设备的绑定码文件
result: fs.existsSync(bindCodePath)
}
} catch (error) {
console.log(error)
return {
isSuccess: false,
result: error
}
}
}

}

// module.exports = {
// connect,
// getSeid,
Expand Down
14 changes: 11 additions & 3 deletions src/renderer/views/connectDevice.vue
Original file line number Diff line number Diff line change
Expand Up @@ -377,9 +377,17 @@ export default {
// 跳转到绑定界面
this.$router.push('imKeySetting')
} else if (response === constants.BIND_STATUS_STRING_BOUND_THIS) {
// 成功绑定 继续
this.checkDeviceBindingCode = 3
this.checkIsCreateWallet()
this.$ipcRenderer.send('isExistBindCodeFile')
this.$ipcRenderer.on('isExistBindCodeFile', (isExistBindCodeFileResult) => {
if (isExistBindCodeFileResult.result) {
// 成功绑定 继续
this.checkDeviceBindingCode = 3
this.checkIsCreateWallet()
} else {
// 弹出绑定码输入框,输入绑定码,输入完成后,检查是否创建钱包,重新保存绑定码
this.changeState(7)
}
})
} else {
this.errorInfo = response
this.changeState(4)
Expand Down
4 changes: 4 additions & 0 deletions src/worker/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,10 @@ ipcRenderer.on('message-from-main', (event, arg) => {
response = deviceManger.exportBindCode()
handleType = 'exportBindCode'
}
if (arg.type === 'isExistBindCodeFile') {
response = deviceManger.isExistBindCodeFile()
handleType = 'isExistBindCodeFile'
}
if (arg.type === 'genWalletAddress') {
const coinAddressArray = []
try {
Expand Down

0 comments on commit 54f9008

Please sign in to comment.