Skip to content

Commit

Permalink
feat:add ble firmware update feature (#55)
Browse files Browse the repository at this point in the history
* feat: integrated bluetooth firmware upgrade function

* feat: add ble version display feat

* feat: add ble version display

* feat:optimization ble update prompt message

* feat:zh.js add imKey_manager_is_desktop_manager info

* fix: fix bug in cos upgrade process

* fix: fix write wallet address bug

* build: modify version number

* feat: modify ble update prompt message

* feat: ble upgrade function process optimization

* fix: modify checkUpdate to getInstallApplets

* fea: modification of ble firmware upgrade prompt method

* feat: optimize ble upgrade prompt information

* build: modify version number to 2.1.5-beta

* build: update connector.dll library

* feat: modify ble upgrade prompt icon

* fix: fixed the problem of being unable to download updates

* chore: optimization wechat display
  • Loading branch information
xiaoguang1010 authored Dec 21, 2023
1 parent 5ead24d commit 26daf90
Show file tree
Hide file tree
Showing 16 changed files with 594 additions and 534 deletions.
Binary file modified connector.dll
Binary file not shown.
Binary file modified connector.dylib
100644 → 100755
Binary file not shown.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "imKeyManager",
"version": "2.0.1-beta",
"version": "2.1.5-beta",
"author": "imkey <weiqiang@imkey.im>",
"description": "imKey Manager @2020",
"license": "MIT",
Expand Down Expand Up @@ -35,7 +35,7 @@
"url": "https://files.imkey.im/downloads/imKeyManager"
},
"releaseInfo": {
"releaseNotes": "[{id:1,info:\"解决卡死问题\"},{id:2,info:\"优化UI问题\"},{id:3,info:\"修改安装应用时的提示显示问题\"},{id:4,info:\"修改连接设备的问题\"},{id:5,info:\"解决公证的问题\"}]"
"releaseNotes": "[{id:1,info:\"新增蓝牙固件更新功能\"},{id:2,info:\"增加蓝牙固件版本显示\"},{id:3,info:\"删除DApp选项卡\"}]"
},
"files": [
"dist/electron/**/*"
Expand Down Expand Up @@ -160,7 +160,7 @@
"del": "^6.0.0",
"devtron": "^1.4.0",
"electron": "^11.3.0",
"electron-builder": "22.14.5",
"electron-builder": "24.6.4",
"electron-debug": "^3.2.0",
"electron-devtools-installer": "^3.2.0",
"electron-download": "^4.1.1",
Expand Down
45 changes: 45 additions & 0 deletions src/api/devicemanagerapi.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ function getDeviceManageFunction(method_) {
} else if (method_ === 'get_firmware_version') {
const response = new devicePb.GetFirmwareVersionRes.deserializeBinary(hexStr2Bytes(resBuffer))
result = response.getFirmwareVersion()
} else if (method_ === 'get_ble_version') {
const response = new devicePb.GetBleVersionRes.deserializeBinary(hexStr2Bytes(resBuffer))
result = response.getBleVersion()
} else if (method_ === 'get_sdk_info') {
const response = new devicePb.GetSdkInfoRes.deserializeBinary(hexStr2Bytes(resBuffer))
result = response.getSdkVersion()
Expand Down Expand Up @@ -293,6 +296,33 @@ export function checkUpdateAppList() {
}
}

export function getInstalledAppletList() {
try {
const response = getDeviceManageFunction('check_update')
const collections = response.result.availableAppListList
const list = []
for (let i = 0; i < collections.length; i++) {
if (collections[i].installedVersion !== 'none' && collections[i].installedVersion !== null && collections[i].appName !== 'IMK') {
const collection = {
name: collections[i].appName,
}
list.push(collection)
}
}
const total = list.length
const status = response.result.status
return {
isSuccess: true,
result: _.cloneDeep({status: status, total: total, list: list})
}
} catch (err) {
return {
isSuccess: false,
result: err
}
}
}

export function getSeid() {
return getDeviceManageFunction('get_seid')
}
Expand Down Expand Up @@ -331,6 +361,21 @@ export function getFirmwareVersion() {
}
}

