Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion app/src/hooks/useFeedbackAutoHide.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,13 @@ export const useFeedbackAutoHide = () => {

// When screen goes out of focus, hide the feedback button
return () => {
hideFeedbackButton();
try {
hideFeedbackButton();
} catch (error) {
if (__DEV__) {
console.debug('Failed to hide feedback button:', error);
}
}
};
}, []),
);
Expand Down
47 changes: 33 additions & 14 deletions app/src/hooks/useFeedbackModal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,38 @@ export const useFeedbackModal = () => {
timeoutRef.current = null;
}

switch (type) {
case 'button':
showFeedbackButton();
break;
case 'widget':
showFeedbackWidget();
break;
case 'custom':
setIsVisible(true);
break;
default:
showFeedbackButton();
try {
switch (type) {
case 'button':
showFeedbackButton();
break;
case 'widget':
showFeedbackWidget();
break;
case 'custom':
setIsVisible(true);
break;
default:
showFeedbackButton();
}
} catch (error) {
if (__DEV__) {
console.debug('Failed to show feedback button/widget:', error);
}
setIsVisible(true);
}

// we can close the feedback modals(sentry and custom modals), but can't do so for the Feedback button.
// This hides the button after 10 seconds.
if (type === 'button') {
timeoutRef.current = setTimeout(() => {
hideFeedbackButton();
try {
hideFeedbackButton();
} catch (error) {
if (__DEV__) {
console.debug('Failed to hide feedback button:', error);
}
}
timeoutRef.current = null;
}, 10000);
}
Expand All @@ -57,7 +70,13 @@ export const useFeedbackModal = () => {
timeoutRef.current = null;
}

hideFeedbackButton();
try {
hideFeedbackButton();
} catch (error) {
if (__DEV__) {
console.debug('Failed to hide feedback button:', error);
}
}

setIsVisible(false);
}, []);
Expand Down
2 changes: 2 additions & 0 deletions app/src/integrations/nfc/nfcScanner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ interface Inputs {
usePacePolling?: boolean;
sessionId: string;
userId?: string;
skipReselect?: boolean;
}

interface DataGroupHash {
Expand Down Expand Up @@ -91,6 +92,7 @@ const scanAndroid = async (
canNumber: inputs.canNumber ?? '',
useCan: inputs.useCan ?? false,
sessionId: inputs.sessionId,
skipReselect: inputs.skipReselect ?? false,
});
};

Expand Down
5 changes: 5 additions & 0 deletions app/src/integrations/nfc/passportReader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ type ScanOptions = {
usePacePolling?: boolean;
sessionId?: string;
quality?: number;
skipReselect?: boolean;
};

export interface AndroidScanResponse {
Expand Down Expand Up @@ -91,6 +92,8 @@ if (Platform.OS === 'android') {
canNumber = '',
useCan = false,
quality = 1,
skipReselect = false,
sessionId,
} = options;

return androidScan({
Expand All @@ -100,6 +103,8 @@ if (Platform.OS === 'android') {
canNumber,
useCan,
quality,
skipReselect,
sessionId,
});
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ const NFC_METHODS = [
platform: ['ios'],
params: {},
},
{
key: 'skipReselect',
label: 'Skip Re-select',
description: 'Skip the re-select step after the NFC scan.',
platform: ['android'],
params: { skipReselect: true },
},
{
key: 'usePacePolling',
label: 'Use PACE Polling',
Expand Down
12 changes: 10 additions & 2 deletions app/src/screens/documents/scanning/DocumentNFCScanScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ const emitter =
: null;

type DocumentNFCScanRouteParams = {
skipReselect?: boolean;
usePacePolling?: boolean;
canNumber?: string;
useCan?: boolean;
Expand Down Expand Up @@ -326,8 +327,14 @@ const DocumentNFCScanScreen: React.FC = () => {
}, 30000);

try {
const { canNumber, useCan, skipPACE, skipCA, extendedMode } =
route.params ?? {};
const {
canNumber,
useCan,
skipPACE,
skipCA,
extendedMode,
skipReselect,
} = route.params ?? {};

await configureNfcAnalytics();
const scanResponse = await scan({
Expand All @@ -341,6 +348,7 @@ const DocumentNFCScanScreen: React.FC = () => {
extendedMode,
usePacePolling: isPacePolling,
sessionId: sessionIdRef.current,
skipReselect,
});

// Check if scan was cancelled by timeout
Expand Down
1 change: 1 addition & 0 deletions app/src/types/reactNativePassportReader.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ declare module 'react-native-passport-reader' {
useCan: boolean;
quality?: number;
sessionId?: string;
skipReselect?: boolean;
}

interface PassportReader {
Expand Down
Loading