diff --git a/.talismanrc b/.talismanrc index f63ec906..963221e5 100644 --- a/.talismanrc +++ b/.talismanrc @@ -24,22 +24,32 @@ fileignoreconfig: - filename: screens/AuthScreenController.ts checksum: 18af825821bc95e1056050623b804a5a8e7435b9e3383916a5d63024eeba9553 - filename: screens/WelcomeScreenController.ts - checksum: d8fe74404c80bf435459f4d20427a661fb622f0ee9f754345616abd346b98d14 -- filename: machines/VCItemMachine/ExistingMosipVCItem/ExistingMosipVCItemMachine.ts - checksum: 237a2640b7db70770d65da67c79f2929581e32f1162517e50b8d37e409f3387d -- filename: machines/store.ts - checksum: b9884f86b498dfbff75816d1f0d521c79971c8c28afa7824122d025b2699cdc4 -- filename: shared/cryptoutil/cryptoUtil.ts - checksum: b785ff3f01ab9530119072c4d38195048bfeee6155c54ea7dd031559acb722f3 + checksum: 71917c8c543a4a5b7ab61df259b785d233a80718123b0c8edf6ec81e1b3a81e0 - filename: shared/telemetry/TelemetryUtils.js checksum: ffe9aac2dcc590b98b0d588885c088eff189504ade653a77f74b67312bfd27ad - filename: shared/fileStorage.ts checksum: 07cb337dc1d5b0f0eef56270ac4f4f589260ee5e490183c024cf98a2aeafb139 - filename: shared/storage.ts checksum: c8d874aa373bdf526bf59192139822f56915e702ef673bac4e0d7549b0fea3d0 - checksum: f9711b617b986af9bb733a31373e49494667ef07b74988fbf09688cb50ca73bd +- filename: screens/Home/IntroSlidersScreen.tsx + checksum: 72ef913857448ef05763e52e32356faa2d1f3de8130a1c638d1897f44823031f +- filename: shared/commonUtil.ts + checksum: 01c3fdcd2f1c1757eae0c6a27fe04eb70c2aaf8660c604f3301997484592b66c +- filename: screens/Home/MyVcs/GetIdInputModal.tsx + checksum: 5c736ed79a372d0ffa7c02eb33d0dc06edbbb08d120978ff287f5f06cd6c7746 +- filename: shared/openId4VCI/Utils.ts + checksum: 2bd39d84099d700e5bddeebe87dfb3b0e3075edc0a4d06ce48b428b0a85e238f +- filename: machines/issuersMachine.ts + checksum: b925df13236145867fc7a1a2a703faca854e8c937dac9451008399e3937592fb +- filename: machines/issuersMachine.typegen.ts + checksum: f5e2c89f9029b1e590173e37b2cf6586d5229ecb7d4dfd4c5f050f9416d3c1cd - filename: machines/VCItemMachine/EsignetMosipVCItem/EsignetMosipVCItemMachine.ts checksum: eec77ca61540327ff7cab3489ebdfd47aa373fd20b3ff87a6c322cd48d35fe8f - filename: machines/VCItemMachine/EsignetMosipVCItem/EsignetMosipVCItemMachine.typegen.ts checksum: f1f504bd8c14496ee71f8eb7f40d54411cc05be03347d644dcc2cca187a20678 -version: "" +- filename: machines/VCItemMachine/ExistingMosipVCItem/ExistingMosipVCItemMachine.ts + checksum: 237a2640b7db70770d65da67c79f2929581e32f1162517e50b8d37e409f3387d +- filename: machines/store.ts + checksum: 0695d833df9ec1e1f6ae2bd81631630bb1039dec387718acb153bcb843c952cd +- filename: shared/cryptoutil/cryptoUtil.ts + checksum: b785ff3f01ab9530119072c4d38195048bfeee6155c54ea7dd031559acb722f3 \ No newline at end of file diff --git a/components/ActivityLogText.strings.json b/components/ActivityLogText.strings.json deleted file mode 100644 index aea85f32..00000000 --- a/components/ActivityLogText.strings.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "VC_SHARED": "shared", - "VC_RECEIVED": "received", - "VC_RECEIVED_NOT_SAVED": "received was not saved", - "VC_DELETED": "deleted", - "VC_DOWNLOADED": "downloaded", - "VC_REVOKED": "revoked", - "VC_SHARED_WITH_VERIFICATION_CONSENT": "shared. Consent is given for presence verification", - "VC_RECEIVED_WITH_PRESENCE_VERIFIED": "received. Presence verified", - "VC_RECEIVED_BUT_PRESENCE_VERIFICATION_FAILED": "received. Presence verification failed", - "PRESENCE_VERIFIED_AND_VC_SHARED": "verified and shared", - "PRESENCE_VERIFICATION_FAILED": "verification failed", - "QRLOGIN_SUCCESFULL": "QRLogin successful", - "WALLET_BINDING_SUCCESSFULL": "Activation successful", - "WALLET_BINDING_FAILURE": "Activation failed", - "VC_REMOVED": "Removed from wallet", - "TAMPERED_VC_REMOVED": "Some cards removed due to malicious activity" -} \ No newline at end of file diff --git a/components/DeviceInfoList.strings.json b/components/DeviceInfoList.strings.json deleted file mode 100644 index c532dd34..00000000 --- a/components/DeviceInfoList.strings.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "requestedBy": "Requested by", - "sentBy": "Sent by", - "deviceRefNumber": "Device reference number", - "name": "Name" -} \ No newline at end of file diff --git a/components/EditableListItem.tsx b/components/EditableListItem.tsx index 847b8a30..4a6443ee 100644 --- a/components/EditableListItem.tsx +++ b/components/EditableListItem.tsx @@ -38,16 +38,16 @@ export const EditableListItem: React.FC = props => { /> - + {props.title} - {props.content} + {props.content} void; progress?: boolean; errorMessage?: string; + titleColor: string; } interface ListItemProps { diff --git a/components/FaceScanner.strings.json b/components/FaceScanner.strings.json deleted file mode 100644 index 9e26dfee..00000000 --- a/components/FaceScanner.strings.json +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/components/FaceScanner.tsx b/components/FaceScanner.tsx index b32c1cc0..077b1b8d 100644 --- a/components/FaceScanner.tsx +++ b/components/FaceScanner.tsx @@ -26,6 +26,7 @@ import {GlobalContext} from '../shared/GlobalContext'; import {selectIsActive} from '../machines/app'; import {RotatingIcon} from './RotatingIcon'; import {Theme} from './ui/styleUtils'; +import {isIOS} from '../shared/constants'; export const FaceScanner: React.FC = props => { const {t} = useTranslation('FaceScanner'); @@ -130,7 +131,7 @@ export const FaceScanner: React.FC = props => { )} {/* TODO: remove warning when iOS SDK is ready */} - {Platform.OS === 'ios' && ( + {isIOS() && ( (face-matching in iOS is mocked) diff --git a/components/GlobalContextProvider.tsx b/components/GlobalContextProvider.tsx index d6b1af9c..94d8a2ae 100644 --- a/components/GlobalContextProvider.tsx +++ b/components/GlobalContextProvider.tsx @@ -1,8 +1,9 @@ import React from 'react'; import {useInterpret} from '@xstate/react'; -import {appMachine, logState} from '../machines/app'; +import {appMachine} from '../machines/app'; import {GlobalContext} from '../shared/GlobalContext'; +import {logState} from '../shared/commonUtil'; export const GlobalContextProvider: React.FC = props => { const appService = useInterpret(appMachine, {devTools: __DEV__}); diff --git a/components/OIDcAuth.strings.json b/components/OIDcAuth.strings.json deleted file mode 100644 index 6f2ae567..00000000 --- a/components/OIDcAuth.strings.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "title": "OIDC Authentication", - "text": "To be replaced with the OIDC provider UI", - "verify": "Verify" -} \ No newline at end of file diff --git a/components/PasscodeVerify.strings.json b/components/PasscodeVerify.strings.json deleted file mode 100644 index 4d6fc21f..00000000 --- a/components/PasscodeVerify.strings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "passcodeMismatchError": "Passcode did not match." -} \ No newline at end of file diff --git a/components/QrScanner.strings.json b/components/QrScanner.strings.json deleted file mode 100644 index 805911b6..00000000 --- a/components/QrScanner.strings.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "missingPermissionText": "This app uses the camera to scan the QR code of another device.", - "allowCameraButton": "Allow access to camera" -} \ No newline at end of file diff --git a/components/VC/MosipVCItem/MosipVCItemContent.tsx b/components/VC/MosipVCItem/MosipVCItemContent.tsx index bef5510a..090aeb61 100644 --- a/components/VC/MosipVCItem/MosipVCItemContent.tsx +++ b/components/VC/MosipVCItem/MosipVCItemContent.tsx @@ -323,7 +323,7 @@ export const MosipVCItemContent: React.FC< function faceImageSource() { return !verifiableCredential - ? Theme.ProfileIcon + ? Theme.cardFaceIcon : { uri: props.vcMetadata.isFromOpenId4VCI() ? verifiableCredential?.credentialSubject.face diff --git a/components/VC/MosipVCItem/MosipVCItemDetails.tsx b/components/VC/MosipVCItem/MosipVCItemDetails.tsx index 7c6cf997..014013ad 100644 --- a/components/VC/MosipVCItem/MosipVCItemDetails.tsx +++ b/components/VC/MosipVCItem/MosipVCItemDetails.tsx @@ -49,7 +49,7 @@ const getProfileImage = ( return {uri: props.vc?.credential.biometrics.face}; } } - return Theme.ProfileIcon; + return Theme.cardFaceIcon; }; export const MosipVCItemDetails: React.FC< diff --git a/components/VcDetails.strings.json b/components/VcDetails.strings.json deleted file mode 100644 index d6e3189a..00000000 --- a/components/VcDetails.strings.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "generatedOn": "Generated On", - "status": "Status", - "valid": "Valid", - "photo": "Photo", - "fullName": "Full Name", - "gender": "Gender", - "dateOfBirth": "Date of Birth", - "phoneNumber": "Phone Number", - "email": "Email", - "address": "Address", - "reasonForSharing": "Reason for sharing", - "idType": "ID Type", - "id": "Id", - "nationalCard": "National Card", - "uin": "UIN", - "vid": "VID", - "enableVerification": "Enable Verification", - "profileAuthenticated": "Profile is authenticated!", - "offlineAuthDisabledHeader": "Offline Authentication disabled!", - "offlineAuthDisabledMessage": "Click 'Enable Authentication' to enable this credentials to be used for offline authentication." -} diff --git a/components/ui/Loader.tsx b/components/ui/Loader.tsx index 26856fa1..ccb11564 100644 --- a/components/ui/Loader.tsx +++ b/components/ui/Loader.tsx @@ -26,7 +26,7 @@ export const Loader: React.FC = props => { {props.subTitle && ( {props.subTitle} diff --git a/components/ui/Modal.tsx b/components/ui/Modal.tsx index 56d96d7e..713a777f 100644 --- a/components/ui/Modal.tsx +++ b/components/ui/Modal.tsx @@ -57,7 +57,7 @@ export const Modal: React.FC = props => { color={ props.headerLabelColor ? props.headerLabelColor - : Theme.Colors.profileLanguageValue + : Theme.Colors.textLabel }> {props.headerLabel} diff --git a/components/ui/themes/DefaultTheme.ts b/components/ui/themes/DefaultTheme.ts index 3ad8d6a8..2822276a 100644 --- a/components/ui/themes/DefaultTheme.ts +++ b/components/ui/themes/DefaultTheme.ts @@ -1,6 +1,7 @@ /* eslint-disable sonarjs/no-duplicate-string */ import {Dimensions, Platform, StyleSheet, ViewStyle} from 'react-native'; import {Spacing} from '../styleUtils'; +import {isIOS} from '../../../shared/constants'; const Colors = { Black: '#000000', @@ -61,11 +62,7 @@ export const DefaultTheme = { borderBottomColor: Colors.Grey6, whiteBackgroundColor: Colors.White, lightGreyBackgroundColor: Colors.LightGrey, - profileLanguageValue: Colors.Grey, aboutVersion: Colors.Gray40, - profileAuthFactorUnlock: Colors.Grey, - profileLabel: Colors.Black, - profileValue: Colors.Grey, switchHead: Colors.Orange, switchTrackTrue: Colors.LightOrange, switchTrackFalse: Colors.Grey, @@ -89,7 +86,6 @@ export const DefaultTheme = { OnboardingCloseIcon: Colors.White, WarningIcon: Colors.Warning, DefaultToggle: Colors.LightOrange, - ProfileIconBg: Colors.LightOrange, GrayText: Colors.GrayText, errorGrayText: Colors.mediumDarkGrey, gradientBtn: ['#F59B4B', '#E86E04'], @@ -108,6 +104,8 @@ export const DefaultTheme = { statusMessage: Colors.Gray40, blackIcon: Colors.Black, uncheckedIcon: Colors.uncheckedIcon, + settingsLabel: Colors.Black, + chevronRightColor: Colors.Grey, }, Styles: StyleSheet.create({ title: { @@ -499,9 +497,9 @@ export const DefaultTheme = { width: Dimensions.get('window').width * 0.32, borderBottomWidth: 1, marginBottom: 2, - borderColor: Platform.OS === 'ios' ? 'transparent' : Colors.Grey, - bottom: Platform.OS === 'ios' ? 50 : 24, - height: Platform.OS === 'ios' ? 100 : 'auto', + borderColor: isIOS() ? 'transparent' : Colors.Grey, + bottom: isIOS() ? 50 : 24, + height: isIOS() ? 100 : 'auto', }, idInputBottom: { borderBottomColor: Colors.Orange, @@ -1236,7 +1234,7 @@ export const DefaultTheme = { CardBackground: require('../../../assets/card_bg.png'), OpenCard: require('../../../assets/card_bg.png'), activationPending: require('../../../assets/pending_activation.png'), - ProfileIcon: require('../../../assets/placeholder-photo.png'), + cardFaceIcon: require('../../../assets/placeholder-photo.png'), MosipSplashLogo: require('../../../assets/icon.png'), MosipLogo: require('../../../assets/mosip-logo.png'), CameraFlipIcon: require('../../../assets/camera-flip-icon.png'), @@ -1306,17 +1304,16 @@ export const DefaultTheme = { }; function generateBoxShadowStyle() { - if (Platform.OS === 'ios') { + if (isIOS()) { return { shadowColor: '#000', shadowOffset: {width: 1, height: 1.2}, shadowOpacity: 0.3, shadowRadius: 2.5, }; - } else if (Platform.OS === 'android') { - return { - elevation: 4, - shadowColor: '#000', - }; } + return { + elevation: 4, + shadowColor: '#000', + }; } diff --git a/components/ui/themes/PurpleTheme.ts b/components/ui/themes/PurpleTheme.ts index e25ab9f4..348cdc44 100644 --- a/components/ui/themes/PurpleTheme.ts +++ b/components/ui/themes/PurpleTheme.ts @@ -1,6 +1,7 @@ /* eslint-disable sonarjs/no-duplicate-string */ import {Dimensions, Platform, StyleSheet, ViewStyle} from 'react-native'; import {Spacing} from '../styleUtils'; +import {isIOS} from '../../../shared/constants'; const Colors = { Black: '#231F20', @@ -64,11 +65,7 @@ export const PurpleTheme = { whiteBackgroundColor: Colors.White, lightGreyBackgroundColor: Colors.LightGrey, errorGrayText: Colors.mediumDarkGrey, - profileLanguageValue: Colors.Grey, aboutVersion: Colors.Gray40, - profileAuthFactorUnlock: Colors.Grey, - profileLabel: Colors.Black, - profileValue: Colors.Grey, switchHead: Colors.Purple, switchTrackTrue: Colors.LightPurple, switchTrackFalse: Colors.Grey, @@ -92,7 +89,6 @@ export const PurpleTheme = { OnboardingCloseIcon: Colors.White, WarningIcon: Colors.Warning, DefaultToggle: Colors.LightPurple, - ProfileIconBg: Colors.LightPurple, GrayText: Colors.GrayText, gradientBtn: Colors.GradientColors, dotColor: Colors.dorColor, @@ -110,6 +106,8 @@ export const PurpleTheme = { statusMessage: Colors.Gray40, blackIcon: Colors.Black, uncheckedIcon: Colors.uncheckedIcon, + settingsLabel: Colors.Black, + chevronRightColor: Colors.Grey, }, Styles: StyleSheet.create({ title: { @@ -501,9 +499,9 @@ export const PurpleTheme = { width: Dimensions.get('window').width * 0.32, borderBottomWidth: 1, marginBottom: 2, - borderColor: Platform.OS === 'ios' ? 'transparent' : Colors.Grey, - bottom: Platform.OS === 'ios' ? 50 : 24, - height: Platform.OS === 'ios' ? 100 : 'auto', + borderColor: isIOS() ? 'transparent' : Colors.Grey, + bottom: isIOS() ? 50 : 24, + height: isIOS() ? 100 : 'auto', }, idInputBottom: { borderBottomColor: Colors.Orange, @@ -1234,7 +1232,7 @@ export const PurpleTheme = { CardBackground: require('../../../assets/card_bg.png'), OpenCard: require('../../../assets/card_bg.png'), activationPending: require('../../../assets/pending_activation.png'), - ProfileIcon: require('../../../purpleAssets/profile_icon.png'), + cardFaceIcon: require('../../../purpleAssets/profile_icon.png'), MosipSplashLogo: require('../../../assets/icon.png'), MosipLogo: require('../../../assets/mosip-logo.png'), CameraFlipIcon: require('../../../assets/camera-flip-icon.png'), @@ -1304,17 +1302,16 @@ export const PurpleTheme = { }; function generateBoxShadowStyle() { - if (Platform.OS === 'ios') { + if (isIOS()) { return { shadowColor: '#000', shadowOffset: {width: 1, height: 1.2}, shadowOpacity: 0.3, shadowRadius: 2.5, }; - } else if (Platform.OS === 'android') { - return { - elevation: 4, - shadowColor: '#000', - }; } + return { + elevation: 4, + shadowColor: '#000', + }; } diff --git a/locales/ara.json b/locales/ara.json index 237416ce..5b263d0b 100644 --- a/locales/ara.json +++ b/locales/ara.json @@ -357,11 +357,6 @@ "confirmPasscode": "قم بتأكيد رمز المرور", "enterPasscode": "أدخل رمز المرور الخاص" }, - "AppMetaData": { - "header": "حول إنجي", - "version": "الإصدار", - "useBle": "مدعوم من BLE" - }, "QrLogin": { "title": "QR تسجيل الدخول", "alignQr": "قم بمحاذاة رمز الاستجابة السريعة داخل الإطار للمسح الضوئي", diff --git a/locales/en.json b/locales/en.json index a1801327..9d988ac6 100644 --- a/locales/en.json +++ b/locales/en.json @@ -364,11 +364,6 @@ "confirmPasscode": "Confirm passcode", "enterPasscode": "Enter your passcode" }, - "AppMetaData": { - "header": "About Inji", - "version": "Version", - "useBle": "Powered by BLE" - }, "QrLogin": { "title": "QR Login", "alignQr": "Align the QR code within the frame to scan", diff --git a/locales/fil.json b/locales/fil.json index dae27bd6..7afa6f18 100644 --- a/locales/fil.json +++ b/locales/fil.json @@ -356,11 +356,6 @@ "confirmPasscode": "Kumpirmahin ang passcode", "enterPasscode": "Ilagay ang iyong passcode" }, - "AppMetaData": { - "header": "Tungkol kay Inji", - "version": "Bersyon", - "useBle": "Pinapatakbo ng BLE" - }, "QrLogin": { "title": "QR Login", "alignQr": "I-align ang QR code sa loob ng frame para i-scan", diff --git a/locales/hin.json b/locales/hin.json index 9b4cb72b..7a84f002 100644 --- a/locales/hin.json +++ b/locales/hin.json @@ -356,11 +356,6 @@ "confirmPasscode": "पासकोड की पुष्टि करें", "enterPasscode": "अपना पासकोड प्रविष्ट करें" }, - "AppMetaData": { - "header": "इंजी के बारे में", - "version": "संस्करण", - "useBle": "BLE द्वारा संचालित" - }, "QrLogin": { "title": "क्यूआर लॉगिन", "alignQr": "स्कैन करने के लिए फ्रेम के भीतर क्यूआर कोड को संरेखित करें", diff --git a/locales/kan.json b/locales/kan.json index e7ba9b20..208f50ca 100644 --- a/locales/kan.json +++ b/locales/kan.json @@ -353,11 +353,6 @@ "confirmPasscode": "ನಿಮ್ಮ ಪಾಸ್ಕೋಡ್ ಅನ್ನು ದೃಢೀಕರಿಸಿ", "enterPasscode": "ನಿಮ್ಮ ಪಾಸ್ಕೋಡ್ ನಮೂದಿಸಿ" }, - "AppMetaData": { - "header": "ಇಂಜಿ ಬಗ್ಗೆ", - "version": "ಆವೃತ್ತಿ", - "useBle": "BLE ನಿಂದ ನಡೆಸಲ್ಪಡುತ್ತಿದೆ" - }, "QrLogin": { "title": "QR ಲಾಗಿನ್", "alignQr": "ಸ್ಕ್ಯಾನ್ ಮಾಡಲು ಚೌಕಟ್ಟಿನೊಳಗೆ QR ಕೋಡ್ ಅನ್ನು ಹೊಂದಿಸಿ", diff --git a/locales/spa.json b/locales/spa.json index 820639c3..b37dee07 100644 --- a/locales/spa.json +++ b/locales/spa.json @@ -254,11 +254,6 @@ "confirmPasscode": "Confirma tu código de acceso", "enterPasscode": "Ingresa tu código de acceso" }, - "AppMetaData": { - "header": "Acerca de Inji", - "version": "Versión", - "useBle": "Impulsado por BLE" - }, "SettingScreen": { "header": "Ajustes", "injiAsVerifierApp": "Inji como aplicación verificadora", @@ -734,11 +729,6 @@ "confirmPasscode": "Confirma tu código de acceso", "enterPasscode": "Ingresa tu código de acceso" }, - "AppMetaData": { - "header": "Acerca de Inji", - "version": "Versión", - "useBle": "Impulsado por BLE" - }, "SettingScreen": { "header": "Ajustes", "injiAsVerifierApp": "Inji como aplicación verificadora", diff --git a/locales/tam.json b/locales/tam.json index 6efc6e45..b4184575 100644 --- a/locales/tam.json +++ b/locales/tam.json @@ -353,11 +353,6 @@ "confirmPasscode": "கடவுக்குறியீட்டை உறுதிப்படுத்தவும்", "enterPasscode": "உங்கள் கடவுக்குறியீட்டை உள்ளிடவும்" }, - "AppMetaData": { - "header": "இன்ஜி பற்றி", - "version": "பதிப்பு", - "useBle": "BLE ஆல் இயக்கப்படுகிறது" - }, "QrLogin": { "title": "QR உள்நுழைவு", "alignQr": "ஸ்கேன் செய்ய ஃப்ரேமுக்குள் QR குறியீட்டை சீரமைக்கவும்", diff --git a/machines/app.ts b/machines/app.ts index fc86c93a..69833e28 100644 --- a/machines/app.ts +++ b/machines/app.ts @@ -1,17 +1,13 @@ import NetInfo, {NetInfoStateType} from '@react-native-community/netinfo'; import {AppState, AppStateStatus, Platform} from 'react-native'; -import { - getDeviceId, - getDeviceName, - getDeviceNameSync, -} from 'react-native-device-info'; -import {EventFrom, spawn, StateFrom, send, assign, AnyState} from 'xstate'; +import {getDeviceId, getDeviceName} from 'react-native-device-info'; +import {assign, EventFrom, send, spawn, StateFrom} from 'xstate'; import {createModel} from 'xstate/lib/model'; import {authMachine, createAuthMachine} from './auth'; import {createSettingsMachine, settingsMachine} from './settings'; import {StoreEvents, storeMachine} from './store'; import {createVcMachine, vcMachine} from './vc'; -import {createActivityLogMachine, activityLogMachine} from './activityLog'; +import {activityLogMachine, createActivityLogMachine} from './activityLog'; import { createRequestMachine, requestMachine, @@ -20,19 +16,19 @@ import {createScanMachine, scanMachine} from './bleShare/scan/scanMachine'; import {createRevokeMachine, revokeVidsMachine} from './revoke'; import {pure, respond} from 'xstate/lib/actions'; import {AppServices} from '../shared/GlobalContext'; -import {request} from '../shared/request'; import { changeCrendetialRegistry, - SETTINGS_STORE_KEY, - MIMOTO_BASE_URL, - ESIGNET_BASE_URL, changeEsignetUrl, + ESIGNET_BASE_URL, + isAndroid, + MIMOTO_BASE_URL, + SETTINGS_STORE_KEY, } from '../shared/constants'; +import {logState} from '../shared/commonUtil'; const model = createModel( { info: {} as AppInfo, - backendInfo: {} as BackendInfo, serviceRefs: {} as AppServices, isReadError: false, isDecryptError: false, @@ -51,7 +47,6 @@ const model = createModel( REQUEST_DEVICE_INFO: () => ({}), READY: (data?: unknown) => ({data}), APP_INFO_RECEIVED: (info: AppInfo) => ({info}), - BACKEND_INFO_RECEIVED: (info: BackendInfo) => ({info}), STORE_RESPONSE: (response: unknown) => ({response}), RESET_KEY_INVALIDATE_ERROR_DISMISS: () => ({}), }, @@ -135,19 +130,8 @@ export const appMachine = model.createMachine( }, on: { APP_INFO_RECEIVED: { - target: 'devinfo', - actions: ['setAppInfo'], - }, - }, - }, - devinfo: { - invoke: { - src: 'getBackendInfo', - }, - on: { - BACKEND_INFO_RECEIVED: { target: '#ready', - actions: ['setBackendInfo'], + actions: ['setAppInfo'], }, }, }, @@ -286,7 +270,7 @@ export const appMachine = model.createMachine( scanMachine.id, ); - if (Platform.OS === 'android') { + if (isAndroid()) { serviceRefs.request = spawn( createRequestMachine(serviceRefs), requestMachine.id, @@ -310,7 +294,7 @@ export const appMachine = model.createMachine( context.serviceRefs.activityLog.subscribe(logState); context.serviceRefs.scan.subscribe(logState); - if (Platform.OS === 'android') { + if (isAndroid()) { context.serviceRefs.request.subscribe(logState); } @@ -322,10 +306,6 @@ export const appMachine = model.createMachine( info: (_, event) => event.info, }), - setBackendInfo: model.assign({ - backendInfo: (_, event) => event.info, - }), - loadCredentialRegistryHostFromStorage: send( StoreEvents.GET(SETTINGS_STORE_KEY), { @@ -363,23 +343,6 @@ export const appMachine = model.createMachine( callback(model.events.APP_INFO_RECEIVED(appInfo)); }, - getBackendInfo: () => async callback => { - let backendInfo = { - application: { - name: '', - version: '', - }, - build: {}, - config: {}, - }; - try { - backendInfo = await request('GET', '/residentmobileapp/info'); - callback(model.events.BACKEND_INFO_RECEIVED(backendInfo)); - } catch { - callback(model.events.BACKEND_INFO_RECEIVED(backendInfo)); - } - }, - checkFocusState: () => callback => { const changeHandler = (newState: AppStateStatus) => { switch (newState) { @@ -398,8 +361,7 @@ export const appMachine = model.createMachine( AppState.addEventListener('change', changeHandler); - // android only - if (Platform.OS === 'android') { + if (isAndroid()) { AppState.addEventListener('blur', blurHandler); AppState.addEventListener('focus', focusHandler); } @@ -407,7 +369,7 @@ export const appMachine = model.createMachine( return () => { AppState.removeEventListener('change', changeHandler); - if (Platform.OS === 'android') { + if (isAndroid()) { AppState.removeEventListener('blur', blurHandler); AppState.removeEventListener('focus', focusHandler); } @@ -432,25 +394,11 @@ interface AppInfo { deviceName: string; } -interface BackendInfo { - application: { - name: string; - version: string; - }; - build: object; - config: object; -} - type State = StateFrom; export function selectAppInfo(state: State) { return state.context.info; } - -export function selectBackendInfo(state: State) { - return state.context.backendInfo; -} - export function selectIsReady(state: State) { return state.matches('ready'); } @@ -467,28 +415,6 @@ export function selectIsFocused(state: State) { return state.matches('ready.focus'); } -export function logState(state: AnyState) { - const data = JSON.stringify( - state.event, - (key, value) => { - if (key === 'type') return undefined; - if (typeof value === 'string' && value.length >= 100) { - return value.slice(0, 100) + '...'; - } - return value; - }, - 2, - ); - console.log( - `[${getDeviceNameSync()}] ${state.machine.id}: ${ - state.event.type - } -> ${state.toStrings().pop()}\n${ - data.length > 300 ? data.slice(0, 300) + '...' : data - } - `, - ); -} - export function selectIsReadError(state: State) { return state.context.isReadError; } diff --git a/machines/biometrics.ts b/machines/biometrics.ts index 47eea187..648b8646 100644 --- a/machines/biometrics.ts +++ b/machines/biometrics.ts @@ -2,6 +2,7 @@ import {createModel} from 'xstate/lib/model'; import * as LocalAuthentication from 'expo-local-authentication'; import {EventFrom, MetaObject, StateFrom} from 'xstate'; import {Platform} from 'react-native'; +import {isAndroid} from '../shared/constants'; // ----- CREATE MODEL --------------------------------------------------------- const model = createModel( @@ -99,7 +100,7 @@ export const biometricsMachine = model.createMachine( authenticating: { invoke: { src: () => async () => { - if (Platform.OS === 'android') { + if (isAndroid()) { await LocalAuthentication.cancelAuthenticate(); } const res = await LocalAuthentication.authenticateAsync({ diff --git a/machines/bleShare/request/requestMachine.ts b/machines/bleShare/request/requestMachine.ts index 8ccb26f3..5282ad70 100644 --- a/machines/bleShare/request/requestMachine.ts +++ b/machines/bleShare/request/requestMachine.ts @@ -14,7 +14,7 @@ import {getDeviceNameSync} from 'react-native-device-info'; import {StoreEvents} from '../../store'; import {VC} from '../../../types/VC/ExistingMosipVC/vc'; import {AppServices} from '../../../shared/GlobalContext'; -import {RECEIVED_VCS_STORE_KEY} from '../../../shared/constants'; +import {isAndroid, RECEIVED_VCS_STORE_KEY} from '../../../shared/constants'; import {ActivityLogEvents, ActivityLogType} from '../../activityLog'; import {VcEvents} from '../../vc'; import {subscribe} from '../../../shared/openIdBLE/verifierEventHandler'; @@ -736,7 +736,7 @@ export const requestMachine = }, checkNearByDevicesPermission: () => callback => { - if (Platform.OS === 'android' && Platform.Version >= 31) { + if (isAndroid() && Platform.Version >= 31) { const result = checkMultiple([ PERMISSIONS.ANDROID.BLUETOOTH_ADVERTISE, PERMISSIONS.ANDROID.BLUETOOTH_CONNECT, diff --git a/machines/bleShare/scan/scanMachine.ts b/machines/bleShare/scan/scanMachine.ts index 98c314e2..ffe291e2 100644 --- a/machines/bleShare/scan/scanMachine.ts +++ b/machines/bleShare/scan/scanMachine.ts @@ -17,7 +17,7 @@ import {getDeviceNameSync} from 'react-native-device-info'; import {VC, VerifiablePresentation} from '../../../types/VC/ExistingMosipVC/vc'; import {AppServices} from '../../../shared/GlobalContext'; import {ActivityLogEvents, ActivityLogType} from '../../activityLog'; -import {MY_LOGIN_STORE_KEY} from '../../../shared/constants'; +import {isAndroid, isIOS, MY_LOGIN_STORE_KEY} from '../../../shared/constants'; import {subscribe} from '../../../shared/openIdBLE/walletEventHandler'; import { check, @@ -38,7 +38,6 @@ import {StoreEvents} from '../../store'; import {WalletDataEvent} from 'react-native-tuvali/lib/typescript/types/events'; import {BLEError} from '../types'; import Storage from '../../../shared/storage'; -import {logState} from '../../app'; import {VCMetadata} from '../../../shared/VCMetadata'; import { getStartEventData, @@ -46,6 +45,7 @@ import { sendStartEvent, sendEndEvent, } from '../../../shared/telemetry/TelemetryUtils'; +import {logState} from '../../../shared/commonUtil'; const {wallet, EventTypes, VerificationStatus} = tuvali; @@ -721,7 +721,7 @@ export const scanMachine = value: context.linkCode, }), openBluetoothSettings: () => { - Platform.OS === 'android' + isAndroid() ? BluetoothStateManager.openSettings().catch() : Linking.openURL('App-Prefs:Bluetooth'); }, @@ -905,7 +905,7 @@ export const scanMachine = // Passing Granted for android since permission status is always granted even if its denied. let response: PermissionStatus = RESULTS.GRANTED; - if (Platform.OS === 'ios') { + if (isIOS()) { response = await check(PERMISSIONS.IOS.BLUETOOTH_PERIPHERAL); } @@ -1107,9 +1107,9 @@ export const scanMachine = } }, - uptoAndroid11: () => Platform.OS === 'android' && Platform.Version < 31, + uptoAndroid11: () => isAndroid() && Platform.Version < 31, - isIOS: () => Platform.OS === 'ios', + isIOS: () => isIOS(), isMinimumStorageRequiredForAuditEntryReached: (_context, event) => Boolean(event.data), diff --git a/machines/issuersMachine.ts b/machines/issuersMachine.ts index 71844cd1..7d5607ef 100644 --- a/machines/issuersMachine.ts +++ b/machines/issuersMachine.ts @@ -1,7 +1,11 @@ import {authorize, AuthorizeResult} from 'react-native-app-auth'; import {assign, EventFrom, send, sendParent, StateFrom} from 'xstate'; import {createModel} from 'xstate/lib/model'; -import {MY_VCS_STORE_KEY} from '../shared/constants'; +import { + MY_VCS_STORE_KEY, + NETWORK_REQUEST_FAILED, + REQUEST_TIMEOUT, +} from '../shared/constants'; import {StoreEvents} from './store'; import {AppServices} from '../shared/GlobalContext'; import NetInfo from '@react-native-community/netinfo'; @@ -23,8 +27,8 @@ import { updateCredentialInformation, constructAuthorizationConfiguration, getVCMetadata, + Issuers_Key_Ref, } from '../shared/openId4VCI/Utils'; -import {NETWORK_REQUEST_FAILED, REQUEST_TIMEOUT} from '../shared/constants'; import {VCMetadata} from '../shared/VCMetadata'; import { getEndEventData, @@ -71,7 +75,6 @@ const model = createModel( export const IssuerScreenTabEvents = model.events; export const Issuer_Tab_Ref_Id = 'issuersMachine'; -export const Issuers_Key_Ref = 'OpenId4VCI_KeyPair'; export const IssuersMachine = model.createMachine( { /** @xstate-layout N4IgpgJg5mDOIC5QEtawK5gE6wLIEMBjAC2QDswA6CVABwBt8BPASTUxwGIIB7Cy8gDceAayqoM2PEVL8asBszaScCIT0L4ALsj4BtAAwBdQ0cShaPWMh19zIAB6IALAEYAnJWfuAzM4BsAKwAHN7BwQDsfgA0IEyIAEw+Ea6UBgkRwT7uEekGrhHOAL5FsRIc0iTkVPKKrOxSnNhYPFiUiloAZq0AtgINOARVcnSM9SqwamTCmrZkpqb2ltZz9k4Izgme3n5Boe7hUc6x8QgJ3gZpgT6BgRH+yYWBJWUDlbJUza2cACoASgBNAD6AEEAOIglgAOUWSBAyxsujIaxcWy8vgCITCkRicUSIQSlGyCQMETu7n84QKLxA5SkQw+lC+WF+gNBEOhelcZjhCNWcPWrgSJ0QQppdMGMmqTKwLRZ-2B4MhMISPIsVkRdgFooMvjS-jc9wezl1ARFZwiCUClFcN3czmcKWuPnFbwZ0uZnD+AFEAMren5A71-P4AeT+sPVKyRKIQrgMwX8lASCWCgVcgW8lt15oyEU8CSCloz6WcN38rom7v4sDA9DAhB0ZCgyg4nAAIqGAOpQgAyoZB7aBLHbkfhGv5oHWPgMBmclEigQM-lTVpyc9z+R8yfzriyPhTS4zlYq1aotfrjfILYGnH9ve9AGEft6hyxfb6AKrBsd8mPahBAmFPEEB8VwhS8XVkgKA5dXcE96SlOQeAAdzIegeHwCBW2wR8+E6ZAoG4PhxGmURxDdJCalQ9DMOwgY8LIAioCmGZtCRBZjCWCd-ynUVgNOMVSlpSjhmotCMKwnCsEY5imllVp2kYLpen6KsqOoGjJPolRZMI1iNHY-RjF-HitT4jYUwXZwgMpFMfHCGcIlze15zuFdghyA5UweBDJTEygSAbEQWDILRsAoLRiP4dQxEC4hgtC8KsEi0zo3MxxRVuQlLUCdxdUzbIhX8c14w8Iky1ucI1zTYI-PeaUgsIEKwoisAot4GKyLipqWuS1LuW49LkQA4I0SFdxwOXO1-HSUrbUuLZSX8XwMn8Vwy3qs94sS1qUva+S5SU7RuiwPpeqStqtDSzURos4IIMpB5i1moCHPNSbgi8QIDXcPLcltDIto0i69simU5QSVlFQ5GEuN5My7syuNkiTfJJvyDwiyCUrZ2tPwbimoDMhuYGAtobBTp6EF0C0YhWmQAAvIyyGi0jhDiiUGv4CmsCpmm6YZ5m5gM2YOJM+Go1u2NbJtFbJoyN7U3cc0V2tbxXH8FdHSPe0ycZXn+dp+msCZlnDsUjoqbU08NMN3oBZNs2RfUMXjJMSXx2GmXNbl9wFbJJJlfNB6bUiLYbiW-KIgifXpXts7HaF83mWOlSzptxDycph3jeTl2yLd+YTMGhHvYA64k01-2hUDg9PNK5J52CAwZ3TQpwNj4Sue23qAGkwCYAAFfBkBZR8AAknz7oE++9YEh8hCNPb-DLBTnKuPD+h15cKc0qptDaMcibxnm70TGX7weR7HzhJ+n2f56BReWAjUupcnZH4x8Tf-czAJ-Z7xAskS4YFiQeXOJ5F0591IBRgBQLA2gwAD2HqPFknV2bkUzv5Rk8DsBIJQTfLAosWacTVF7aWAECjZEoPlTy6Z1o5HOOaPwqRqoOQyGNTMKY478DwYg8KhC0FswEN1CisDcFgAQQQ6+aCSFzAWO-Chn9BRRE8HQv6msPCWmOCBFMhI0xBH8DHMkOQyS8PErRLCj4sCQCkTofA9BYAiNiuI22AVeASTojYuxYVkCOMmK7UhEtyGryRusGyER9SWgpIVCkYFAi5j3EmG4CZW4OSbsUGB7jGSeKsRAHxEB7H+KcRbNoVtVI9w0nk7ShTikBPkeLD2oTEaxkidErYQQyzxIzLmThlBKSrQzJsKkFjNJeOsbYopfiAl3xBFCR83pew3RUS4R0HTYndIeL0kCe4ogVSyB4ByMcNpjMENgZAnQmDXjqTM+gLixHYO5lQc5psrk3KmfU+gjT3YrN4l-eMnguF3HOAkDMDlEl6ITFXYxDosjnCONA14EjpSvMudc5styHH3NThUjOVSApoveZiz5dyfnF2aUNShFkppAqtCCzY4K0x9IMNafMDCDgPBJAeMZyAID1jvqGXAQ8HwvlHCvVpVC1ZeG5VsVMUQ9l9JNAM5wY0W6pnjJEXl-KwBzIWUsv5a9RTSs2K3OVOJFV6NtKkG4eVUytx+jymkZAeBFPgHCAlHwqWrIQAAWh-uaX1ZIw6WnuJVKIK0EhjNqGMaS7qP7-PWJaXMP0okmhTPmGOFJ4wVmyVnRkzJvWJsQC3IFOQNqJkKPmG4uZMiXF1JSTYhZ0i7DGReBsTYbwqCLUauMu4iRUh+pmIUG0km2gGQURMqNNibTzTg6UNS6LST0lAHt4TEDGJcoWWhI6xreACGSXNyKcmNQSs1S6+0tBrtjGGgZU6XqsqSMEc0ZJtwFRNAUHeGYz7Hvzae3a-V2oQ1aAka9VCwVROhS3PKfhlwFA+mNZMjxcgORskkI9IkUU8xzonPOpthb-LCW0gSoofB+C8GNFaLd4zLhjmMq+qCx5gYsoehcMcbi7g2imVW5H0yqrGjcPwlo6pzueZQfhMjGNYGY1-PwhISQFGeoJlILCwJeHWhmBVFahK-vnchCZBTSXYvjco4tCAch9LU7Va48ZHSUjORc4lUAsUlJk+sQZyYqrrgNFrZ9VrKR3uMR5TWZGf5tq0AzZsbnSO+0NNkNwbhHKQsEv7bcar8pgW8FsUI2r6zRZRhmNIMdVy5Dyuqyz84AhPXsqqlI0aSL5ZgjawdXSR26NOCmX2WxHS6k-Xxs+JQgA */ diff --git a/machines/settings.ts b/machines/settings.ts index 98989cad..5c1559e0 100644 --- a/machines/settings.ts +++ b/machines/settings.ts @@ -93,7 +93,6 @@ export const settingsMachine = model.createMachine( }, }, idle: { - entry: ['injiTourGuide'], on: { TOGGLE_BIOMETRIC_UNLOCK: { actions: ['toggleBiometricUnlock', 'storeContext'], @@ -114,6 +113,9 @@ export const settingsMachine = model.createMachine( CANCEL: { actions: ['resetCredentialRegistry'], }, + INJI_TOUR_GUIDE: { + target: 'showInjiTourGuide', + }, ACCEPT_HARDWARE_SUPPORT_NOT_EXISTS: { actions: [ 'updateUserShownWithHardwareKeystoreNotExists', @@ -146,13 +148,6 @@ export const settingsMachine = model.createMachine( }, }, }, - injiTourGuide: { - on: { - INJI_TOUR_GUIDE: { - target: 'showInjiTourGuide', - }, - }, - }, showInjiTourGuide: { on: { BACK: { diff --git a/machines/store.ts b/machines/store.ts index 8342b143..f3624741 100644 --- a/machines/store.ts +++ b/machines/store.ts @@ -105,7 +105,7 @@ export const storeMachine = }, on: { KEY_RECEIVED: { - actions: ['setEncryptionKey', 'logKey'], + actions: ['setEncryptionKey'], target: 'ready', }, ERROR: { diff --git a/package.json b/package.json index 6106300c..54e435ae 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,6 @@ "android:mosip": "react-native run-android --variant=mosipDebug", "ios": "react-native run-ios", "build:android:mosip": "cd android && ./gradlew :app:assembleMosipRelease && cd ..", - "i18n:compile-strings": "node scripts/compile-strings.js", "lint": "eslint . --ext .js,.jsx,.ts,.tsx --fix", "test": "jest", "postinstall": "patch-package && npm run jetify && sh tools/talisman/talisman-precommit.sh" @@ -128,8 +127,7 @@ "name": "mosip-resident-app", "version": "1.0.0", "lint-staged": { - "*.{ts,tsx,js,css,md}": "prettier --write", - "*.strings.json": "node scripts/compile-strings.js" + "*.{ts,tsx,js,css,md}": "prettier --write" }, "overrides": { "react": "18.2.0", diff --git a/screens/AuthScreen.strings.json b/screens/AuthScreen.strings.json deleted file mode 100644 index 0ad0c456..00000000 --- a/screens/AuthScreen.strings.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "header": "Would you like to use biometrics to unlock the application?", - "useBiometrics": "Use biometrics", - "usePasscode": "I'd rather use a passcode", - "errors": { - "unavailable": "Device does not support Biometrics", - "unenrolled": "To use Biometrics, please enroll your biometrics in your device settings", - "failed": "Failed to authenticate with Biometrics", - "generic": "There seems to be an error in Biometrics authentication" - } -} \ No newline at end of file diff --git a/screens/BiometricScreen.strings.json b/screens/BiometricScreen.strings.json deleted file mode 100644 index e8fee223..00000000 --- a/screens/BiometricScreen.strings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "unlock": "Unlock with biometrics" -} \ No newline at end of file diff --git a/screens/BiometricScreenController.ts b/screens/BiometricScreenController.ts index fab1da87..8433174c 100644 --- a/screens/BiometricScreenController.ts +++ b/screens/BiometricScreenController.ts @@ -29,6 +29,7 @@ import { sendInteractEvent, sendStartEvent, } from '../shared/telemetry/TelemetryUtils'; +import {isAndroid} from '../shared/constants'; export function useBiometricScreen(props: RootRouteProps) { const {appService} = useContext(GlobalContext); @@ -114,7 +115,7 @@ export function useBiometricScreen(props: RootRouteProps) { ]); const checkBiometricsChange = () => { - if (Platform.OS === 'android') { + if (isAndroid()) { RNFingerprintChange.hasFingerPrintChanged().then( async (biometricsHasChanged: boolean) => { //if new biometrics are added, re-enable Biometrics Authentication diff --git a/screens/History/HistoryScreen.strings.json b/screens/History/HistoryScreen.strings.json deleted file mode 100644 index 9ff385d6..00000000 --- a/screens/History/HistoryScreen.strings.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "noHistory": "No history available yet", - "downloaded": "downloaded", - "shared": "shared", - "received": "received", - "deleted": "deleted" -} \ No newline at end of file diff --git a/screens/Home/HomeScreen.strings.json b/screens/Home/HomeScreen.strings.json deleted file mode 100644 index 4d7d6693..00000000 --- a/screens/Home/HomeScreen.strings.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "myVcsTab": "My\nCards", - "receivedVcsTab": "Received\nCards", - "historyTab": "History" -} \ No newline at end of file diff --git a/screens/Home/IntroSlidersScreen.tsx b/screens/Home/IntroSlidersScreen.tsx index f09636ab..297fa41b 100644 --- a/screens/Home/IntroSlidersScreen.tsx +++ b/screens/Home/IntroSlidersScreen.tsx @@ -64,19 +64,19 @@ export const IntroSlidersScreen: React.FC = props => { alignItems: 'flex-end', }}> {controller.isPasscodeSet() ? ( -