export function getBleVersion() {
const response = getDeviceManageFunction('get_ble_version')
if (response.isSuccess) {
return {
isSuccess: true,
result: response.result
}
} else {
return {
isSuccess: false,
result: response.result
}
}
}

export function getSdkInfo() {
return getDeviceManageFunction('get_sdk_info')
}
Expand Down
2 changes: 1 addition & 1 deletion src/common/constants.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// sdk version
const sdkVersion = '2.3.0'
const sdkVersion = '2.10.3'
// serverurl
// const serverUrl = 'https://imkeyserver.com:10444/imkey'
const serverUrl = 'https://imkey.online:1000/imkey'
Expand Down
7 changes: 4 additions & 3 deletions src/proto/device.proto
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,10 @@ message CosCheckUpdateRes {
string seid = 1;
bool is_latest = 2;
string latest_cos_version = 3;
string update_type = 4;
string description = 5;
bool is_update_success = 6;
string latest_ble_version = 4;
string update_type = 5;
string description = 6;
bool is_update_success = 7;
}

message IsBlStatusRes {
Expand Down
63 changes: 46 additions & 17 deletions src/proto/device_pb.js
Original file line number Diff line number Diff line change
Expand Up @@ -3638,9 +3638,10 @@ proto.deviceapi.CosCheckUpdateRes.toObject = function(includeInstance, msg) {
seid: jspb.Message.getFieldWithDefault(msg, 1, ""),
isLatest: jspb.Message.getBooleanFieldWithDefault(msg, 2, false),
latestCosVersion: jspb.Message.getFieldWithDefault(msg, 3, ""),
updateType: jspb.Message.getFieldWithDefault(msg, 4, ""),
description: jspb.Message.getFieldWithDefault(msg, 5, ""),
isUpdateSuccess: jspb.Message.getBooleanFieldWithDefault(msg, 6, false)
latestBleVersion: jspb.Message.getFieldWithDefault(msg, 4, ""),
updateType: jspb.Message.getFieldWithDefault(msg, 5, ""),
description: jspb.Message.getFieldWithDefault(msg, 6, ""),
isUpdateSuccess: jspb.Message.getBooleanFieldWithDefault(msg, 7, false)
};

if (includeInstance) {
Expand Down Expand Up @@ -3691,13 +3692,17 @@ proto.deviceapi.CosCheckUpdateRes.deserializeBinaryFromReader = function(msg, re
break;
case 4:
var value = /** @type {string} */ (reader.readString());
msg.setUpdateType(value);
msg.setLatestBleVersion(value);
break;
case 5:
var value = /** @type {string} */ (reader.readString());
msg.setDescription(value);
msg.setUpdateType(value);
break;
case 6:
var value = /** @type {string} */ (reader.readString());
msg.setDescription(value);
break;
case 7:
var value = /** @type {boolean} */ (reader.readBool());
msg.setIsUpdateSuccess(value);
break;
Expand Down Expand Up @@ -3751,24 +3756,31 @@ proto.deviceapi.CosCheckUpdateRes.serializeBinaryToWriter = function(message, wr
f
);
}
f = message.getUpdateType();
f = message.getLatestBleVersion();
if (f.length > 0) {
writer.writeString(
4,
f
);
}
f = message.getDescription();
f = message.getUpdateType();
if (f.length > 0) {
writer.writeString(
5,
f
);
}
f = message.getDescription();
if (f.length > 0) {
writer.writeString(
6,
f
);
}
f = message.getIsUpdateSuccess();
if (f) {
writer.writeBool(
6,
7,
f
);
}
Expand Down Expand Up @@ -3828,13 +3840,30 @@ proto.deviceapi.CosCheckUpdateRes.prototype.setLatestCosVersion = function(value
return jspb.Message.setProto3StringField(this, 3, value);
};

/**
* optional string latest_ble_version = 4;
* @return {string}
*/
proto.deviceapi.CosCheckUpdateRes.prototype.getLatestBleVersion = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, ""));
};


