Skip to content

Commit 94207cd

Browse files
committed
ONE-7277: NFC - handle deactivated state
1 parent c11507f commit 94207cd

File tree

3 files changed

+20
-9
lines changed

3 files changed

+20
-9
lines changed

app/screens/dashboard/qr-code-nfc-screen.tsx

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import {
22
LoaderViewState,
33
NFCProcess,
44
reportException,
5+
useNFCStatus,
56
useProofDelete,
67
useProofState,
78
useProposeProof,
@@ -32,6 +33,7 @@ const QRCodeNFCScreen = () => {
3233
useBlePermissions(VerificationProtocol.ISO_MDL);
3334
const { mutateAsync: deleteProof } = useProofDelete();
3435
const { mutateAsync: proposeProof } = useProposeProof();
36+
const { isNFCEnabled, recheck: recheckNFCSupport } = useNFCStatus();
3537

3638
useEffect(() => {
3739
if (permissionStatus !== 'granted') {
@@ -76,12 +78,19 @@ const QRCodeNFCScreen = () => {
7678
]);
7779

7880
const handleButtonClick = useCallback(() => {
79-
if (permissionStatus === 'granted') {
81+
if (permissionStatus === 'granted' && isNFCEnabled) {
8082
handleClose();
8183
} else {
8284
checkPermissions();
85+
recheckNFCSupport();
8386
}
84-
}, [checkPermissions, handleClose, permissionStatus]);
87+
}, [
88+
checkPermissions,
89+
handleClose,
90+
isNFCEnabled,
91+
permissionStatus,
92+
recheckNFCSupport,
93+
]);
8594

8695
const pendingProofId = useRef<string | undefined>(undefined);
8796
pendingProofId.current =
@@ -136,7 +145,7 @@ const QRCodeNFCScreen = () => {
136145
tryAgain: translate('common.tryAgain'),
137146
}}
138147
processState={
139-
permissionStatus === 'granted'
148+
permissionStatus === 'granted' && isNFCEnabled
140149
? LoaderViewState.InProgress
141150
: LoaderViewState.Warning
142151
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
},
3838
"dependencies": {
3939
"@expo/react-native-action-sheet": "^4.1.1",
40-
"@procivis/one-react-native-components": "0.3.69",
40+
"@procivis/one-react-native-components": "0.3.71",
4141
"@procivis/react-native-one-core": "1.60807.0",
4242
"@procivis/react-native-picker": "5.0.3",
4343
"@react-native-async-storage/async-storage": "^1.14.1",

pnpm-lock.yaml

Lines changed: 7 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)