Skip to content

Commit

Permalink
fix: permission
Browse files Browse the repository at this point in the history
  • Loading branch information
heisenberg-2077 committed Apr 23, 2024
1 parent f1b1422 commit 4374765
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 28 deletions.
1 change: 1 addition & 0 deletions apps/mobile/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@
"react-native": "0.72.7",
"react-native-aes-crypto": "^3.0.1",
"react-native-animateable-text": "0.11.0",
"react-native-ble-manager": "8",
"react-native-ble-plx": "2.0.3",
"react-native-collapsible-tab-view": "^6.2.1",
"react-native-crypto-js": "^1.0.0",
Expand Down
11 changes: 11 additions & 0 deletions apps/mobile/src/hooks/onekey/useOneKeyImport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,23 @@ import type { SearchDevice } from '@onekeyfe/hd-core';
import { apiOneKey } from '@/core/apis';
import React from 'react';
import { oneKeyDevices } from '@/core/apis/onekey';
import { checkAndRequestAndroidBluetooth } from '@/utils/bluetoothPermissions';
import { Platform } from 'react-native';

export function useOneKeyImport() {
const [devices, setDevices] = useAtom(oneKeyDevices);
const [error, setError] = React.useState<string | number | undefined>();

const startScan = React.useCallback(async () => {
const isBluetoothEnabled =
Platform.OS === 'android'
? await checkAndRequestAndroidBluetooth()
: true;

console.log('[OneKeyImport] - bluetooth enabled? ', {
isBluetoothEnabled,
});

apiOneKey.searchDevices().then(res => {
if (res.success) {
setDevices(res.payload as SearchDevice[]);
Expand Down
1 change: 0 additions & 1 deletion packages/eth-keyring-onekey/src/eth-onekey-keyring.ts
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,6 @@ class OneKeyKeyring extends EventEmitter {
transaction = {
...tx.toJSON(),
chainId,
to: this._normalize(tx.to),
};
}
return this.bridge
Expand Down
55 changes: 28 additions & 27 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4940,22 +4940,22 @@ __metadata:
linkType: hard

"@onekeyfe/hd-ble-sdk@npm:^0.3.43-alpha.0":
version: 0.3.43-alpha.0
resolution: "@onekeyfe/hd-ble-sdk@npm:0.3.43-alpha.0"
version: 0.3.43
resolution: "@onekeyfe/hd-ble-sdk@npm:0.3.43"
dependencies:
"@onekeyfe/hd-core": ^0.3.43-alpha.0
"@onekeyfe/hd-shared": ^0.3.43-alpha.0
"@onekeyfe/hd-transport-react-native": ^0.3.43-alpha.0
checksum: 1c1028397588a21be770965ae2cf75a63ab8c370a1720c6b06ad36ed270b17eaa7050f4a7f1d159b66d46349bcc25ea7ef7403d4499f9522ae415956e7237e86
"@onekeyfe/hd-core": ^0.3.43
"@onekeyfe/hd-shared": ^0.3.43
"@onekeyfe/hd-transport-react-native": ^0.3.43
checksum: aebf9a719869d2657c449f22b8b5aa1c035617174e7e17740f616ddf8341c80af864ae5c5511ab029117566f5aca99e6cd2ee016b70c1b11c6abc07f18a5c025
languageName: node
linkType: hard

"@onekeyfe/hd-core@npm:^0.3.43-alpha.0":
version: 0.3.43-alpha.0
resolution: "@onekeyfe/hd-core@npm:0.3.43-alpha.0"
"@onekeyfe/hd-core@npm:^0.3.43":
version: 0.3.43
resolution: "@onekeyfe/hd-core@npm:0.3.43"
dependencies:
"@onekeyfe/hd-shared": ^0.3.43-alpha.0
"@onekeyfe/hd-transport": ^0.3.43-alpha.0
"@onekeyfe/hd-shared": ^0.3.43
"@onekeyfe/hd-transport": ^0.3.43
axios: ^0.27.2
bignumber.js: ^9.0.2
bytebuffer: ^5.0.1
Expand All @@ -4965,7 +4965,7 @@ __metadata:
peerDependencies:
"@noble/hashes": ^1.1.3
ripple-keypairs: ^1.1.4
checksum: 470c400c973933348a8c8d9b49b3be8ad7fd4f82548752ac66522f65e5dd010fb826215d6ecee9834df1311ccdacbce098fc95c214dc69822b671173d53815f7
checksum: 06d69c6a55904912a8d361aebe49ab7b088feaf83011c833916b0148246e1a863f73d452c501ce8d3c3e10bd56e01b6c80d970c8a598eff49c1952a42e80a8d1
languageName: node
linkType: hard

Expand All @@ -4988,10 +4988,10 @@ __metadata:
languageName: node
linkType: hard

"@onekeyfe/hd-shared@npm:^0.3.43-alpha.0":
version: 0.3.43-alpha.0
resolution: "@onekeyfe/hd-shared@npm:0.3.43-alpha.0"
checksum: ef0b37b1e6906d9d76d5dcad68342ac18e94ef0e082e71068e4fe96dfafc5e2d82b15267e22f5c5adbc6a2a56084a91a7b41caf586af077eed24972b95528b71
"@onekeyfe/hd-shared@npm:^0.3.43":
version: 0.3.43
resolution: "@onekeyfe/hd-shared@npm:0.3.43"
checksum: bac1e1e9b7316595abd56e8188adc3df6cef5a6c492119b729ea4a1bc6e6747ab6c35dbac680161cf62fede64077fac03b03a0ce636014c67c9252e4dd7a3e4a
languageName: node
linkType: hard

Expand All @@ -5002,26 +5002,26 @@ __metadata:
languageName: node
linkType: hard

"@onekeyfe/hd-transport-react-native@npm:^0.3.43-alpha.0":
version: 0.3.43-alpha.0
resolution: "@onekeyfe/hd-transport-react-native@npm:0.3.43-alpha.0"
"@onekeyfe/hd-transport-react-native@npm:^0.3.43":
version: 0.3.43
resolution: "@onekeyfe/hd-transport-react-native@npm:0.3.43"
dependencies:
"@onekeyfe/hd-shared": ^0.3.43-alpha.0
"@onekeyfe/hd-transport": ^0.3.43-alpha.0
"@onekeyfe/hd-shared": ^0.3.43
"@onekeyfe/hd-transport": ^0.3.43
"@onekeyfe/react-native-ble-plx": 3.0.0
react-native-ble-manager: ^8.1.0
checksum: 5031514ecd449e71a2c6d05bc428552e90d951dc953704d2fad8f79a64e3bf96b5b03795ab118f64a95acf4581a3e6beaad03f8b668195ea63cce28f03324e8f
checksum: bc0ed84a26f90acbd9c3b631ba4d252d38a082ab39b351df1b04c2562cfd0a798813dc1cf1adc369d4acaf9a92373137cd220030bf16924b6d33660a568eff2f
languageName: node
linkType: hard

"@onekeyfe/hd-transport@npm:^0.3.43-alpha.0":
version: 0.3.43-alpha.0
resolution: "@onekeyfe/hd-transport@npm:0.3.43-alpha.0"
"@onekeyfe/hd-transport@npm:^0.3.43":
version: 0.3.43
resolution: "@onekeyfe/hd-transport@npm:0.3.43"
dependencies:
bytebuffer: ^5.0.1
long: ^4.0.0
protobufjs: ^6.11.2
checksum: 4eca9c2d1101801d8d64a4261671dce2a04605107804bae6c4bd7545cb19dc6cfb21cea215bd0621b384f1b75de22201dc312d0972a860a1602276debf66156d
checksum: 3f374c709b5ae11fe149355b80b76fd01179a92770cd27ebbdf34535df65422cce1fe81c00729731de24e3bdaa4aaf3fe94cff2940e95777d5d053c8910a7196
languageName: node
linkType: hard

Expand Down Expand Up @@ -26715,6 +26715,7 @@ __metadata:
react-native-aes-crypto: ^3.0.1
react-native-animateable-text: 0.11.0
react-native-asset: ^2.1.1
react-native-ble-manager: 8
react-native-ble-plx: 2.0.3
react-native-collapsible-tab-view: ^6.2.1
react-native-crypto-js: ^1.0.0
Expand Down Expand Up @@ -27169,7 +27170,7 @@ __metadata:
languageName: node
linkType: hard

"react-native-ble-manager@npm:^8.1.0":
"react-native-ble-manager@npm:8, react-native-ble-manager@npm:^8.1.0":
version: 8.8.0
resolution: "react-native-ble-manager@npm:8.8.0"
checksum: f3522982cffffb4d8cf4b724af8b548769fdec7207b2292eb85a501ffdbae2adaf004a08b7afeee471b51730fa7a9d3b0b93c94ce600270420447edf44fc75c0
Expand Down

0 comments on commit 4374765

Please sign in to comment.