/**
* @param {string} value
* @return {!proto.deviceapi.CosCheckUpdateRes} returns this
*/
proto.deviceapi.CosCheckUpdateRes.prototype.setLatestBleVersion = function(value) {
return jspb.Message.setProto3StringField(this, 4, value);
};


/**
* optional string update_type = 4;
* optional string update_type = 5;
* @return {string}
*/
proto.deviceapi.CosCheckUpdateRes.prototype.getUpdateType = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, ""));
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, ""));
};


Expand All @@ -3843,16 +3872,16 @@ proto.deviceapi.CosCheckUpdateRes.prototype.getUpdateType = function() {
* @return {!proto.deviceapi.CosCheckUpdateRes} returns this
*/
proto.deviceapi.CosCheckUpdateRes.prototype.setUpdateType = function(value) {
return jspb.Message.setProto3StringField(this, 4, value);
return jspb.Message.setProto3StringField(this, 5, value);
};


/**
* optional string description = 5;
* optional string description = 6;
* @return {string}
*/
proto.deviceapi.CosCheckUpdateRes.prototype.getDescription = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, ""));
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 6, ""));
};


Expand All @@ -3861,16 +3890,16 @@ proto.deviceapi.CosCheckUpdateRes.prototype.getDescription = function() {
* @return {!proto.deviceapi.CosCheckUpdateRes} returns this
*/
proto.deviceapi.CosCheckUpdateRes.prototype.setDescription = function(value) {
return jspb.Message.setProto3StringField(this, 5, value);
return jspb.Message.setProto3StringField(this, 6, value);
};


/**
* optional bool is_update_success = 6;
* optional bool is_update_success = 7;
* @return {boolean}
*/
proto.deviceapi.CosCheckUpdateRes.prototype.getIsUpdateSuccess = function() {
return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 6, false));
return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 7, false));
};


