Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修复Manager相关问题 #41

Open
wants to merge 2 commits into
base: feature/dapp
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "imKeyManager",
"version": "2.0.0-beta",
"version": "2.0.1-beta",
"author": "imkey <[email protected]>",
"description": "imKey Manager @2020",
"license": "MIT",
Expand Down Expand Up @@ -160,11 +160,11 @@
"del": "^6.0.0",
"devtron": "^1.4.0",
"electron": "^11.3.0",
"electron-builder": "22.9.1",
"electron-builder": "22.14.5",
"electron-debug": "^3.2.0",
"electron-devtools-installer": "^3.1.1",
"electron-devtools-installer": "^3.2.0",
"electron-download": "^4.1.1",
"electron-notarize": "^1.0.0",
"electron-notarize": "^1.1.1",
"eslint": "^7.21.0",
"eslint-config-standard": "^16.0.2",
"eslint-friendly-formatter": "^4.0.1",
Expand Down
27 changes: 25 additions & 2 deletions src/api/devicemanagerapi.js
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ export function importBindCode(bindCode) {
const response = getUserPath();
if (response.isSuccess) {
//存储路径
const bindCodePath = response.result + "bindCode.json"
const bindCodePath = response.result +getSeid().result+ "bindCode.json"
//加密绑定码
const enBindCode ={
bindCode:crypto.encryptData(bindCode.toUpperCase(), process.env.bindCode_encryptionKey)
Expand All @@ -422,7 +422,7 @@ export function exportBindCode() {
const response = getUserPath();
if (response.isSuccess) {
//存储路径
const bindCodePath = response.result + "bindCode.json"
const bindCodePath = response.result +getSeid().result+ "bindCode.json"
try {
const data = fs.readFileSync(bindCodePath, 'utf-8')
const dataString = data.toString()// 将二进制的数据转换为字符串
Expand All @@ -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
19 changes: 14 additions & 5 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 Expand Up @@ -427,9 +435,10 @@ export default {
this.$router.push('imKeySetting')
}
} else {
this.$router.push('imKeySetting')
// 错误界面
this.errorInfo = response
this.changeState(4)
// this.errorInfo = response
// this.changeState(4)
this.$sa.track('im_landing_connect$error', { name: 'landingConnectError', message: '检查是否创建wallet失败:' + response })
}
})
Expand Down
36 changes: 22 additions & 14 deletions src/renderer/views/imKeySetting.vue
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@
</div>
<div class="btnBox">
<p class="codeTit" v-if="checkWalletTip" style="display:inline-block;float: left;"><span class="el-icon-warning"></span>{{$t('m.imKeyManager.done_setting_select_next')}}</p>
<button class="nextBtn" @click="send({page:4,active:2,isNext:true})">下一步</button>
<button class="prevBtn" @click="send({page:2,active:0,isNext:false})">上一步</button>
<button class="nextBtn" @click="send({page:4,active:2,isNext:true})">{{$t('m.imKeyManager.next')}}</button>
<button class="prevBtn" @click="send({page:2,active:0,isNext:false})">{{$t('m.imKeyManager.previous')}}</button>
</div>
</div>
<div class="set4" v-if="page==4">
Expand Down Expand Up @@ -371,9 +371,17 @@ export default {
this.$ipcRenderer.send('connectDevice')
this.$ipcRenderer.on('connectDevice', (connectResult) => {
if (connectResult.isSuccess) {
// 去首页
this.$router.push('/home/welcomeHome')
this.$sa.track('im_onboarding_complete$finish', { name: 'onboardingCompleteClick', to: 'im_homepage' })
// 读取ETH和DOT和KSM的地址
this.$ipcRenderer.send('genWalletAddress', { filePath: this.userPath })
this.$ipcRenderer.on('genWalletAddress', (result) => {
const response = result.result
if (result.isSuccess) {
this.$store.state.WalletAddress = response
// 去首页
this.$router.push('/home/welcomeHome')
this.$sa.track('im_onboarding_complete$finish', { name: 'onboardingCompleteClick', to: 'im_homepage' })
}
})
} else {
console.log('none')
}
Expand All @@ -399,15 +407,15 @@ export default {
// 连接设备,
// 检查是否激活,如果未激活,就激活。
// 检查是否绑定,如果未绑定,就再imkey上显示绑定码
this.$ipcRenderer.send('connectDevice')
this.$ipcRenderer.on('connectDevice', (connectResult) => {
if (connectResult.isSuccess) {
this.active = active
this.page = page
} else {
// 检查绑定失败
}
})
// this.$ipcRenderer.send('connectDevice')
// this.$ipcRenderer.on('connectDevice', (connectResult) => {
// if (connectResult.isSuccess) {
this.active = active
this.page = page
// } else {
// // 检查绑定失败
// }
// })
}
if (page === 3 && isNext === true) {
// 连接设备,
Expand Down
6 changes: 5 additions & 1 deletion 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 Expand Up @@ -365,7 +369,7 @@ ipcRenderer.on('message-from-main', (event, arg) => {
}
if (coinNameArr[i] === 'NERVOS') {
// response = walletApi.registerCKBAddress({
// path: "m/44'/1279'/0'/0/0"
// path: "m/44'/309'/0'/0/0"
// })
// if (!response.isSuccess) {
// response = {
Expand Down
Loading