Skip to content

Commit ca7b95f

Browse files
committed
fix: android ci
1 parent 89fba6e commit ca7b95f

File tree

8 files changed

+77
-25
lines changed

8 files changed

+77
-25
lines changed

.github/workflows/build-example-android.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
node-version: '22'
1717

1818
- name: Set up JDK 17
19-
uses: actions/setup-java@v2
19+
uses: actions/setup-java@v4
2020
with:
2121
java-version: '17'
2222
distribution: 'zulu'
@@ -26,7 +26,7 @@ jobs:
2626
yarn setup
2727
2828
- name: Cache Gradle packages
29-
uses: actions/cache@v2
29+
uses: actions/cache@v4
3030
with:
3131
path: |
3232
~/.gradle/caches

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"workspaces": {
1111
"packages": [
1212
"packages/*",
13+
"packages/connect-examples/shared-constants",
1314
"packages/connect-examples/expo-example",
1415
"packages/connect-examples/electron-example",
1516
"packages/connect-examples/expo-playground"

packages/connect-examples/expo-example/src/components/CommonParamsView.tsx

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,32 @@ export default function CommonParamsView() {
1616
return (
1717
<PanelView title={intl.formatMessage({ id: 'title__common_parameters' })}>
1818
<Stack gap="$4" flexDirection="row" flexWrap="wrap">
19+
<CommonInput
20+
label="Passphrase State"
21+
type="text"
22+
value={commonParams.passphraseState ?? ''}
23+
onChange={value => handleSetParam('passphraseState', value)}
24+
/>
25+
<SwitchInput
26+
label={intl.formatMessage({ id: 'label__use_empty_passphrase' })}
27+
value={!!commonParams.useEmptyPassphrase}
28+
onToggle={value => handleSetParam('useEmptyPassphrase', value)}
29+
/>
30+
<SwitchInput
31+
label="skipPassphraseCheck"
32+
value={!!commonParams.skipPassphraseCheck}
33+
onToggle={value => handleSetParam('skipPassphraseCheck', value)}
34+
/>
1935
<SwitchInput
2036
label={intl.formatMessage({ id: 'label__keep_session' })}
2137
value={!!commonParams.keepSession}
2238
onToggle={value => handleSetParam('keepSession', value)}
2339
/>
40+
<SwitchInput
41+
label={intl.formatMessage({ id: 'label__init_session' })}
42+
value={!!commonParams.initSession}
43+
onToggle={value => handleSetParam('initSession', value)}
44+
/>
2445
<CommonInput
2546
label={intl.formatMessage({ id: 'label__retry_count' })}
2647
type="number"
@@ -39,22 +60,6 @@ export default function CommonParamsView() {
3960
value={commonParams.timeout?.toString() ?? ''}
4061
onChange={value => handleSetParam('timeout', parseInt(value))}
4162
/>
42-
<CommonInput
43-
label="Passphrase State"
44-
type="text"
45-
value={commonParams.passphraseState ?? ''}
46-
onChange={value => handleSetParam('passphraseState', value)}
47-
/>
48-
<SwitchInput
49-
label={intl.formatMessage({ id: 'label__init_session' })}
50-
value={!!commonParams.initSession}
51-
onToggle={value => handleSetParam('initSession', value)}
52-
/>
53-
<SwitchInput
54-
label={intl.formatMessage({ id: 'label__use_empty_passphrase' })}
55-
value={!!commonParams.useEmptyPassphrase}
56-
onToggle={value => handleSetParam('useEmptyPassphrase', value)}
57-
/>
5863
<SwitchInput
5964
label="detectBootloaderDevice"
6065
value={!!commonParams.detectBootloaderDevice}
@@ -65,11 +70,6 @@ export default function CommonParamsView() {
6570
value={!!commonParams.skipWebDevicePrompt}
6671
onToggle={value => handleSetParam('skipWebDevicePrompt', value)}
6772
/>
68-
<SwitchInput
69-
label="skipPassphraseCheck"
70-
value={!!commonParams.skipPassphraseCheck}
71-
onToggle={value => handleSetParam('skipPassphraseCheck', value)}
72-
/>
7373
</Stack>
7474
</PanelView>
7575
);
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
// eslint-disable-next-line import/no-relative-packages
2-
import { getConnectSrc } from '../../../constants';
2+
import { getConnectSrc } from '@onekey-internal/shared-constants';
33

44
export const CONNECT_SRC = getConnectSrc();

packages/connect-examples/expo-playground/app/constants/connect.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { getConnectSrc } from '../../../constants';
1+
import { getConnectSrc } from '@onekey-internal/shared-constants';
22

33
/**
44
* OneKey Hardware SDK Connect Source Configuration
File renamed without changes.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"name": "@onekey-internal/shared-constants",
3+
"version": "1.1.10-alpha.2",
4+
"private": true,
5+
"author": "OneKey",
6+
"homepage": "https://github.com/OneKeyHQ/hardware-js-sdk#readme",
7+
"license": "ISC",
8+
"type": "module",
9+
"main": "constants.js"
10+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
diff --git a/node_modules/react-native-crypto/index.js b/node_modules/react-native-crypto/index.js
2+
index f644543..bf38ebb 100644
3+
--- a/node_modules/react-native-crypto/index.js
4+
+++ b/node_modules/react-native-crypto/index.js
5+
@@ -1,28 +1,16 @@
6+
'use strict'
7+
+import { getRandomValues } from 'react-native-get-random-values';
8+
9+
-import { randomBytes } from 'react-native-randombytes'
10+
-exports.randomBytes = exports.rng = exports.pseudoRandomBytes = exports.prng = randomBytes
11+
-
12+
-// implement window.getRandomValues(), for packages that rely on it
13+
-if (typeof window === 'object') {
14+
- if (!window.crypto) window.crypto = {}
15+
- if (!window.crypto.getRandomValues) {
16+
- window.crypto.getRandomValues = function getRandomValues (arr) {
17+
- let orig = arr
18+
- if (arr.byteLength != arr.length) {
19+
- // Get access to the underlying raw bytes
20+
- arr = new Uint8Array(arr.buffer)
21+
- }
22+
- const bytes = randomBytes(arr.length)
23+
- for (var i = 0; i < bytes.length; i++) {
24+
- arr[i] = bytes[i]
25+
- }
26+
-
27+
- return orig
28+
- }
29+
+if (typeof globalThis === 'object') {
30+
+ if (!globalThis.crypto) {
31+
+ globalThis.crypto = {};
32+
+ }
33+
+ if (!globalThis.crypto.getRandomValues) {
34+
+ globalThis.crypto.getRandomValues = getRandomValues;
35+
}
36+
}
37+
38+
+
39+
exports.createHash = exports.Hash = require('create-hash')
40+
exports.createHmac = exports.Hmac = require('create-hmac')
41+

0 commit comments

Comments
 (0)