Skip to content

Commit

Permalink
feat: support classic1s
Browse files Browse the repository at this point in the history
  • Loading branch information
ByteZhang1024 committed Mar 20, 2024
1 parent b526ec4 commit 96f8006
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 44 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
"@headlessui/react": "^1.7.2",
"@heroicons/react": "^2.0.11",
"@noble/hashes": "^1.1.3",
"@onekeyfe/hd-core": "0.3.30",
"@onekeyfe/hd-shared": "0.3.30",
"@onekeyfe/hd-web-sdk": "0.3.30",
"@onekeyfe/hd-core": "0.3.40",
"@onekeyfe/hd-shared": "0.3.40",
"@onekeyfe/hd-web-sdk": "0.3.40",
"@onekeyfe/ui-components": "^1.0.0",
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.3",
"@reduxjs/toolkit": "^1.8.5",
Expand Down
3 changes: 3 additions & 0 deletions src/components/Firmware/Firmware.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,9 @@ export default function Firmware() {
case 'classic':
typeFlag = 'OneKey Classic';
break;
case 'classic1s':
typeFlag = 'OneKey Classic 1S';
break;
case 'mini':
typeFlag = 'OneKey Mini';
break;
Expand Down
1 change: 1 addition & 0 deletions src/hardware/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ class ServiceHardware {

const deviceMap = {
classic: data.classic,
classic1s: data.classic1s,
mini: data.mini,
touch: data.touch,
pro: data.pro,
Expand Down
2 changes: 1 addition & 1 deletion src/hardware/instance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const getHardwareSDKInstance = memoizee(
}
const settings: Partial<ConnectSettings> = {
debug: true,
connectSrc: 'https://jssdk.onekey.so/0.3.30/',
connectSrc: 'https://jssdk.onekey.so/0.3.40/',
preRelease: false,
fetchConfig: true,
};
Expand Down
4 changes: 2 additions & 2 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ export type IBLEFirmwareReleaseInfo = {
};
};

export type IFirmwareField = 'firmware' | 'ble' | 'firmware-v2' | 'firmware-v4';
export type IFirmwareField = 'firmware' | 'ble' | 'firmware-v2' | 'firmware-v5';

export type DeviceTypeMap = {
[k in IDeviceType]: {
firmware: IFirmwareReleaseInfo[];
ble: IBLEFirmwareReleaseInfo[];
'firmware-v2'?: IFirmwareReleaseInfo[];
'firmware-v4'?: IFirmwareReleaseInfo[];
'firmware-v5'?: IFirmwareReleaseInfo[];
};
};

Expand Down
13 changes: 9 additions & 4 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,29 +59,34 @@ export const getFirmwareUpdateField = (
export const getFirmwareUpdateFieldArray = (
features: Features,
updateType: 'firmware' | 'ble'
): ('firmware' | 'ble' | 'firmware-v2' | 'firmware-v4')[] => {
): ('firmware' | 'ble' | 'firmware-v2' | 'firmware-v5')[] => {
const deviceType = getDeviceType(features);
if (updateType === 'ble') {
return ['ble'];
}

if (deviceType === 'classic' || deviceType === 'mini') {
return ['firmware-v4'];
return ['firmware-v5'];
}

if (deviceType === 'touch') {
const currentVersion = getDeviceFirmwareVersion(features).join('.');
if (semver.gt(currentVersion, '4.0.0')) {
return ['firmware-v4', 'firmware'];
return ['firmware-v5', 'firmware'];
}
if (semver.gte(currentVersion, '4.0.0')) {
return ['firmware-v2', 'firmware'];
}
if (!currentVersion || semver.lt(currentVersion, '3.0.0')) {
return ['firmware-v4', 'firmware-v2', 'firmware'];
return ['firmware-v5', 'firmware-v2', 'firmware'];
}
return ['firmware'];
}

if (deviceType === 'pro') {
return ['firmware-v5'];
}

return ['firmware'];
};

Expand Down
68 changes: 34 additions & 34 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2156,61 +2156,61 @@
resolved "https://registry.yarnpkg.com/@onekeyfe/cross-inpage-provider-types/-/cross-inpage-provider-types-0.0.17.tgz#0c88c1a2febac44ec1600e0e59da732579cbd045"
integrity sha512-QqjIPXQHb3UG9w79ujjL5L5Qd6oCrymQ/x2J2rYICtr56G6shHTmUvRZxAvne0ZsLv8UBGqZWbepVdnPipehYQ==

"@onekeyfe/[email protected].30", "@onekeyfe/hd-core@^0.3.30":
version "0.3.30"
resolved "https://registry.yarnpkg.com/@onekeyfe/hd-core/-/hd-core-0.3.30.tgz#6451bac8b1a078d5a18e5b83b0697bf24ebb5dab"
integrity sha512-/XMdqBLEicW+0sL1IL+frly7DorBU5o+N2k9cv7DLZlg7YBj3L99BmZx+g9znXLQwUhXb4k8cydOHvihUxQlqQ==
"@onekeyfe/[email protected].40", "@onekeyfe/hd-core@^0.3.40":
version "0.3.40"
resolved "https://registry.yarnpkg.com/@onekeyfe/hd-core/-/hd-core-0.3.40.tgz#869f0f370228c0f971aed088ae6517bed336251f"
integrity sha512-c9ML8S8OMP/eIG7geKFm5O6XiGCsEMKZfKvwJV4TPARtBgkfW0TsTksRlQJpEGxm9hJKhQsQdCQIkXELXYlN7w==
dependencies:
"@onekeyfe/hd-shared" "^0.3.30"
"@onekeyfe/hd-transport" "^0.3.30"
"@onekeyfe/hd-shared" "^0.3.40"
"@onekeyfe/hd-transport" "^0.3.40"
axios "^0.27.2"
bignumber.js "^9.0.2"
bytebuffer "^5.0.1"
jszip "^3.10.1"
parse-uri "^1.0.7"
semver "^7.3.7"

"@onekeyfe/[email protected].30", "@onekeyfe/hd-shared@^0.3.30":
version "0.3.30"
resolved "https://registry.yarnpkg.com/@onekeyfe/hd-shared/-/hd-shared-0.3.30.tgz#86658b2f19cd1f5139947a0f162a01afc6b388a1"
integrity sha512-3Sy8Umkc7ahYI9mIzJgkWcz3bKuwKVCq9t8/1XKY8IbQWqPL2VW14N2hVDX+uPZ/93GFJuDWaxR4u3bJIbWYPw==
"@onekeyfe/[email protected].40", "@onekeyfe/hd-shared@^0.3.40":
version "0.3.40"
resolved "https://registry.yarnpkg.com/@onekeyfe/hd-shared/-/hd-shared-0.3.40.tgz#cf655e6db8c46183313b79d24d69cfcd60dfbeab"
integrity sha512-AzhzTDtEyjYTmWj+ZFCCHLWmF70EyBNOZZh7aYpmkCUXdP7GQn1Wnf1bFkDrN3kU6pXJCR6roxC1PCGeE3n0dQ==

"@onekeyfe/hd-transport-http@^0.3.30":
version "0.3.30"
resolved "https://registry.yarnpkg.com/@onekeyfe/hd-transport-http/-/hd-transport-http-0.3.30.tgz#dd688aa547f31e324860d5643cdf2cee6e15eb2a"
integrity sha512-azUrW/7jVCqLiElFEej2/HHKH+YeMVxYZpdm/KafXh5KPkkS2WdyXEiy2dtTjv6Fs+WxzMVN3DL6IA++LdJ1Ig==
"@onekeyfe/hd-transport-http@^0.3.40":
version "0.3.40"
resolved "https://registry.yarnpkg.com/@onekeyfe/hd-transport-http/-/hd-transport-http-0.3.40.tgz#0bc7ba04a0e619dd5744ac86f478ab83ba288c03"
integrity sha512-+iQowv+Z3fDDskByk0ZiKlDgv+WCz1lRqsGhTpoHzlYpYalGN/iKjaoFOWGD0w5mm8na36np0F8FO7tXC6YnXg==
dependencies:
"@onekeyfe/hd-shared" "^0.3.30"
"@onekeyfe/hd-transport" "^0.3.30"
"@onekeyfe/hd-shared" "^0.3.40"
"@onekeyfe/hd-transport" "^0.3.40"
axios "^0.27.2"

"@onekeyfe/hd-transport-webusb@^0.3.30":
version "0.3.30"
resolved "https://registry.yarnpkg.com/@onekeyfe/hd-transport-webusb/-/hd-transport-webusb-0.3.30.tgz#7e63938c2b6186f839625d2813ac8bb11715e1d8"
integrity sha512-VgG/v94jZ/qSQFA72ZJuFy9jXjcTvVg1OG7u32IU/E9DqcM1dHqju0qq3Bv+GH1Xog9n3ShcnhjEfR0cl3uIzQ==
"@onekeyfe/hd-transport-webusb@^0.3.40":
version "0.3.40"
resolved "https://registry.yarnpkg.com/@onekeyfe/hd-transport-webusb/-/hd-transport-webusb-0.3.40.tgz#87215bab920f1ff56abe004f74e1fd1d3254f87d"
integrity sha512-ma9NTLMxznZlavxeFMd0b02T4/urGOCLFK7EuH187Hyeq1QGK6QlK7FQS20Qwc/4NMH5xyEJl8Xggrofw6FXQg==
dependencies:
"@onekeyfe/hd-shared" "^0.3.30"
"@onekeyfe/hd-transport" "^0.3.30"
"@onekeyfe/hd-shared" "^0.3.40"
"@onekeyfe/hd-transport" "^0.3.40"

"@onekeyfe/hd-transport@^0.3.30":
version "0.3.30"
resolved "https://registry.yarnpkg.com/@onekeyfe/hd-transport/-/hd-transport-0.3.30.tgz#47b51416a04cef86cfed3c3301ffd7353ca343f2"
integrity sha512-thGFuulpvcajGVYXgRsQJaGv0E7i9LMDoTOGy2TeBm7Tdvw6HQkHpVBrxHU8LDxc4BHm1EbmyjanSwk4c+ljOw==
"@onekeyfe/hd-transport@^0.3.40":
version "0.3.40"
resolved "https://registry.yarnpkg.com/@onekeyfe/hd-transport/-/hd-transport-0.3.40.tgz#380566709289ac4085f6c25f312afa15669e0687"
integrity sha512-m0IuPrdd9pwvTxt8809MzlixCW1NHrrVBsYY95Fgn+7xSiKboBrGJV2Lih1oHvHOH4bKJoxgpKDMFOjMDBTyuA==
dependencies:
bytebuffer "^5.0.1"
long "^4.0.0"
protobufjs "^6.11.2"

"@onekeyfe/[email protected].30":
version "0.3.30"
resolved "https://registry.yarnpkg.com/@onekeyfe/hd-web-sdk/-/hd-web-sdk-0.3.30.tgz#ddbaf4711a4ecec6deaed81e6fb372febe1bf11b"
integrity sha512-TuZp54TCFiGsDejj2HxjtEjpE5kHaXCQznI3q4POyYGb0PZnH8MnGSTUCvT2UQwMICSv0GRG/PTsvElDXNx4hA==
"@onekeyfe/[email protected].40":
version "0.3.40"
resolved "https://registry.yarnpkg.com/@onekeyfe/hd-web-sdk/-/hd-web-sdk-0.3.40.tgz#c79d57c073f16ddfdb9efb84e88515d0ee81e779"
integrity sha512-9n51ViweBEfdDGY8C/sVrUvl175pqbhq6+xrc6548NpgZe1Dd/BPP3g3SM3br1fPNbOa03Z1u3PRbLxQ/WvDoQ==
dependencies:
"@onekeyfe/cross-inpage-provider-core" "^0.0.17"
"@onekeyfe/hd-core" "^0.3.30"
"@onekeyfe/hd-shared" "^0.3.30"
"@onekeyfe/hd-transport-http" "^0.3.30"
"@onekeyfe/hd-transport-webusb" "^0.3.30"
"@onekeyfe/hd-core" "^0.3.40"
"@onekeyfe/hd-shared" "^0.3.40"
"@onekeyfe/hd-transport-http" "^0.3.40"
"@onekeyfe/hd-transport-webusb" "^0.3.40"

"@onekeyfe/ui-components@^1.0.0":
version "1.0.0"
Expand Down

0 comments on commit 96f8006

Please sign in to comment.