diff --git a/.talismanrc b/.talismanrc index d938f27230..1b1812b1f1 100644 --- a/.talismanrc +++ b/.talismanrc @@ -1,6 +1,6 @@ fileignoreconfig: - filename: ios/Podfile.lock - checksum: cc123c3e1f04d41b394ceb16843b15c08bac3ba619ae853ff322717739761a85 + checksum: cc123c3e1f04d41b394ceb16843b15c08bac3ba619ae853ff322717739761a85 - filename: package.json checksum: fdd5905228a1afbfb004c710fd6c61adf073a12840200327c0592b76bea5e7e3 - filename: package-lock.json @@ -76,5 +76,6 @@ fileignoreconfig: checksum: a0686e9a5c006176fd720b84bc36ca947db1422caf65c90cd0c2d1102a9e96df - filename: ios/fastlane/Fastfile checksum: feea5a7f044ef6961d53e7d1e1ffb92a3e0f72761496424f6e64288e3718d605 +- filename: machines/bleShare/scan/scanMachine.ts + checksum: a514c958ca3da3c5b22a1a95ad680af8f05fb22638fab79b3842aa8fcc1b4a17 version: "" - diff --git a/locales/ara.json b/locales/ara.json index ff428a2a78..f90dbc3471 100644 --- a/locales/ara.json +++ b/locales/ara.json @@ -471,6 +471,7 @@ "enableBluetoothMessage": "يرجى تمكين أذونات البلوتوث لدعم المشاركة المحلية", "enableBluetoothButtonText": "السماح لأذونات البلوتوث", "scanningGuide": "امسك الهاتف بثبات وامسح رمز الاستجابة السريعة ضوئيًا", + "invalidQR": "يرجى مسح QR صالح", "sharingVc": "مشاركة بطاقة ", "errors": { "locationDisabled": { diff --git a/locales/en.json b/locales/en.json index afa5f55005..f07bf0d443 100644 --- a/locales/en.json +++ b/locales/en.json @@ -473,6 +473,7 @@ "enableBluetoothMessage": "Please enable bluetooth permissions to support local sharing", "enableBluetoothButtonText": "Allow bluetooth permissions", "scanningGuide": "Hold the phone steady and scan the QR code", + "invalidQR": "Please scan a valid QR", "errors": { "locationDisabled": { "message": "Location services must be enabled to share card", diff --git a/locales/fil.json b/locales/fil.json index f2c351bf67..7e68496444 100644 --- a/locales/fil.json +++ b/locales/fil.json @@ -475,6 +475,7 @@ "enableBluetoothMessage": "Mangyaring paganahin ang mga pahintulot ng bluetooth upang suportahan ang lokal na pagbabahagi", "enableBluetoothButtonText": "Payagan ang mga pahintulot ng bluetooth", "scanningGuide": "Panatilihin ang telepono at i-scan ang QR code", + "invalidQR": "Mangyaring mag-scan ng wastong QR", "errors": { "locationDisabled": { "message": "Dapat na nakabukas ang Location services ng iyong mobile para maaaring makapag-scan", diff --git a/locales/hin.json b/locales/hin.json index 4679524673..a8e7fd84b3 100644 --- a/locales/hin.json +++ b/locales/hin.json @@ -472,6 +472,7 @@ "enableBluetoothMessage": "कृपया स्थानीय साझाकरण का समर्थन करने के लिए ब्लूटूथ अनुमतियाँ सक्षम करें", "enableBluetoothButtonText": "ब्लूटूथ अनुमतियाँ दें", "scanningGuide": "फ़ोन को स्थिर रखें और QR कोड को स्कैन करें", + "invalidQR": "कृपया एक वैध क्यूआर स्कैन करें", "errors": { "locationDisabled": { "message": "स्थान सेवाओं को स्कैनिंग कार्यक्षमता के लिए सक्षम किया जाना चाहिए", diff --git a/locales/kan.json b/locales/kan.json index e19793ecea..0f70bfdb5d 100644 --- a/locales/kan.json +++ b/locales/kan.json @@ -470,6 +470,7 @@ "enableBluetoothMessage": "ದಯವಿಟ್ಟು ಸ್ಥಳೀಯ ಹಂಚಿಕೆಯನ್ನು ಬೆಂಬಲಿಸಲು ಬ್ಲೂಟೂತ್ ಅನುಮತಿಗಳನ್ನು ಸಕ್ರಿಯಗೊಳಿಸಿ", "enableBluetoothButtonText": "ಬ್ಲೂಟೂತ್ ಅನುಮತಿಗಳನ್ನು ಅನುಮತಿಸಿ", "scanningGuide": "ಫೋನ್ ಅನ್ನು ಸ್ಥಿರವಾಗಿ ಹಿಡಿದುಕೊಳ್ಳಿ ಮತ್ತು QR ಕೋಡ್ ಅನ್ನು ಸ್ಕ್ಯಾನ್ ಮಾಡಿ", + "invalidQR": "ದಯವಿಟ್ಟು ಮಾನ್ಯವಾದ QR ಅನ್ನು ಸ್ಕ್ಯಾನ್ ಮಾಡಿ", "errors": { "locationDisabled": { "message": "ಸ್ಕ್ಯಾನಿಂಗ್ ಕಾರ್ಯಕ್ಕಾಗಿ ಸ್ಥಳ ಸೇವೆಗಳನ್ನು ಸಕ್ರಿಯಗೊಳಿಸಬೇಕು", diff --git a/locales/spa.json b/locales/spa.json index da59717fa5..f469fdc5e7 100644 --- a/locales/spa.json +++ b/locales/spa.json @@ -889,6 +889,7 @@ "bluetoothStateIos": "Por favor, activa el Bluetooth desde el centro de control para admitir el intercambio local", "enableBluetoothMessage": "Por favor, habilita los permisos de Bluetooth para admitir el intercambio local", "enableBluetoothButtonText": "Permitir permisos de Bluetooth", + "invalidQR": "Por favor escanea un QR válido", "errors": { "locationDisabled": { "message": "Los servicios de ubicación deben estar habilitados para compartir la tarjeta", diff --git a/locales/tam.json b/locales/tam.json index 06333ea85b..5145cb9cd6 100644 --- a/locales/tam.json +++ b/locales/tam.json @@ -470,6 +470,7 @@ "enableBluetoothMessage": "உள்ளூர் பகிர்வை ஆதரிக்க புளூடூத் அனுமதிகளை இயக்கவும்", "enableBluetoothButtonText": "புளூடூத் அனுமதிகளை அனுமதிக்கவும்", "scanningGuide": "ஃபோனை நிலையாகப் பிடித்து, QR குறியீட்டை ஸ்கேன் செய்யவும்s", + "invalidQR": "ದಯವಿಟ್ಟು ಮಾನ್ಯವಾದ QR ಅನ್ನು ಸ್ಕ್ಯಾನ್ ಮಾಡಿ", "errors": { "locationDisabled": { "message": "ஸ்கேனிங் செயல்பாட்டிற்கு இருப்பிடச் சேவைகள் இயக்கப்பட வேண்டும்", diff --git a/machines/bleShare/scan/scanMachine.ts b/machines/bleShare/scan/scanMachine.ts index 6530fec2a6..353562b82e 100644 --- a/machines/bleShare/scan/scanMachine.ts +++ b/machines/bleShare/scan/scanMachine.ts @@ -402,23 +402,14 @@ export const scanMachine = { target: 'connecting', cond: 'isOpenIdQr', - actions: [ - 'sendVcSharingStartEvent', - 'setUri', - 'offlineaccepted', - ], + actions: ['sendVcSharingStartEvent', 'setUri'], }, { target: 'showQrLogin', cond: 'isQrLogin', - actions: [ - 'sendVcSharingStartEvent', - 'setLinkCode', - 'onlineaccepted', - ], + actions: ['sendVcSharingStartEvent', 'setLinkCode'], }, { - actions: 'invalidaccepted', target: 'invalid', }, ], @@ -732,9 +723,6 @@ export const scanMachine = }, { actions: { - offlineaccepted: () => console.log('>> offline QR accepted'), - onlineaccepted: () => console.log('>> online QR accepted'), - invalidaccepted: () => console.log('>> invalid QR accepted'), setChildRef: assign({ QrLoginRef: context => { const service = spawn( @@ -881,14 +869,9 @@ export const scanMachine = }), setLinkCode: assign({ - // TODO: set link code refactor required linkCode: (_context, event) => - event.params.substring( - event.params.indexOf('linkCode=') + 9, - event.params.indexOf('&'), - ), + new URL(event.params).searchParams.get('linkCode'), }), - setStayInProgress: assign({ stayInProgress: context => !context.stayInProgress, }), @@ -1190,11 +1173,13 @@ export const scanMachine = }, guards: { - isOpenIdQr: (_context, event) => event.params.includes('OPENID4VP://'), + // sample: 'OPENID4VP://connect:?name=OVPMOSIP&key=69dc92a2cc91f02258aa8094d6e2b62877f5b6498924fbaedaaa46af30abb364' + isOpenIdQr: (_context, event) => + event.params.startsWith('OPENID4VP://'), isQrLogin: (_context, event) => { try { let linkCode = new URL(event.params); - // does it have a linkCode & an linkExpireDateTime + // sample: 'inji://landing-page-name?linkCode=sTjp0XVH3t3dGCU&linkExpireDateTime=2023-11-09T06:56:18.482Z' return ( linkCode.searchParams.get('linkCode') && linkCode.searchParams.get('linkExpireDateTime') diff --git a/machines/bleShare/scan/scanMachine.typegen.ts b/machines/bleShare/scan/scanMachine.typegen.ts index e69de29bb2..ff138a9ceb 100644 --- a/machines/bleShare/scan/scanMachine.typegen.ts +++ b/machines/bleShare/scan/scanMachine.typegen.ts @@ -0,0 +1,241 @@ +// This file was automatically generated. Edits will be overwritten + +export interface Typegen0 { + '@@xstate/typegen': true; + internalEvents: { + '': {type: ''}; + 'done.invoke.QrLogin': { + type: 'done.invoke.QrLogin'; + data: unknown; + __tip: 'See the XState TS docs to learn how to strongly type this.'; + }; + 'done.invoke.scan.checkStorage:invocation[0]': { + type: 'done.invoke.scan.checkStorage:invocation[0]'; + data: unknown; + __tip: 'See the XState TS docs to learn how to strongly type this.'; + }; + 'done.invoke.scan.reviewing.creatingVp:invocation[0]': { + type: 'done.invoke.scan.reviewing.creatingVp:invocation[0]'; + data: unknown; + __tip: 'See the XState TS docs to learn how to strongly type this.'; + }; + 'xstate.after(CONNECTION_TIMEOUT)#scan.connecting.inProgress': { + type: 'xstate.after(CONNECTION_TIMEOUT)#scan.connecting.inProgress'; + }; + 'xstate.after(DESTROY_TIMEOUT)#scan.clearingConnection': { + type: 'xstate.after(DESTROY_TIMEOUT)#scan.clearingConnection'; + }; + 'xstate.after(SHARING_TIMEOUT)#scan.reviewing.sendingVc.inProgress': { + type: 'xstate.after(SHARING_TIMEOUT)#scan.reviewing.sendingVc.inProgress'; + }; + 'xstate.init': {type: 'xstate.init'}; + 'xstate.stop': {type: 'xstate.stop'}; + }; + invokeSrcNameMap: { + checkBluetoothPermission: 'done.invoke.scan.checkBluetoothPermission.checking:invocation[0]'; + checkBluetoothState: + | 'done.invoke.scan.checkBluetoothState.checking:invocation[0]' + | 'done.invoke.scan.recheckBluetoothState.checking:invocation[0]'; + checkLocationPermission: 'done.invoke.scan.checkingLocationService.checkingPermissionStatus:invocation[0]'; + checkNearByDevicesPermission: 'done.invoke.scan.checkNearbyDevicesPermission.checking:invocation[0]'; + checkStorageAvailability: 'done.invoke.scan.checkStorage:invocation[0]'; + createVp: 'done.invoke.scan.reviewing.creatingVp:invocation[0]'; + disconnect: + | 'done.invoke.scan.clearingConnection:invocation[0]' + | 'done.invoke.scan.disconnectDevice:invocation[0]'; + monitorConnection: 'done.invoke.scan:invocation[0]'; + requestBluetooth: 'done.invoke.scan.checkBluetoothState.requesting:invocation[0]'; + requestNearByDevicesPermission: 'done.invoke.scan.checkNearbyDevicesPermission.requesting:invocation[0]'; + requestToEnableLocationPermission: 'done.invoke.scan.checkingLocationService.requestToEnableLocation:invocation[0]'; + sendVc: 'done.invoke.scan.reviewing.sendingVc:invocation[0]'; + startConnection: 'done.invoke.scan.connecting:invocation[0]'; + }; + missingImplementations: { + actions: never; + delays: never; + guards: never; + services: never; + }; + eventsCausingActions: { + clearCreatedVp: + | '' + | 'BLE_ERROR' + | 'DISCONNECT' + | 'DISMISS' + | 'RESET' + | 'SCREEN_BLUR' + | 'SCREEN_FOCUS' + | 'xstate.stop'; + clearReason: + | '' + | 'BLE_ERROR' + | 'DISCONNECT' + | 'DISMISS' + | 'RESET' + | 'SCREEN_BLUR' + | 'SCREEN_FOCUS' + | 'xstate.stop'; + clearUri: + | 'DISCONNECT' + | 'DISMISS' + | 'xstate.after(DESTROY_TIMEOUT)#scan.clearingConnection'; + logFailedVerification: 'FACE_INVALID'; + logShared: 'VC_ACCEPTED'; + openAppPermission: 'GOTO_SETTINGS' | 'LOCATION_REQUEST'; + openBluetoothSettings: 'GOTO_SETTINGS'; + registerLoggers: + | 'DISCONNECT' + | 'DISMISS' + | 'xstate.after(DESTROY_TIMEOUT)#scan.clearingConnection'; + removeLoggers: + | 'DISCONNECT' + | 'DISMISS' + | 'SCREEN_BLUR' + | 'xstate.after(DESTROY_TIMEOUT)#scan.clearingConnection' + | 'xstate.init'; + resetShouldVerifyPresence: 'CANCEL' | 'CONNECTED' | 'DISMISS' | 'RETRY'; + sendBLEConnectionErrorEvent: 'BLE_ERROR'; + sendScanData: 'SCAN'; + sendVCShareFlowCancelEndEvent: 'CANCEL'; + sendVCShareFlowTimeoutEndEvent: 'CANCEL' | 'RETRY'; + sendVcShareSuccessEvent: 'VC_ACCEPTED'; + sendVcSharingStartEvent: 'SCAN'; + setBleError: 'BLE_ERROR'; + setChildRef: + | 'DISCONNECT' + | 'DISMISS' + | 'xstate.after(DESTROY_TIMEOUT)#scan.clearingConnection'; + setCreatedVp: 'done.invoke.scan.reviewing.creatingVp:invocation[0]'; + setLinkCode: 'SCAN'; + setPromptHint: 'CANCEL' | 'RETRY'; + setReadyForBluetoothStateCheck: 'BLUETOOTH_PERMISSION_ENABLED'; + setReason: 'UPDATE_REASON'; + setReceiverInfo: 'CONNECTED'; + setSelectedVc: 'SELECT_VC'; + setSenderInfo: 'CONNECTED'; + setShareLogTypeUnverified: 'ACCEPT_REQUEST'; + setShareLogTypeVerified: 'FACE_VALID'; + setStayInProgress: + | 'STAY_IN_PROGRESS' + | 'xstate.after(CONNECTION_TIMEOUT)#scan.connecting.inProgress' + | 'xstate.after(SHARING_TIMEOUT)#scan.reviewing.sendingVc.inProgress'; + setUri: 'SCAN'; + storeLoginItem: 'done.invoke.QrLogin'; + storingActivityLog: 'STORE_RESPONSE'; + toggleShouldVerifyPresence: 'TOGGLE_USER_CONSENT'; + }; + eventsCausingDelays: { + CONNECTION_TIMEOUT: 'SCAN'; + DESTROY_TIMEOUT: '' | 'DISMISS' | 'LOCATION_ENABLED'; + SHARING_TIMEOUT: + | 'ACCEPT_REQUEST' + | 'FACE_VALID' + | 'done.invoke.scan.reviewing.creatingVp:invocation[0]'; + }; + eventsCausingGuards: { + isIOS: 'BLUETOOTH_STATE_DISABLED' | 'START_PERMISSION_CHECK'; + isMinimumStorageRequiredForAuditEntryReached: 'done.invoke.scan.checkStorage:invocation[0]'; + isOpenIdQr: 'SCAN'; + isQrLogin: 'SCAN'; + uptoAndroid11: '' | 'START_PERMISSION_CHECK'; + }; + eventsCausingServices: { + QrLogin: 'SCAN'; + checkBluetoothPermission: + | '' + | 'BLUETOOTH_STATE_DISABLED' + | 'NEARBY_ENABLED' + | 'START_PERMISSION_CHECK'; + checkBluetoothState: '' | 'APP_ACTIVE'; + checkLocationPermission: '' | 'APP_ACTIVE'; + checkNearByDevicesPermission: 'APP_ACTIVE' | 'START_PERMISSION_CHECK'; + checkStorageAvailability: 'RESET' | 'SCREEN_FOCUS'; + createVp: never; + disconnect: '' | 'DISMISS' | 'LOCATION_ENABLED' | 'SCREEN_BLUR'; + monitorConnection: 'DISMISS' | 'SCREEN_BLUR' | 'xstate.init'; + requestBluetooth: 'BLUETOOTH_STATE_DISABLED'; + requestNearByDevicesPermission: 'NEARBY_DISABLED'; + requestToEnableLocationPermission: 'LOCATION_DISABLED'; + sendVc: + | 'ACCEPT_REQUEST' + | 'FACE_VALID' + | 'done.invoke.scan.reviewing.creatingVp:invocation[0]'; + startConnection: 'SCAN'; + }; + matchesStates: + | 'bluetoothDenied' + | 'bluetoothPermissionDenied' + | 'checkBluetoothPermission' + | 'checkBluetoothPermission.checking' + | 'checkBluetoothPermission.enabled' + | 'checkBluetoothState' + | 'checkBluetoothState.checking' + | 'checkBluetoothState.enabled' + | 'checkBluetoothState.requesting' + | 'checkNearbyDevicesPermission' + | 'checkNearbyDevicesPermission.checking' + | 'checkNearbyDevicesPermission.enabled' + | 'checkNearbyDevicesPermission.requesting' + | 'checkStorage' + | 'checkingLocationService' + | 'checkingLocationService.checkingPermissionStatus' + | 'checkingLocationService.denied' + | 'checkingLocationService.requestToEnableLocation' + | 'clearingConnection' + | 'connecting' + | 'connecting.inProgress' + | 'connecting.timeout' + | 'disconnectDevice' + | 'disconnected' + | 'findingConnection' + | 'handlingBleError' + | 'inactive' + | 'invalid' + | 'nearByDevicesPermissionDenied' + | 'recheckBluetoothState' + | 'recheckBluetoothState.checking' + | 'recheckBluetoothState.enabled' + | 'restrictSharingVc' + | 'reviewing' + | 'reviewing.accepted' + | 'reviewing.cancelling' + | 'reviewing.creatingVp' + | 'reviewing.invalidIdentity' + | 'reviewing.navigatingToHome' + | 'reviewing.rejected' + | 'reviewing.selectingVc' + | 'reviewing.sendingVc' + | 'reviewing.sendingVc.inProgress' + | 'reviewing.sendingVc.sent' + | 'reviewing.sendingVc.timeout' + | 'reviewing.verifyingIdentity' + | 'showQrLogin' + | 'showQrLogin.idle' + | 'showQrLogin.navigatingToHistory' + | 'showQrLogin.storing' + | 'startPermissionCheck' + | { + checkBluetoothPermission?: 'checking' | 'enabled'; + checkBluetoothState?: 'checking' | 'enabled' | 'requesting'; + checkNearbyDevicesPermission?: 'checking' | 'enabled' | 'requesting'; + checkingLocationService?: + | 'checkingPermissionStatus' + | 'denied' + | 'requestToEnableLocation'; + connecting?: 'inProgress' | 'timeout'; + recheckBluetoothState?: 'checking' | 'enabled'; + reviewing?: + | 'accepted' + | 'cancelling' + | 'creatingVp' + | 'invalidIdentity' + | 'navigatingToHome' + | 'rejected' + | 'selectingVc' + | 'sendingVc' + | 'verifyingIdentity' + | {sendingVc?: 'inProgress' | 'sent' | 'timeout'}; + showQrLogin?: 'idle' | 'navigatingToHistory' | 'storing'; + }; + tags: never; +} diff --git a/screens/Scan/ScanLayoutController.ts b/screens/Scan/ScanLayoutController.ts index 19812dbfa4..859d9c2c66 100644 --- a/screens/Scan/ScanLayoutController.ts +++ b/screens/Scan/ScanLayoutController.ts @@ -209,7 +209,6 @@ export function useScanLayout() { const isQrLoginDone = useSelector(scanService, selectIsQrLoginDone); useEffect(() => { - console.log('>> reviewing: ', isReviewing); if (isDone) { changeTabBarVisible('flex'); navigation.navigate(BOTTOM_TAB_ROUTES.home); diff --git a/screens/Scan/ScanScreen.tsx b/screens/Scan/ScanScreen.tsx index 24c35350e7..c1967e1141 100644 --- a/screens/Scan/ScanScreen.tsx +++ b/screens/Scan/ScanScreen.tsx @@ -1,11 +1,8 @@ import React, {useEffect, useState} from 'react'; import {useTranslation} from 'react-i18next'; -import { - ErrorMessageOverlay, - MessageOverlay, -} from '../../components/MessageOverlay'; +import {MessageOverlay} from '../../components/MessageOverlay'; import {QrScanner} from '../../components/QrScanner'; -import {Button, Centered, Column, Text} from '../../components/ui'; +import {Button, Centered, Column, Row, Text} from '../../components/ui'; import {Theme} from '../../components/ui/styleUtils'; import {QrLogin} from '../QrLogin/QrLogin'; import {useScanScreen} from './ScanScreenController'; @@ -171,12 +168,23 @@ export const ScanScreen: React.FC = () => { !controller.isEmpty && ( navigation.navigate(BOTTOM_TAB_ROUTES.scan)} - buttonText={t('common:tryAgain')} - customHeight={'auto'} - /> + title={t('invalidQR')} + customHeight={'auto'}> + +