Skip to content

Commit

Permalink
Merge branch 'main' into feature/tests
Browse files Browse the repository at this point in the history
  • Loading branch information
axi92 authored Aug 19, 2024
2 parents 9848ff5 + 85885d4 commit abafe8c
Show file tree
Hide file tree
Showing 8 changed files with 86 additions and 61 deletions.
19 changes: 19 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Editor configuration, see https://editorconfig.org
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

[*.gradle]
indent_size = 4

[{*.json,*.jschema}]
indent_size = 4

[*.md]
max_line_length = off
trim_trailing_whitespace = false
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules/
lib/
37 changes: 37 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"root": true,
"extends": [
"@react-native",
"prettier"
],
"plugins": [
"unused-imports",
"simple-import-sort",
"jest"
],
"rules": {
"no-void": "off",
"max-len": "off",
"no-console": "off",
"no-bitwise": "off",
"no-underscore-dangle": "off",
"id-blacklist": "off",
"simple-import-sort/imports": "error",
"simple-import-sort/exports": "error",
"unused-imports/no-unused-imports": "error",
"unused-imports/no-unused-vars": [
"warn"
],
"react/react-in-jsx-scope": "off",
"prettier/prettier": [
"error",
{
"printWidth": 100,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "all",
"useTabs": false
}
]
}
}
6 changes: 3 additions & 3 deletions example/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -85,21 +85,21 @@ GEM
netrc (0.11.0)
nkf (0.2.0)
public_suffix (4.0.7)
rexml (3.2.9)
rexml (3.3.3)
strscan
ruby-macho (2.5.1)
strscan (3.1.0)
typhoeus (1.4.1)
ethon (>= 0.9.0)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
xcodeproj (1.24.0)
xcodeproj (1.25.0)
CFPropertyList (>= 2.3.3, < 4.0)
atomos (~> 0.1.3)
claide (>= 1.0.2, < 2.0)
colored2 (~> 3.1)
nanaimo (~> 0.3.0)
rexml (~> 3.2.4)
rexml (>= 3.3.2, < 4.0)

PLATFORMS
aarch64-linux-gnu
Expand Down
4 changes: 2 additions & 2 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1205,7 +1205,7 @@ PODS:
- React-utils (= 0.74.3)
- RNFS (2.20.0):
- React-Core
- RNScreens (3.34.0):
- RNScreens (3.32.0):
- DoubleConversion
- glog
- hermes-engine
Expand Down Expand Up @@ -1494,7 +1494,7 @@ SPEC CHECKSUMS:
React-utils: 6f7ac39d9a0de447d4334bb25d144a28c0c5d8c9
ReactCommon: 4a09c7d8a06e93c1e2e988a3b9f3db3d2449f2fc
RNFS: 4ac0f0ea233904cb798630b3c077808c06931688
RNScreens: db442e7b8c7bc8befec2ce057927305ff8598cc8
RNScreens: fd2722bcc59f36a629205af8cc7b48e4bc0d09f5
SocketRocket: abac6f5de4d4d62d24e11868d7a2f427e0ef940d
Yoga: bd92064a0d558be92786820514d74fc4dddd1233

Expand Down
7 changes: 5 additions & 2 deletions example/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,14 @@ const CryptoScreen = () => {
return (
<View style={styles.cryptoContainer}>
<View style={styles.cryptoView}>
<Text>{result}</Text>
<Text style={styles.cryptoText}>{result}</Text>
</View>
<ScrollView style={styles.scrollView}>
<Button
text="generateKeyPair"
onPressFunction={() => {
AbrevvaCrypto.generateKeyPair().then((ret: any) => {
setResult(`Privat Key:\n${ret.privateKey}\n\nPublic Key\n:${ret.publicKey}`);
setResult(`Privat Key:\n${ret.privateKey}\n\nPublic Key:\n${ret.publicKey}`);
});
}}
/>
Expand Down Expand Up @@ -129,6 +129,9 @@ export const styles = StyleSheet.create({
marginTop: 20,
height: 150,
},
cryptoText: {
color: 'black',
},
cryptoContainer: {
alignItems: 'center',
},
Expand Down
31 changes: 18 additions & 13 deletions example/src/BleScreenComponents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,20 +80,28 @@ const advManufacturerDataParser = new Parser()

export const BleScreen = () => {
const [statusCode, setStatusCode] = useState('none');
const [startScanNoftification, setStartScanNoftification] = useState(
'pull down to start scanning',
);

return (
<>
<ScanResults setStatus={setStatusCode} />
<Text style={bleStyles.scanNotification}>{startScanNoftification}</Text>
<ScanResults
props={{ setStatus: setStatusCode, setScanNoftification: setStartScanNoftification }}
/>
<SafeAreaView style={bleStyles.status}>
<Text>Last received Statuscode '{statusCode}'</Text>
</SafeAreaView>
</>
);
};

const ScanResults = ({ setStatus }) => {
const ScanResults = ({ props }) => {
const [deviceList, setdeviceList] = useState<ScanResult[]>([]);
const [refreshing, setRefreshing] = useState(false);
const setStatus = props.setStatus;
const setScanNoftification = props.setScanNoftification;

const scanRequestCallback = (data: ScanResult) => {
if (data.manufacturerData !== undefined && '2153' in data.manufacturerData) {
Expand All @@ -114,11 +122,13 @@ const ScanResults = ({ setStatus }) => {

const onRefresh = () => {
setStatus('none');
setScanNoftification('scanning ...');
setRefreshing(true);
setdeviceList([]);

const timeout: NodeJS.Timeout = setTimeout(() => {
setRefreshing(false);
setScanNoftification('');
}, SCAN_TIMEOUT);
AbrevvaBle.stopLEScan()
.then(() => {
Expand All @@ -139,17 +149,7 @@ const ScanResults = ({ setStatus }) => {
};

useEffect(() => {
AbrevvaBle.initialize(true).then(() => {
void AbrevvaBle.requestLEScan(
scanRequestCallback,
(address: string) => {
console.log(`connected to Device =${address}`);
},
(address: string) => {
console.log(`disconnected from Device =${address}`);
},
);
});
AbrevvaBle.initialize(true);
}, []);

return (
Expand Down Expand Up @@ -308,6 +308,11 @@ async function mobileIdentificationMediumService(data: ScanResult, setStatus: an
}

const bleStyles = StyleSheet.create({
scanNotification: {
margin: 'auto',
color: 'black',
marginVertical: 10,
},
BleScanResult: {
justifyContent: 'center',
alignItems: 'center',
Expand Down
41 changes: 0 additions & 41 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,47 +97,6 @@
"workspaces": [
"example"
],
"eslintConfig": {
"root": true,
"extends": [
"@react-native",
"prettier"
],
"plugins": [
"unused-imports",
"simple-import-sort",
"jest"
],
"rules": {
"no-void": "off",
"max-len": "off",
"no-console": "off",
"no-bitwise": "off",
"no-underscore-dangle": "off",
"id-blacklist": "off",
"simple-import-sort/imports": "error",
"simple-import-sort/exports": "error",
"unused-imports/no-unused-imports": "error",
"unused-imports/no-unused-vars": [
"warn"
],
"react/react-in-jsx-scope": "off",
"prettier/prettier": [
"error",
{
"printWidth": 100,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "all",
"useTabs": false
}
]
}
},
"eslintIgnore": [
"node_modules/",
"lib/"
],
"prettier": {
"quoteProps": "consistent",
"singleQuote": true,
Expand Down

0 comments on commit abafe8c

Please sign in to comment.