Expand All @@ -3879,7 +3908,7 @@ proto.deviceapi.CosCheckUpdateRes.prototype.getIsUpdateSuccess = function() {
* @return {!proto.deviceapi.CosCheckUpdateRes} returns this
*/
proto.deviceapi.CosCheckUpdateRes.prototype.setIsUpdateSuccess = function(value) {
return jspb.Message.setProto3BooleanField(this, 6, value);
return jspb.Message.setProto3BooleanField(this, 7, value);
};


Expand Down
4 changes: 3 additions & 1 deletion src/renderer/common/lang/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ export const m = {
find_firmware_update_fail_continue: 'It is detected that the application exit abnormal, please continue to upgrade, and imKey Manager can be used normally after completion',
imKey_pro_firmware_update_wait: 'The imKey Pro firmware version is being upgraded, please wait patiently',
imKey_pro_firmware_update_no_disconnect: 'Note: After the upgrade is completed, imKey Pro will automatically restart. During the upgrade process, please do not disconnect the USB connection and terminate the imKey operation at the same time',
notice: 'upgrade tips',
imKey_pro_ble_update_prompt_message: 'After successful upgrade, please delete the Bluetooth pairing information and re-pair',
enter_bind_code: 'Please input a binding code',
bind_code_error_please_check: 'Binding code error, please check carefully, or reset imKey by importing the mnemonic phrase to retrieve it',
enter_pin_imKey_pro: 'Please enter the PIN code in imKey Pro',
Expand Down Expand Up @@ -126,7 +128,7 @@ export const m = {
visit_Youzan_Mall_to_buy: 'Buy imKey and peripherals now',
user_support: 'User Support',
email: 'Email: support@imkey.im',
wechat: 'WeChat: imKeyOfficial',
wechat: 'WeChat: imKey_Official',
tokenlon_info: 'Trustless token-to-token decentralized exchange',
compound_info: 'Deposit to earn, support USDT, USDC, Dai & 6 more ',
aave_info: 'Deposit/Lend to earn, support TUSD, USDT & 15 more',
Expand Down
4 changes: 3 additions & 1 deletion src/renderer/common/lang/zh.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ export const m = {
find_firmware_update_fail_continue: '检测到因应用异常退出导致固件升级未完成,请继续升级,完成后可正常使用 imKey Manager',
imKey_pro_firmware_update_wait: 'imKey Pro 固件版本升级中,请耐心等待',
imKey_pro_firmware_update_no_disconnect: '注意:升级完成后 imKey Pro 将自动重启升级过程中请勿断开 USB 连接,同时中止 imKey 操作',
notice: '升级提示',
imKey_pro_ble_update_prompt_message: '升级成功后需删除蓝牙配对信息重新配对',
enter_bind_code: '请输入设备绑定码',
bind_code_error_please_check: ' 绑定码错误,请仔细核对,或通过导入助记词',
reset_imKey: ' 重置 imKey ',
Expand Down Expand Up @@ -127,7 +129,7 @@ export const m = {
visit_Youzan_Mall_to_buy: '访问有赞商城购买 imKey 及其周边吧',
user_support: '用户支持',
email: '邮件:support@imkey.im',
wechat: '微信:imKeyOfficial',
wechat: '微信:imKey_Official',
tokenlon_info: '安全快速的去中心化交易所',
compound_info: '存币生息,支持 USDT/USDC/Dai等 ',
aave_info: '存/借贷生息,支持 17 个币种',
Expand Down
5 changes: 4 additions & 1 deletion src/renderer/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,13 @@ export default new Vuex.Store({
isCosUpdate: false,
cosOldVersionData: '',
cosNewVersionData: '',
bleOldVersionData: '',
bleNewVersionData: '',
buttonTexts: '',
userPath: '',
isFirstGoToManagerPage: true,
WalletAddress: []
WalletAddress: [],
installedBleVersion: ''
},
mutations: {},
actions: {},
Expand Down
4 changes: 2 additions & 2 deletions src/renderer/views/connectDevice.vue
Original file line number Diff line number Diff line change
Expand Up @@ -508,8 +508,8 @@ export default {
},
cosUpdateWalletAddress () {
// 发送应用查询请求
this.$ipcRenderer.send('checkUpdate')
this.$ipcRenderer.on('checkUpdate', (CheckUpdateResult) => {
this.$ipcRenderer.send('getInstalledApplets')
this.$ipcRenderer.on('getInstalledApplets', (CheckUpdateResult) => {
const CheckUpdateResponse = CheckUpdateResult.result
if (CheckUpdateResult.isSuccess) {
const appList = CheckUpdateResponse.list
Expand Down
4 changes: 2 additions & 2 deletions src/renderer/views/home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@
</svg>
{{$t('m.imKeyManager.manager')}}
</router-link>
<router-link class="link" to="/home/dapp" tag="li">
<!-- <router-link class="link" to="/home/dapp" tag="li">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z" stroke="black" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M2 12H22" stroke="black" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M12 2C14.5013 4.73835 15.9228 8.29203 16 12C15.9228 15.708 14.5013 19.2616 12 22C9.49872 19.2616 8.07725 15.708 8 12C8.07725 8.29203 9.49872 4.73835 12 2V2Z" stroke="black" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
DApp
</router-link>
</router-link> -->
<router-link class="link" to="/home/setting" tag="li">
<svg width="22" height="22" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M11 13.5C12.3807 13.5 13.5 12.3807 13.5 11C13.5 9.61929 12.3807 8.5 11 8.5C9.61929 8.5 8.5 9.61929 8.5 11C8.5 12.3807 9.61929 13.5 11 13.5Z" stroke="black"/>
Expand Down
Loading

0 comments on commit 26daf90

Please sign in to comment.