@@ -3,11 +3,9 @@ import { useSelector } from 'react-redux';
3
3
4
4
import { useNavigation } from '@react-navigation/native' ;
5
5
6
- import { selectIsDeviceDiscoveryActive , selectSelectedDevice } from '@suite-common/wallet-core' ;
6
+ import { selectIsDeviceDiscoveryActive } from '@suite-common/wallet-core' ;
7
7
import { useAlert } from '@suite-native/alerts' ;
8
- import { DeviceAuthenticityCheckResult , EventType , analytics } from '@suite-native/analytics' ;
9
8
import { Button , IconListTextItem , Text , VStack } from '@suite-native/atoms' ;
10
- import { requestPrioritizedDeviceAccess } from '@suite-native/device-mutex' ;
11
9
import { Translation } from '@suite-native/intl' ;
12
10
import {
13
11
DeviceAuthenticityStackParamList ,
@@ -17,7 +15,6 @@ import {
17
15
StackToStackCompositeNavigationProps ,
18
16
} from '@suite-native/navigation' ;
19
17
import { SettingsCardWithIconLayout } from '@suite-native/settings' ;
20
- import TrezorConnect from '@trezor/connect' ;
21
18
22
19
type NavigationProp = StackToStackCompositeNavigationProps <
23
20
DeviceAuthenticityStackParamList ,
@@ -31,56 +28,9 @@ export const DeviceAuthenticityCard = () => {
31
28
32
29
const { showAlert } = useAlert ( ) ;
33
30
34
- const device = useSelector ( selectSelectedDevice ) ;
35
-
36
- const reportCheckResult = useCallback (
37
- ( result : DeviceAuthenticityCheckResult ) =>
38
- analytics . report ( {
39
- type : EventType . DeviceSettingsAuthenticityCheck ,
40
- payload : { result } ,
41
- } ) ,
42
- [ ] ,
43
- ) ;
44
-
45
- const checkAuthenticity = useCallback ( async ( ) => {
31
+ const navigateToDeviceAuthenticityStack = useCallback ( ( ) => {
46
32
navigation . navigate ( DeviceStackRoutes . DeviceAuthenticity ) ;
47
-
48
- const result = await requestPrioritizedDeviceAccess ( {
49
- deviceCallback : ( ) =>
50
- TrezorConnect . authenticateDevice ( {
51
- device : {
52
- path : device ?. path ,
53
- } ,
54
- } ) ,
55
- } ) ;
56
- if ( ! result . success ) {
57
- return ;
58
- }
59
-
60
- const { success, payload } = result . payload ;
61
- if ( success ) {
62
- const checkResult = payload . valid ? 'successful' : 'compromised' ;
63
- const configExpired = payload . error === 'CA_PUBKEY_NOT_FOUND' && payload . configExpired ;
64
- navigation . navigate ( DeviceAuthenticityStackRoutes . AuthenticitySummary , {
65
- checkResult : configExpired ? 'successful' : checkResult ,
66
- } ) ;
67
- reportCheckResult ( configExpired ? 'configExpired' : checkResult ) ;
68
- } else {
69
- const errorCode = payload . code ;
70
- if ( errorCode === 'Failure_ActionCancelled' || errorCode === 'Failure_PinCancelled' ) {
71
- navigation . goBack ( ) ;
72
- reportCheckResult ( 'cancelled' ) ;
73
- } else if ( errorCode === 'Method_Interrupted' || errorCode === undefined ) {
74
- // navigation.goBack() already called via the X button (or the device was disconnected)
75
- reportCheckResult ( 'cancelled' ) ;
76
- } else {
77
- navigation . navigate ( DeviceAuthenticityStackRoutes . AuthenticitySummary , {
78
- checkResult : 'compromised' ,
79
- } ) ;
80
- reportCheckResult ( 'failed' ) ;
81
- }
82
- }
83
- } , [ device , navigation , reportCheckResult ] ) ;
33
+ } , [ navigation ] ) ;
84
34
85
35
const showInfoAlert = useCallback ( ( ) => {
86
36
showAlert ( {
@@ -102,9 +52,9 @@ export const DeviceAuthenticityCard = () => {
102
52
primaryButtonTitle : (
103
53
< Translation id = "moduleDeviceSettings.authenticity.info.letsDoItButton" />
104
54
) ,
105
- onPressPrimaryButton : checkAuthenticity ,
55
+ onPressPrimaryButton : navigateToDeviceAuthenticityStack ,
106
56
} ) ;
107
- } , [ showAlert , checkAuthenticity ] ) ;
57
+ } , [ showAlert , navigateToDeviceAuthenticityStack ] ) ;
108
58
109
59
return (
110
60
< SettingsCardWithIconLayout
0 commit comments