[INJI-314] [INJI-900] add jest testing config, mocks and sample unit tests for Inji (#1340)

* [INJI-314] initial commit

Signed-off-by: Sri Kanth Kola <srikanthsri7447@gmail.com>

* [INJI-314] add WIP ut stuff

Signed-off-by: Harsh Vardhan <harsh59v@gmail.com>

* [INJIMOB-314] fix tsconfig for project type

Signed-off-by: Harsh Vardhan <harsh59v@gmail.com>

* [INJIMOB-314] kludge - skip checking types during unit tests

* mock image imports globally
* enable tests to run from any dir

Signed-off-by: Harsh Vardhan <harsh59v@gmail.com>

* [INJIMOB-314]: mocked modules

Signed-off-by: srikanth716 <srikanthsri7447@gmail.com>

* [INJIMOB-314]: mock react-native-google-signin

Signed-off-by: srikanth716 <srikanthsri7447@gmail.com>

* [INJIMOB-314]: use defined mock from google-signin lib

other details:
- mock base58.., rn-linear-gradient, expo-camera
- add @react-native/assets-registry to make jest-expo babel preset work

Signed-off-by: Harsh Vardhan <harsh59v@gmail.com>

* [INJIMOB-314] reorganise global const mocks into jest's setupFiles

Co-authored-by: srikanth716 <srikanthsri7447@gmail.com>
Signed-off-by: Harsh Vardhan <harsh59v@gmail.com>

* [INJIMOB-900] write tests for ActivityLogEvent

* init relevant mocks
* remove redundant global mocks from test files

Signed-off-by: Harsh Vardhan <harsh59v@gmail.com>

* [INJIMOB-900] fixup mocks of mmkv, zip-archive, rnfs

Signed-off-by: Harsh Vardhan <harsh59v@gmail.com>

* [INJIMOB-900]: write unit test for commonUtil

Signed-off-by: srikanth716 <srikanthsri7447@gmail.com>

* [INJIMOB-900]: write unit test for commonUtil

Signed-off-by: srikanth716 <srikanthsri7447@gmail.com>

* [INJIMOB-900]: sample unit test for settingsScreen

Signed-off-by: srikanth716 <srikanthsri7447@gmail.com>

* [INJIMOB-900] add SettingScreen test

Signed-off-by: Harsh Vardhan <harsh59v@gmail.com>

* [INJIMOB-900] update sample tests for commonUtil

Signed-off-by: Harsh Vardhan <harsh59v@gmail.com>

* [INJIMOB-900]: refactoring the settingsScreen test for Android and IOS

Signed-off-by: srikanth716 <srikanthsri7447@gmail.com>

* [INJIMOB-900] update test snapshots and add kludge in auth for testing

kludge: auth state machine now exports a selector with optional fields
as state machine isn't running in a test environment

Co-authored-by: srikanth716 <srikanthsri7447@gmail.com>
Signed-off-by: Harsh Vardhan <harsh59v@gmail.com>

* [INJIMOB-900]: snapshot test to settings screen

Signed-off-by: srikanth716 <srikanthsri7447@gmail.com>

* [INJIMOB-900] update mocks for testing and ACK reviews

Signed-off-by: Harsh Vardhan <harsh59v@gmail.com>

* [INJIMOB-900] downgrade expo to match compatibility matrix

Signed-off-by: Harsh Vardhan <harsh59v@gmail.com>

* [INJIMOB-900] upgrade expo to 49 to build the iOS app(kludge)

Signed-off-by: Harsh Vardhan <harsh59v@gmail.com>

* [INJIMOB-900] configure react-native-vector-icons as per README

Signed-off-by: Harsh Vardhan <harsh59v@gmail.com>

---------

Signed-off-by: Sri Kanth Kola <srikanthsri7447@gmail.com>
Signed-off-by: Harsh Vardhan <harsh59v@gmail.com>
Signed-off-by: srikanth716 <srikanthsri7447@gmail.com>
Co-authored-by: Sri Kanth Kola <srikanthsri7447@gmail.com>
This commit is contained in:
Harsh Vardhan
2024-04-02 11:22:01 +05:30
committed by GitHub
parent 2cfd99d614
commit c05408413d
73 changed files with 4700 additions and 3179 deletions

View File

@@ -2,13 +2,13 @@ fileignoreconfig:
- filename: package.json
checksum: 730263252adbe53cde58fb0b6988e519e766fe0f89a7b8cd261a1e5e5e598328
- filename: package-lock.json
checksum: b018f6e214d4f1573c587d773984f2b10765b62100293b240cb48e724d9b0158
checksum: 8e91542dfeba34460b4700c5b640fe6802cb1b38e1dbafd2ebcaac2fd9dbed36
- filename: lib/jsonld-signatures/suites/ed255192018/ed25519.ts
checksum: 493b6e31144116cb612c24d98b97d8adcad5609c0a52c865a6847ced0a0ddc3a
- filename: components/PasscodeVerify.tsx
checksum: 14654c0f038979fcd0d260170a45894a072f81e0767ca9a0e66935d33b5cc703
- filename: i18n.ts
checksum: 4af6370d4557b780f9a29590db91c3e5544a432e272afee6d21a0cabc2faaff0
checksum: e80d40f33692c195d034774d024cafdf63d010ac6d4a35f94b2a5d81b78c234b
- filename: components/Passcode.tsx
checksum: db4a18001be8c63bf7ffb389359861401fa1d22261b10ad729a76fd431c019a7
- filename: components/PasscodeVerify.tsx
@@ -148,7 +148,9 @@ fileignoreconfig:
- filename: components/BannerNotificationContainer.tsx
checksum: a98ff1a0dd96d3ead4b8191320be8b0c7a558cda6b0de39f1c62aaa8efef9fb8
- filename: components/HelpScreen.tsx
checksum: bbc69143bd37d065bba3800396301db5a0318e8b7ba51ecd49142dda68783a01
checksum: bbc69143bd37d065bba3800396301db5a0318e8b7ba51ecd49142dda68783a01
- filename: machines/backupRestore.ts
checksum: bbc69143bd37d065bba3800396301db5a0318e8b7ba51ecd49142dda68783a01
- filename: injitest/README.md
checksum: 82974a6b9363512472272245e9b433f92e63377e58ba306980876b745181a09c
- filename: shared/VCMetadata.ts
@@ -158,7 +160,7 @@ fileignoreconfig:
- filename: machines/backupAndRestore/backupRestore.typegen.ts
checksum: 64a8e42712083e0cbf0d6ce6b1139c62b59a14af17e4132d14f903d4d3bbe6b2
- filename: ios/Podfile.lock
checksum: 369fecac06b3c087b272e7920aa5ffe6734f261ae0af0c376a92ebf5c11415d4
checksum: c8f330a55ad911e59921215bf7d086db3dbdb5eab28202b3b450d780498ea880
- filename: screens/Home/MyVcsTab.tsx
checksum: 8133e2fefddfd0207eb7207b660d317f9a6acafbab6a65762d29ea86e33787cb
- filename: components/BackupAndRestoreBannerNotification.tsx
@@ -213,5 +215,28 @@ fileignoreconfig:
checksum: 51b4872a64abd76b124000358068c0b213d50fb131d735c122cd9a177cd8390c
- filename: machines/VCItemMachine/VCItemActions.ts
checksum: cda2ec61f0b884e537d05d018330d7b3c6febbf10ad4cd8cd87c715e6ad1dcf4
- filename: jest.setup.js
checksum: 2576884c00d7f90f20d4f9c5f1ec9ee97f4c41a2d9d37a649eaf26bfc2c01a50
- filename: __mocks__/react-native-rsa-native.mock.js
checksum: f5a4254f4d172107231a51ce0968ef1ad7ab0b8f0b5a4db72d1d5bc4e9ce179a
- filename: __mocks__/react-native-secure-key-store.mock.js
checksum: 249eeeb9f8cf083f8d008882a5aeab194e9e6344f68732a2a8c78a69ff5f2ee8
- filename: __mocks__/jest-init.js
checksum: 7cec36ae248f04fe50235f1281be455351002acbb6fdc881ad327a30b86ba5e5
- filename: components/ActivityLogEvent.test.ts
checksum: 5f9bf6d499106863fee65476adcec9253638d093bf0b58f1a11225915e9b0560
- filename: __mocks__/mmkv-db-setup.js
checksum: b94da7e4bc1bd52b5f0131104fcf25163df9cdb9af14425287d17fd56f4f09e3
- filename: __mocks__/react-native-keychain.mock.js
checksum: cc2798f843b776e70d957a4f7cdf47e199a29d9f6547fb9f59753108e8f252fa
- filename: machines/auth.ts
checksum: 46195ee93f9b7ac6794a06eeef5dee5ea242047a557af8bf95df04e1343d7b9e
- filename: shared/commonUtil.generated.test.ts
checksum: 4ca5983bb133f8f02bfd52fd0cc49ce37b24b164f3ca78a03ad97bb353ed00a4
- filename: __mocks__/en.mock.json
checksum: b34340a3f40c691f06698f7758b8c068a09ed7215098a0d11baed191c0972e04
- filename: ios/Inji.xcodeproj/project.pbxproj
checksum: 766e3dcb299f52ea75e87a1e6e7ce106872bb2f2481d54700995ca02b742b60f
- filename: ios/Inji/Info.plist
checksum: 57705369faf52801876baf0d25a3cee690de2fd87927454689b13963408a8e92
version: ""

View File

@@ -0,0 +1,22 @@
class RsaVerificationKey2018 {
constructor(options) {
// Your mock implementation for the constructor
}
// Add any other methods or properties you need to mock
async sign() {
return '';
}
async verifySignature(verifyData, verificationMethod, proof) {
return true;
}
async assertVerificationMethod() {}
async getVerificationMethod() {
return 'mockVerificationMethod';
}
async matchProof() {
return true;
}
}
export default RsaVerificationKey2018;

View File

@@ -0,0 +1,8 @@
const tuvali = {
verifier: jest.fn(),
EventTypes: jest.fn(),
VerificationStatus: jest.fn(),
wallet: jest.fn(),
};
export default tuvali;

View File

@@ -0,0 +1,8 @@
const ClipboardMock = {
// Mocked methods or properties for Clipboard module
getString: jest.fn(),
setString: jest.fn(),
// Add more as needed
};
export default ClipboardMock;

View File

@@ -0,0 +1,9 @@
const NetInfo = {
// Mock your methods or properties here
fetch: jest.fn(),
addEventListener: jest.fn(),
removeEventListener: jest.fn(),
// Add more mock methods or properties as needed
};
export default NetInfo;

View File

@@ -0,0 +1,6 @@
const items = {
encode: jest.fn(),
decode: jest.fn(),
};
export default items;

4
__mocks__/en.mock.json Normal file
View File

@@ -0,0 +1,4 @@
{
"key1": "mockedValue1",
"key2": "mockedValue2"
}

View File

@@ -0,0 +1,17 @@
const React = require('react');
// Mocked BarCodeEvent class
class BarCodeEvent {
constructor(data, type) {
this.data = data;
this.type = type;
}
}
// Mocked BarCodeScanner component
const BarCodeScanner = () => {
// Mocked BarCodeScanner component
return React.createElement('BarCodeScanner', null);
};
export {BarCodeEvent, BarCodeScanner};

View File

@@ -0,0 +1,3 @@
export type CameraType = 'front' | 'back';
export type Face = any; // Replace 'any' with the structure you need for Face
export type ImageType = any; // Replace 'any' with the structure you need for ImageType

21
__mocks__/expo-camera.js Normal file
View File

@@ -0,0 +1,21 @@
const Camera = {
// Mocked Camera properties or methods here
takePictureAsync: jest.fn(),
recordAsync: jest.fn(),
Constants: {
Type: {
front: 'front',
back: 'back',
},
},
};
const CameraCapturedPicture = jest.fn();
const PermissionResponse = {
granted: 'granted',
denied: 'denied',
undetermined: 'undetermined',
};
export {Camera, CameraCapturedPicture, PermissionResponse};

View File

@@ -0,0 +1,21 @@
// Mocked values for expo-constants
const mockedConstants = {
appOwnership: 'standalone',
statusBarHeight: 10,
// TODO: add global ENVs to run tests from PoV of an Android & an iOS device
platform: {
ios: {
model: 'iPhone',
platform: 'ios',
statusBarHeight: 20, // Mocked statusBarHeight for iOS
},
android: {
model: 'Android',
platform: 'android',
statusBarHeight: 24, // Mocked statusBarHeight for Android
},
},
// Add other constants as needed for your tests
};
export default mockedConstants;

View File

@@ -0,0 +1,11 @@
const mockLocalAuthentication = jest.fn();
mockLocalAuthentication.hasHardwareAsync = jest.fn(() => Promise.resolve(true));
mockLocalAuthentication.supportedAuthenticationTypesAsync = jest.fn(() =>
Promise.resolve(['fingerprint']),
);
mockLocalAuthentication.authenticateAsync = jest.fn(() =>
Promise.resolve({success: true}),
);
export default mockLocalAuthentication;

View File

@@ -0,0 +1,6 @@
const mockedLocale = 'en-US';
const mockLocalization = {
locale: mockedLocale,
};
// Customize the mock implementation as needed
export default mockLocalization;

1
__mocks__/fileMock.js Normal file
View File

@@ -0,0 +1 @@
module.exports = '';

191
__mocks__/iso-639-3.js Normal file
View File

@@ -0,0 +1,191 @@
/**
* Map of ISO 639-3 codes to ISO 639-1 codes.
*
* @type {Record<string, string>}
*/
export const iso6393To1 = {
aar: 'aa',
abk: 'ab',
afr: 'af',
aka: 'ak',
amh: 'am',
ara: 'ar',
arg: 'an',
asm: 'as',
ava: 'av',
ave: 'ae',
aym: 'ay',
aze: 'az',
bak: 'ba',
bam: 'bm',
bel: 'be',
ben: 'bn',
bis: 'bi',
bod: 'bo',
bos: 'bs',
bre: 'br',
bul: 'bg',
cat: 'ca',
ces: 'cs',
cha: 'ch',
che: 'ce',
chu: 'cu',
chv: 'cv',
cor: 'kw',
cos: 'co',
cre: 'cr',
cym: 'cy',
dan: 'da',
deu: 'de',
div: 'dv',
dzo: 'dz',
ell: 'el',
eng: 'en',
epo: 'eo',
est: 'et',
eus: 'eu',
ewe: 'ee',
fao: 'fo',
fas: 'fa',
fij: 'fj',
fin: 'fi',
fra: 'fr',
fry: 'fy',
ful: 'ff',
gla: 'gd',
gle: 'ga',
glg: 'gl',
glv: 'gv',
grn: 'gn',
guj: 'gu',
hat: 'ht',
hau: 'ha',
hbs: 'sh',
heb: 'he',
her: 'hz',
hin: 'hi',
hmo: 'ho',
hrv: 'hr',
hun: 'hu',
hye: 'hy',
ibo: 'ig',
ido: 'io',
iii: 'ii',
iku: 'iu',
ile: 'ie',
ina: 'ia',
ind: 'id',
ipk: 'ik',
isl: 'is',
ita: 'it',
jav: 'jv',
jpn: 'ja',
kal: 'kl',
kan: 'kn',
kas: 'ks',
kat: 'ka',
kau: 'kr',
kaz: 'kk',
khm: 'km',
kik: 'ki',
kin: 'rw',
kir: 'ky',
kom: 'kv',
kon: 'kg',
kor: 'ko',
kua: 'kj',
kur: 'ku',
lao: 'lo',
lat: 'la',
lav: 'lv',
lim: 'li',
lin: 'ln',
lit: 'lt',
ltz: 'lb',
lub: 'lu',
lug: 'lg',
mah: 'mh',
mal: 'ml',
mar: 'mr',
mkd: 'mk',
mlg: 'mg',
mlt: 'mt',
mon: 'mn',
mri: 'mi',
msa: 'ms',
mya: 'my',
nau: 'na',
nav: 'nv',
nbl: 'nr',
nde: 'nd',
ndo: 'ng',
nep: 'ne',
nld: 'nl',
nno: 'nn',
nob: 'nb',
nor: 'no',
nya: 'ny',
oci: 'oc',
oji: 'oj',
ori: 'or',
orm: 'om',
oss: 'os',
pan: 'pa',
pli: 'pi',
pol: 'pl',
por: 'pt',
pus: 'ps',
que: 'qu',
roh: 'rm',
ron: 'ro',
run: 'rn',
rus: 'ru',
sag: 'sg',
san: 'sa',
sin: 'si',
slk: 'sk',
slv: 'sl',
sme: 'se',
smo: 'sm',
sna: 'sn',
snd: 'sd',
som: 'so',
sot: 'st',
spa: 'es',
sqi: 'sq',
srd: 'sc',
srp: 'sr',
ssw: 'ss',
sun: 'su',
swa: 'sw',
swe: 'sv',
tah: 'ty',
tam: 'ta',
tat: 'tt',
tel: 'te',
tgk: 'tg',
tgl: 'tl',
tha: 'th',
tir: 'ti',
ton: 'to',
tsn: 'tn',
tso: 'ts',
tuk: 'tk',
tur: 'tr',
twi: 'tw',
uig: 'ug',
ukr: 'uk',
urd: 'ur',
uzb: 'uz',
ven: 've',
vie: 'vi',
vol: 'vo',
wln: 'wa',
wol: 'wo',
xho: 'xh',
yid: 'yi',
yor: 'yo',
zha: 'za',
zho: 'zh',
zul: 'zu',
};

169
__mocks__/jest-init.js Normal file
View File

@@ -0,0 +1,169 @@
import mockRNDeviceInfo from 'react-native-device-info/jest/react-native-device-info-mock';
import mockedConstants from 'react-native.mock';
import mockArgon2 from 'react-native-argon2.mock';
import mockLocalAuthentication from 'expo-local-authentication.mock';
import mockRNLocalize from './react-native-localize.mock';
import mockReactNativeKeychain from 'react-native-keychain.mock';
import mockRNSecureKeyStore from 'react-native-secure-key-store.mock';
import mockClipboard from '@react-native-clipboard/clipboard/jest/clipboard-mock.js';
import mockLocalization from 'expo-localization.mock';
import mockRNCNetInfo from '@react-native-community/netinfo/jest/netinfo-mock.js';
jest.mock('@react-native-community/netinfo', () => mockRNCNetInfo);
jest.mock('react-native-device-info', () => mockRNDeviceInfo);
jest.mock('react-native', () => require('./react-native.mock'));
jest.mock('expo-constants', () => mockedConstants);
jest.mock('react-native-argon2', () => mockArgon2);
jest.mock('react-native-securerandom');
jest.mock('expo-local-authentication', () => mockLocalAuthentication);
jest.mock('react-native-rsa-native', () =>
require('react-native-rsa-native.mock'),
);
jest.mock('telemetry-sdk', () => require('./telemetry-sdk.mock'));
jest.mock('react-native-localize', () => mockRNLocalize);
jest.mock('expo-localization', () => mockLocalization);
jest.mock('iso-639-3');
jest.mock('react-native-keychain', () => mockReactNativeKeychain);
jest.mock('react-native-secure-key-store', () => mockRNSecureKeyStore);
jest.mock('react-native-fs', () => require('react-native-fs.mock'));
jest.mock('react-native-zip-archive', () =>
require('./react-native-zip-archive.mock'),
);
jest.mock('react-native-biometrics-changed');
jest.mock('@react-navigation/native');
jest.mock('@mosip/tuvali');
jest.mock('react-native-bluetooth-state-manager');
jest.mock('react-native-permissions');
jest.mock('react-native-linear-gradient', () => (LinearGradient = jest.fn()));
jest.mock('expo-camera', () => {
return {
Camera: {
Constants: {
Type: {front: 0, back: 1},
},
},
CameraCapturedPicture: jest.fn(),
PermissionResponse: jest.fn(),
ImageType: jest.fn(),
Face: jest.fn(),
CameraType: jest.fn(),
};
});
jest.mock('base58-universal/main', () => require('base58-universal-main'));
jest.mock('@react-native-clipboard/clipboard', () => mockClipboard);
jest.mock(
'react-native-shimmer-placeholder',
() => (ShimmerPlaceHolder = jest.fn()),
);
jest.mock(
'expo-camera/build/Camera.types',
() => (
(CameraType = jest.requireActual()),
(Face = jest.fn()),
(ImageType = jest.fn())
),
);
jest.mock(
'react-native-app-auth',
() => ((authorize = jest.fn()), (AuthorizeResult = jest.fn())),
);
jest.mock('react-native-vector-icons/MaterialIcons', () => (Icon = jest.fn()));
jest.mock(
'react-native-vector-icons/MaterialCommunityIcons',
() => (Icon = jest.fn()),
);
jest.mock('react-native-qrcode-svg', () => (QRCode = jest.fn()));
jest.mock('react-native-spinkit', () => (Spinner = jest.fn()));
jest.mock(
'react-native-zip-archive',
() => ((zip = jest.fn()), (unzip = jest.fn())),
);
jest.mock('react', () => ({
...jest.requireActual('react'),
useState: jest.fn(),
}));
jest.mock('react-i18next', () => ({
// this mock makes sure any components using the translate hook can use it without a warning being shown
useTranslation: () => {
return {
t: str => str,
i18n: {
changeLanguage: () => new Promise(() => {}),
},
};
},
initReactI18next: {
type: '3rdParty',
init: () => {},
},
}));
jest.mock('@iriscan/biometric-sdk-react-native', () => ({
configure: jest.fn(),
// Add other functions or constants you need to mock here
}));
jest.mock('react-native-gesture-handler', () => {
const mockScrollView = jest.fn().mockReturnValue(null); // Mock ScrollView component
return {
ScrollView: mockScrollView,
// Add other components or utilities you want to mock from react-native-gesture-handler
};
});
jest.mock('@mosip/secure-keystore', () => ({
sign: jest.fn(),
encryptData: input => (input ? String(input) : 'mockedString'),
decryptData: input => (input ? String(input) : 'mockedString'),
deviceSupportsHardware: () => true,
}));
jest.mock('../machines/store', () => ({
getItem: jest.fn(),
StoreEvents: {
GET: () => 'mockedString',
EXPORT: () => 'mockedString',
},
}));
// Mocking useState
const mockState = jest.fn();
jest.mock('react', () => ({
...jest.requireActual('react'),
useState: initialState => [initialState, mockState],
useEffect: jest.fn(),
}));

View File

@@ -0,0 +1,13 @@
jest.mock('react-native-mmkv-storage', () => ({
MMKVLoader: () => ({
initialize: () => ({
getItem: key => jest.fn(),
setItem: (key, data) => jest.fn(),
indexer: {
strings: {
getKeys: () => jest.fn(),
},
},
}),
}),
}));

10
__mocks__/react-native-app-auth.js vendored Normal file
View File

@@ -0,0 +1,10 @@
const ReactNativeAppAuth = jest.mock('react-native-app-auth', () => {
return {
// Mocked properties or methods
authorize: jest.fn(),
refresh: jest.fn(),
// Add more mocks as needed
};
});
export default ReactNativeAppAuth;

View File

@@ -0,0 +1,7 @@
const mockArgon2 = jest.fn().mockResolvedValue({
hash: jest.fn(),
verify: jest.fn(),
rawHash: 'mockedRawHashValue',
});
export default mockArgon2;

View File

@@ -0,0 +1,11 @@
const {NativeModules} = require('react-native');
const RNFingerprintChange = require('react-native-biometrics-changed');
// Mock the NativeModules for 'react-native-biometrics-changed'
RNFingerprintChange.NativeModules = {
...RNFingerprintChange.NativeModules,
// Add any mocked properties or methods you need
};
module.exports = RNFingerprintChange;

View File

@@ -0,0 +1,8 @@
const BluetoothStateManager = {
// Mock your methods or properties here
addEventListener: jest.fn(),
removeEventListener: jest.fn(),
// Add more mock methods or properties as needed
};
export default BluetoothStateManager;

14
__mocks__/react-native-elements.js vendored Normal file
View File

@@ -0,0 +1,14 @@
const Button = jest.fn().mockReturnValue(null);
const Icon = jest.fn().mockReturnValue(null);
// Mock the ButtonProps
const ButtonProps = {
// Add any mocked props you need
};
const ListItem = {
Content: ({children}) => <div>{children}</div>,
};
// Export the mock
export {Button as RNEButton, ButtonProps as RNEButtonProps, Icon, ListItem};

View File

@@ -0,0 +1,45 @@
jest.mock('react-native-fs', () => {
return {
mkdir: jest.fn(),
moveFile: jest.fn(),
copyFile: jest.fn(),
pathForBundle: jest.fn(),
pathForGroup: jest.fn(),
getFSInfo: jest.fn(),
getAllExternalFilesDirs: jest.fn(),
unlink: jest.fn(),
exists: jest.fn(),
stopDownload: jest.fn(),
resumeDownload: jest.fn(),
isResumable: jest.fn(),
stopUpload: jest.fn(),
completeHandlerIOS: jest.fn(),
readDir: jest.fn(),
readDirAssets: jest.fn(),
existsAssets: jest.fn(),
readdir: jest.fn(),
setReadable: jest.fn(),
stat: jest.fn(),
readFile: jest.fn(),
read: jest.fn(),
readFileAssets: jest.fn(),
hash: jest.fn(),
copyFileAssets: jest.fn(),
copyFileAssetsIOS: jest.fn(),
copyAssetsVideoIOS: jest.fn(),
writeFile: jest.fn(),
appendFile: jest.fn(),
write: jest.fn(),
downloadFile: jest.fn(),
uploadFiles: jest.fn(),
touch: jest.fn(),
MainBundlePath: jest.fn(),
CachesDirectoryPath: jest.fn(),
DocumentDirectoryPath: jest.fn(),
ExternalDirectoryPath: jest.fn(),
ExternalStorageDirectoryPath: jest.fn(),
TemporaryDirectoryPath: jest.fn(),
LibraryDirectoryPath: jest.fn(),
PicturesDirectoryPath: jest.fn(),
};
});

View File

@@ -0,0 +1,11 @@
const mockReactNativeKeychain = {
setGenericPassword: jest.fn(),
getGenericPassword: function () {
return {
username: 'testuser',
password: 'testpassword',
};
},
resetGenericPassword: jest.fn(),
};
export default mockReactNativeKeychain;

View File

@@ -0,0 +1,8 @@
const LinearGradientMock = jest.mock('react-native-linear-gradient', () => {
return {
// Add mocked properties or methods here
default: jest.fn(),
};
});
export default LinearGradientMock;

View File

@@ -0,0 +1,8 @@
const mockedLocales = ['en-US', 'fr-FR', 'es-ES'];
const mockRNLocalize = {
locales: mockedLocales,
getTimeZone: jest.fn(),
};
export default mockRNLocalize;

17
__mocks__/react-native-mmkv-storage.js vendored Normal file
View File

@@ -0,0 +1,17 @@
class MockMMKVLoader {
constructor() {
// Your mock implementation for the constructor
}
// Add any other methods or properties you need to mock
load() {
// Mock implementation for the load method
}
save() {
// Mock implementation for the save method
}
initialize() {}
}
export {MockMMKVLoader as MMKVLoader};

18
__mocks__/react-native-permissions.js vendored Normal file
View File

@@ -0,0 +1,18 @@
const PermissionsMock = {
checkMultiple: jest.fn(),
PERMISSIONS: {
// Add mocked permission constants here
CAMERA: 'camera',
STORAGE: 'storage',
// Add more as needed
},
requestMultiple: jest.fn(),
RESULTS: {
// Add mocked result constants here
GRANTED: 'granted',
DENIED: 'denied',
// Add more as needed
},
};
export default PermissionsMock;

View File

@@ -0,0 +1,46 @@
import {ImageSourcePropType} from 'react-native';
const React = require('react');
const QRCode = () => {
// Mocked QRCode component
return React.PureComponent < QRCodeProps, any > {};
};
export interface QRCodeProps {
/* what the qr code stands for */
value?: string;
/* the whole component size */
size?: number;
/* the color of the cell */
color?: string;
/* the color of the background */
backgroundColor?: string;
/* an image source object. example {uri: 'base64string'} or {require('pathToImage')} */
logo?: ImageSourcePropType;
/* logo size in pixels */
logoSize?: number;
/* the logo gets a filled rectangular background with this color. Use 'transparent'
if your logo already has its own backdrop. Default = same as backgroundColor */
logoBackgroundColor?: string;
/* logo's distance to its wrapper */
logoMargin?: number;
/* the border-radius of logo image */
logoBorderRadius?: number;
/* quiet zone in pixels */
quietZone?: number;
/* enable linear gradient effect */
enableLinearGradient?: boolean;
/* linear gradient direction */
gradientDirection?: string[];
/* linear gradient color */
linearGradient?: string[];
/* get svg ref for further usage */
getRef?: (c: any) => any;
/* error correction level */
ecl?: 'L' | 'M' | 'Q' | 'H';
/* error handler called when matrix fails to generate */
onError?: Function;
}
export default QRCode;

View File

@@ -0,0 +1,17 @@
const KeyPair = jest.fn();
const RSA = jest.fn();
// Customize the mock implementation as needed
KeyPair.mockImplementation(() => {
return {
// Mock KeyPair properties or methods
};
});
RSA.mockImplementation(() => {
return {
// Mock RSA properties or methods
};
});
export {KeyPair, RSA};

View File

@@ -0,0 +1,7 @@
const mockRNSecureKeyStore = {
set: jest.fn(),
get: jest.fn(),
remove: jest.fn(),
};
export default mockRNSecureKeyStore;

View File

@@ -0,0 +1,5 @@
export const generateSecureRandom = jest.fn().mockResolvedValue(
// Return an array or buffer of random bytes
// For example, to return an array of 64 random bytes:
new Uint8Array(64).map(() => Math.floor(Math.random() * 256)),
);

View File

@@ -0,0 +1,11 @@
const ShimmerPlaceHolderMock = jest.mock(
'react-native-shimmer-placeholder',
() => {
return {
// Add mocked properties or methods here
default: jest.fn(),
};
},
);
export default ShimmerPlaceHolderMock;

8
__mocks__/react-native-spinkit.js vendored Normal file
View File

@@ -0,0 +1,8 @@
import React from 'react';
const SpinnerMock = () => {
// Mocked Spinner component
return <></>;
};
export default SpinnerMock;

View File

@@ -0,0 +1,8 @@
const React = require('react');
// Mocked Icon component
const Icon = () => {
return React.createElement('Icon', null);
};
export default Icon;

View File

@@ -0,0 +1,33 @@
jest.mock('react-native', () => {
const ReactNative = jest.requireActual('react-native');
// Define NativeModules using Object.defineProperty
Object.defineProperty(ReactNative, 'NativeModules', {
value: {
// Mock the CameraRoll module
CameraRoll: {
getPhotos: jest.fn(),
},
CameraModule: {
capturePhoto: jest.fn(),
},
LocationModule: {
getCurrentLocation: jest.fn(),
},
SecureKeystore: {
deviceSupportsHardware: jest.fn(),
},
},
});
// Mock the Platform module
Object.defineProperty(ReactNative, 'Platform', {
value: {
OS: 'android', // or 'ios' based on your requirement
Version: 42, // Set a version number that you expect to use in your test
select: jest.fn(),
},
});
return ReactNative;
});

47
__mocks__/svg.mock.js Normal file
View File

@@ -0,0 +1,47 @@
import React from 'react';
const SVGImage = {
ReceiveCard: (color1, color2, stroke) => {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
width="100"
height="100"
viewBox="0 0 100 100">
<rect
x="10"
y="10"
width="80"
height="80"
fill={color1}
stroke={stroke}
strokeWidth="2"
/>
<circle cx="50" cy="50" r="30" fill={color2} />
</svg>
);
},
Home: (color1, color2, stroke) => {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
width="100"
height="100"
viewBox="0 0 100 100">
<rect
x="10"
y="10"
width="80"
height="80"
fill={color1}
stroke={stroke}
strokeWidth="2"
/>
<circle cx="50" cy="50" r="30" fill={color2} />
</svg>
);
},
};
export default SVGImage;

View File

@@ -0,0 +1,9 @@
jest.mock('telemetry-sdk', () => {
const TelemetrySDK = {
trackEvent: jest.fn(),
trackPageView: jest.fn(),
error: (data, {}) => jest.fn(data),
};
return TelemetrySDK;
});

View File

@@ -0,0 +1,23 @@
import i18n from 'i18next';
import { initReactI18next } from 'react-i18next';
i18n
.use(initReactI18next)
.init({
lng: 'en',
fallbackLng: 'en',
// have a common namespace used around the full app
ns: ['translationsNS'],
defaultNS: 'translationsNS',
debug: true,
interpolation: {
escapeValue: false, // not needed for react!!
},
resources: { en: { translationsNS: {} } },
});
export default i18n;

View File

@@ -16,12 +16,12 @@
</natures>
<filteredResources>
<filter>
<id>1637742618855</id>
<id>1711099422482</id>
<name></name>
<type>30</type>
<matcher>
<id>org.eclipse.core.resources.regexFilterMatcher</id>
<arguments>node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
</matcher>
</filter>
</filteredResources>

View File

@@ -296,4 +296,7 @@ dependencies {
}
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
apply from: "./eas-build.gradle"
// https://github.com/oblador/react-native-vector-icons?tab=readme-ov-file#android-setup
apply from: file("../../node_modules/react-native-vector-icons/fonts.gradle")
apply from: "./eas-build.gradle"

View File

@@ -40,5 +40,44 @@ module.exports = function (api) {
return {
presets: ['babel-preset-expo'],
plugins,
presets: [
['@babel/preset-env', {targets: {node: 'current'}}],
'@babel/preset-typescript',
'@babel/preset-react',
'module:metro-react-native-babel-preset',
],
sourceType: 'module',
plugins: [
[
'module:react-native-dotenv',
{
envName: 'APP_ENV',
moduleName: 'react-native-dotenv',
path: '.env',
blocklist: null,
allowlist: null,
safe: false,
allowUndefined: true,
verbose: false,
},
],
[
'babel-plugin-inline-import',
{
extensions: ['.md'],
},
],
[
'module-resolver',
{
alias: {
'isomorphic-webcrypto': 'isomorphic-webcrypto/src/react-native',
'fast-text-encoding': 'fast-text-encoding/text',
jsonld: '@digitalcredentials/jsonld',
'jsonld-signatures': '@digitalcredentials/jsonld-signatures',
},
},
],
],
};
};

View File

@@ -0,0 +1,59 @@
import {ActivityLog, getActionText} from './ActivityLogEvent';
describe('ActivityLog', () => {
let instance;
beforeEach(() => {
instance = new ActivityLog();
});
it('Activity log instance should have a timestamp set', () => {
expect(instance.timestamp).not.toBeUndefined();
});
it('logTamperedVCs() should have the tampered vc removed removed type set', () => {
expect(ActivityLog.logTamperedVCs().type).toMatch('TAMPERED_VC_REMOVED');
});
});
describe('getActionText', () => {
let activityLog;
let mockIl18nfn;
beforeEach(() => {
mockIl18nfn = jest.fn();
activityLog = new ActivityLog({
id: 'mockId',
idType: 'mockIDtype',
_vcKey: 'mock_vc_key',
type: 'mockType',
timestamp: 1234,
deviceName: 'fakeDevice',
vcLabel: 'fakeVClabel',
});
});
// BDD examples
it('should fetch id type from translation file mock', () => {
mockIl18nfn.mockImplementation(input => {
if (input === `VcDetails:mockIDtype`) {
return 'National ID';
}
});
getActionText(activityLog, mockIl18nfn);
expect(mockIl18nfn).toHaveBeenCalledWith(`VcDetails:mockIDtype`);
expect(mockIl18nfn).toHaveBeenCalledWith('mockType', {
idType: 'National ID',
id: 'mockId',
});
expect(mockIl18nfn).toHaveBeenCalledTimes(2);
// TODO: assert the returned string
});
it('should not fetch id type from translation file mock', () => {
activityLog.idType = undefined;
getActionText(activityLog, mockIl18nfn);
expect(mockIl18nfn).toHaveBeenCalledWith('mockType', {
idType: '',
id: 'mockId',
});
expect(mockIl18nfn).toHaveBeenCalledTimes(1);
});
});

View File

@@ -0,0 +1,13 @@
import renderer from 'react-test-renderer';
import React from 'react';
import {Text} from './Text';
describe('<Text />', () => {
it('Testing the Text component', () => {
// Render the component
const textComponent = renderer
.create(<Text children="Testing react native text component" />)
.toJSON();
expect(textComponent).toMatchSnapshot();
});
});

View File

@@ -0,0 +1,28 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`<Text /> Testing the Text component 1`] = `
<Text
style={
[
{
"color": "#000000",
"fontSize": 16,
"lineHeight": 18,
},
{
"fontFamily": "Inter_400Regular",
"fontSize": 14,
},
null,
{
"textAlign": "left",
},
null,
null,
null,
]
}
>
Testing react native text component
</Text>
`;

View File

@@ -1,10 +1,10 @@
import { DefaultTheme } from './themes/DefaultTheme';
import { PurpleTheme } from './themes/PurpleTheme';
import { APPLICATION_THEME } from 'react-native-dotenv';
import {DefaultTheme} from './themes/DefaultTheme';
import {PurpleTheme} from './themes/PurpleTheme';
import {APPLICATION_THEME} from 'react-native-dotenv';
// To change the theme, CSS theme file has to import and assign it to Theme in line no 6
export const Theme =
APPLICATION_THEME.toLowerCase() === 'purple' ? PurpleTheme : DefaultTheme;
APPLICATION_THEME?.toLowerCase() === 'purple' ? PurpleTheme : DefaultTheme;
type SpacingXY = [number, number];
type SpacingFull = [number, number, number, number];

View File

@@ -1548,7 +1548,7 @@ export const DefaultTheme = {
// https://ethercreative.github.io/react-native-shadow-generator/
if (level === 0) {
return null;
return {};
}
const index = level - 1;

View File

@@ -1463,13 +1463,6 @@ export const PurpleTheme = {
rowGap: 8,
},
}),
SendVcScreenStyles: StyleSheet.create({
shareOptionButtonsContainer: {
marginBottom: 1,
marginTop: 1,
rowGap: 8,
},
}),
ErrorStyles: StyleSheet.create({
image: {marginTop: -60, paddingBottom: 26},
title: {
@@ -1556,7 +1549,7 @@ export const PurpleTheme = {
// https://ethercreative.github.io/react-native-shadow-generator/
if (level === 0) {
return null;
return {};
}
const index = level - 1;

18
i18n.ts
View File

@@ -39,11 +39,11 @@ i18next
})
.then(async () => {
const existingCredentials = await Keychain.getGenericPassword();
const language = await getItem(
'language',
null,
existingCredentials.password,
);
const language = existingCredentials
? await getItem('language', null, existingCredentials.password)
: null;
if (language !== i18next.language) {
i18next.changeLanguage(language);
populateLanguageCodeMap();
@@ -95,9 +95,11 @@ export function getClientNameForCurrentLanguage(
// This method gets the value from iso-639-3 package, which contains key value pairs of three letter language codes[key] and two letter langugae code[value]. These values are according to iso standards.
// The response received from the server is three letter language code and the value in the inji code base is two letter language code. Hence the conversion is done.
function getThreeLetterLanguageCode(twoLetterLanguageCode: string) {
return Object.keys(iso6393To1).find(
key => iso6393To1[key] === twoLetterLanguageCode,
);
return iso6393To1
? Object.keys(iso6393To1).find(
key => iso6393To1[key] === twoLetterLanguageCode,
)
: null;
}
function populateLanguageCodeMap() {

View File

@@ -15,6 +15,25 @@
96905EF65AED1B983A6B3ABC /* libPods-Inji.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 58EEBF8E8E6FB1BC6CAF49B5 /* libPods-Inji.a */; };
B18059E884C0ABDD17F3DC3D /* ExpoModulesProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAC715A2D49A985799AEE119 /* ExpoModulesProvider.swift */; };
BB2F792D24A3F905000567C9 /* Expo.plist in Resources */ = {isa = PBXBuildFile; fileRef = BB2F792C24A3F905000567C9 /* Expo.plist */; };
FD8D20B92BBAACDF009AD01C /* Fontisto.ttf in Resources */ = {isa = PBXBuildFile; fileRef = FD8D20A62BBAACDF009AD01C /* Fontisto.ttf */; };
FD8D20BA2BBAACDF009AD01C /* Octicons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = FD8D20A72BBAACDF009AD01C /* Octicons.ttf */; };
FD8D20BB2BBAACDF009AD01C /* Feather.ttf in Resources */ = {isa = PBXBuildFile; fileRef = FD8D20A82BBAACDF009AD01C /* Feather.ttf */; };
FD8D20BC2BBAACDF009AD01C /* FontAwesome6_Regular.ttf in Resources */ = {isa = PBXBuildFile; fileRef = FD8D20A92BBAACDF009AD01C /* FontAwesome6_Regular.ttf */; };
FD8D20BD2BBAACDF009AD01C /* Entypo.ttf in Resources */ = {isa = PBXBuildFile; fileRef = FD8D20AA2BBAACDF009AD01C /* Entypo.ttf */; };
FD8D20BE2BBAACDF009AD01C /* FontAwesome5_Brands.ttf in Resources */ = {isa = PBXBuildFile; fileRef = FD8D20AB2BBAACDF009AD01C /* FontAwesome5_Brands.ttf */; };
FD8D20BF2BBAACDF009AD01C /* MaterialCommunityIcons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = FD8D20AC2BBAACDF009AD01C /* MaterialCommunityIcons.ttf */; };
FD8D20C02BBAACDF009AD01C /* AntDesign.ttf in Resources */ = {isa = PBXBuildFile; fileRef = FD8D20AD2BBAACDF009AD01C /* AntDesign.ttf */; };
FD8D20C12BBAACDF009AD01C /* Foundation.ttf in Resources */ = {isa = PBXBuildFile; fileRef = FD8D20AE2BBAACDF009AD01C /* Foundation.ttf */; };
FD8D20C22BBAACDF009AD01C /* Ionicons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = FD8D20AF2BBAACDF009AD01C /* Ionicons.ttf */; };
FD8D20C32BBAACDF009AD01C /* FontAwesome5_Solid.ttf in Resources */ = {isa = PBXBuildFile; fileRef = FD8D20B02BBAACDF009AD01C /* FontAwesome5_Solid.ttf */; };
FD8D20C42BBAACDF009AD01C /* FontAwesome5_Regular.ttf in Resources */ = {isa = PBXBuildFile; fileRef = FD8D20B12BBAACDF009AD01C /* FontAwesome5_Regular.ttf */; };
FD8D20C52BBAACDF009AD01C /* FontAwesome.ttf in Resources */ = {isa = PBXBuildFile; fileRef = FD8D20B22BBAACDF009AD01C /* FontAwesome.ttf */; };
FD8D20C62BBAACDF009AD01C /* Zocial.ttf in Resources */ = {isa = PBXBuildFile; fileRef = FD8D20B32BBAACDF009AD01C /* Zocial.ttf */; };
FD8D20C72BBAACDF009AD01C /* EvilIcons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = FD8D20B42BBAACDF009AD01C /* EvilIcons.ttf */; };
FD8D20C82BBAACDF009AD01C /* FontAwesome6_Solid.ttf in Resources */ = {isa = PBXBuildFile; fileRef = FD8D20B52BBAACDF009AD01C /* FontAwesome6_Solid.ttf */; };
FD8D20C92BBAACDF009AD01C /* SimpleLineIcons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = FD8D20B62BBAACDF009AD01C /* SimpleLineIcons.ttf */; };
FD8D20CA2BBAACDF009AD01C /* FontAwesome6_Brands.ttf in Resources */ = {isa = PBXBuildFile; fileRef = FD8D20B72BBAACDF009AD01C /* FontAwesome6_Brands.ttf */; };
FD8D20CB2BBAACDF009AD01C /* MaterialIcons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = FD8D20B82BBAACDF009AD01C /* MaterialIcons.ttf */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
@@ -33,6 +52,25 @@
D98B96A488E54CBDB286B26F /* noop-file.swift */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.swift; name = "noop-file.swift"; path = "Inji/noop-file.swift"; sourceTree = "<group>"; };
ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };
FAC715A2D49A985799AEE119 /* ExpoModulesProvider.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ExpoModulesProvider.swift; path = "Pods/Target Support Files/Pods-Inji/ExpoModulesProvider.swift"; sourceTree = "<group>"; };
FD8D20A62BBAACDF009AD01C /* Fontisto.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = Fontisto.ttf; sourceTree = "<group>"; };
FD8D20A72BBAACDF009AD01C /* Octicons.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = Octicons.ttf; sourceTree = "<group>"; };
FD8D20A82BBAACDF009AD01C /* Feather.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = Feather.ttf; sourceTree = "<group>"; };
FD8D20A92BBAACDF009AD01C /* FontAwesome6_Regular.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = FontAwesome6_Regular.ttf; sourceTree = "<group>"; };
FD8D20AA2BBAACDF009AD01C /* Entypo.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = Entypo.ttf; sourceTree = "<group>"; };
FD8D20AB2BBAACDF009AD01C /* FontAwesome5_Brands.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = FontAwesome5_Brands.ttf; sourceTree = "<group>"; };
FD8D20AC2BBAACDF009AD01C /* MaterialCommunityIcons.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = MaterialCommunityIcons.ttf; sourceTree = "<group>"; };
FD8D20AD2BBAACDF009AD01C /* AntDesign.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = AntDesign.ttf; sourceTree = "<group>"; };
FD8D20AE2BBAACDF009AD01C /* Foundation.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = Foundation.ttf; sourceTree = "<group>"; };
FD8D20AF2BBAACDF009AD01C /* Ionicons.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = Ionicons.ttf; sourceTree = "<group>"; };
FD8D20B02BBAACDF009AD01C /* FontAwesome5_Solid.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = FontAwesome5_Solid.ttf; sourceTree = "<group>"; };
FD8D20B12BBAACDF009AD01C /* FontAwesome5_Regular.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = FontAwesome5_Regular.ttf; sourceTree = "<group>"; };
FD8D20B22BBAACDF009AD01C /* FontAwesome.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = FontAwesome.ttf; sourceTree = "<group>"; };
FD8D20B32BBAACDF009AD01C /* Zocial.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = Zocial.ttf; sourceTree = "<group>"; };
FD8D20B42BBAACDF009AD01C /* EvilIcons.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = EvilIcons.ttf; sourceTree = "<group>"; };
FD8D20B52BBAACDF009AD01C /* FontAwesome6_Solid.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = FontAwesome6_Solid.ttf; sourceTree = "<group>"; };
FD8D20B62BBAACDF009AD01C /* SimpleLineIcons.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = SimpleLineIcons.ttf; sourceTree = "<group>"; };
FD8D20B72BBAACDF009AD01C /* FontAwesome6_Brands.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = FontAwesome6_Brands.ttf; sourceTree = "<group>"; };
FD8D20B82BBAACDF009AD01C /* MaterialIcons.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = MaterialIcons.ttf; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -82,6 +120,7 @@
83CBB9F61A601CBA00E9B192 = {
isa = PBXGroup;
children = (
FD8D20A52BBAACDF009AD01C /* Fonts */,
13B07FAE1A68108700A75B9A /* Inji */,
832341AE1AAA6A7D00B99B32 /* Libraries */,
83CBBA001A601CBA00E9B192 /* Products */,
@@ -136,6 +175,33 @@
name = ExpoModulesProviders;
sourceTree = "<group>";
};
FD8D20A52BBAACDF009AD01C /* Fonts */ = {
isa = PBXGroup;
children = (
FD8D20A62BBAACDF009AD01C /* Fontisto.ttf */,
FD8D20A72BBAACDF009AD01C /* Octicons.ttf */,
FD8D20A82BBAACDF009AD01C /* Feather.ttf */,
FD8D20A92BBAACDF009AD01C /* FontAwesome6_Regular.ttf */,
FD8D20AA2BBAACDF009AD01C /* Entypo.ttf */,
FD8D20AB2BBAACDF009AD01C /* FontAwesome5_Brands.ttf */,
FD8D20AC2BBAACDF009AD01C /* MaterialCommunityIcons.ttf */,
FD8D20AD2BBAACDF009AD01C /* AntDesign.ttf */,
FD8D20AE2BBAACDF009AD01C /* Foundation.ttf */,
FD8D20AF2BBAACDF009AD01C /* Ionicons.ttf */,
FD8D20B02BBAACDF009AD01C /* FontAwesome5_Solid.ttf */,
FD8D20B12BBAACDF009AD01C /* FontAwesome5_Regular.ttf */,
FD8D20B22BBAACDF009AD01C /* FontAwesome.ttf */,
FD8D20B32BBAACDF009AD01C /* Zocial.ttf */,
FD8D20B42BBAACDF009AD01C /* EvilIcons.ttf */,
FD8D20B52BBAACDF009AD01C /* FontAwesome6_Solid.ttf */,
FD8D20B62BBAACDF009AD01C /* SimpleLineIcons.ttf */,
FD8D20B72BBAACDF009AD01C /* FontAwesome6_Brands.ttf */,
FD8D20B82BBAACDF009AD01C /* MaterialIcons.ttf */,
);
name = Fonts;
path = "../node_modules/react-native-vector-icons/Fonts";
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
@@ -198,8 +264,27 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
FD8D20C22BBAACDF009AD01C /* Ionicons.ttf in Resources */,
FD8D20BA2BBAACDF009AD01C /* Octicons.ttf in Resources */,
BB2F792D24A3F905000567C9 /* Expo.plist in Resources */,
FD8D20C52BBAACDF009AD01C /* FontAwesome.ttf in Resources */,
FD8D20BB2BBAACDF009AD01C /* Feather.ttf in Resources */,
FD8D20BE2BBAACDF009AD01C /* FontAwesome5_Brands.ttf in Resources */,
FD8D20CB2BBAACDF009AD01C /* MaterialIcons.ttf in Resources */,
FD8D20BC2BBAACDF009AD01C /* FontAwesome6_Regular.ttf in Resources */,
FD8D20C72BBAACDF009AD01C /* EvilIcons.ttf in Resources */,
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */,
FD8D20C32BBAACDF009AD01C /* FontAwesome5_Solid.ttf in Resources */,
FD8D20CA2BBAACDF009AD01C /* FontAwesome6_Brands.ttf in Resources */,
FD8D20BF2BBAACDF009AD01C /* MaterialCommunityIcons.ttf in Resources */,
FD8D20BD2BBAACDF009AD01C /* Entypo.ttf in Resources */,
FD8D20C82BBAACDF009AD01C /* FontAwesome6_Solid.ttf in Resources */,
FD8D20B92BBAACDF009AD01C /* Fontisto.ttf in Resources */,
FD8D20C12BBAACDF009AD01C /* Foundation.ttf in Resources */,
FD8D20C42BBAACDF009AD01C /* FontAwesome5_Regular.ttf in Resources */,
FD8D20C02BBAACDF009AD01C /* AntDesign.ttf in Resources */,
FD8D20C92BBAACDF009AD01C /* SimpleLineIcons.ttf in Resources */,
FD8D20C62BBAACDF009AD01C /* Zocial.ttf in Resources */,
3E461D99554A48A4959DE609 /* SplashScreen.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;

View File

@@ -12,6 +12,23 @@
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>UIAppFonts</key>
<array>
<string>MaterialIcons.ttf</string>
<string>MaterialCommunityIcons.ttf</string>
<string>FontAwesome.ttf</string>
<string>FontAwesome.ttf</string>
<string>FontAwesome5_Regular.ttf</string>
<string>FontAwesome6_Brands.ttf</string>
<string>FontAwesome6_Solid.ttf</string>
<string>FontAwesome5_Brands.ttf</string>
<string>FontAwesome5_Solid.ttf</string>
<string>FontAwesome6_Regular.ttf</string>
<string>SimpleLineIcons.ttf</string>
<string>Entypo.ttf</string>
<string>Feather.ttf</string>
<string>AntDesign.ttf</string>
</array>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>

View File

@@ -30,7 +30,7 @@ PODS:
- ExpoModulesCore
- EXConstants (14.4.2):
- ExpoModulesCore
- EXFileSystem (15.4.4):
- EXFileSystem (15.4.5):
- ExpoModulesCore
- EXFont (11.1.1):
- ExpoModulesCore
@@ -40,7 +40,7 @@ PODS:
- EXJSONUtils (0.7.1)
- EXManifests (0.7.2):
- ExpoModulesCore
- Expo (49.0.16):
- Expo (49.0.23):
- ExpoModulesCore
- ExpoAdapterGoogleSignIn (10.1.1):
- ExpoModulesCore
@@ -54,7 +54,7 @@ PODS:
- ExpoModulesCore
- ExpoLocalization (14.1.1):
- ExpoModulesCore
- ExpoModulesCore (1.5.11):
- ExpoModulesCore (1.5.13):
- RCT-Folly (= 2021.07.22.00)
- React-Core
- React-RCTAppDelegate
@@ -842,18 +842,18 @@ SPEC CHECKSUMS:
EXBarCodeScanner: 8e23fae8d267dbef9f04817833a494200f1fce35
EXCamera: 2dc2bd2828bca4e283018a0b5a84aec6639ff0b4
EXConstants: ce5bbea779da8031ac818c36bea41b10e14d04e1
EXFileSystem: 2b826a3bf1071a4b80a8457e97124783d1ac860e
EXFileSystem: f8b838a880254de42a5a7da20ed5ce12e2697c1b
EXFont: 6ea3800df746be7233208d80fe379b8ed74f4272
EXImageLoader: fd053169a8ee932dd83bf1fe5487a50c26d27c2b
EXJSONUtils: 6802be4282d42b97c51682468ddc1026a06f8276
EXManifests: cf66451b11b2c2f6464917528d792759f7fd6ce0
Expo: fcfd60c1ed6806dee5103b210335ae0c72f675ed
Expo: ba9abdf444dc6d2c05a82c4c1b51a2400beb6167
ExpoAdapterGoogleSignIn: 6c55782832b7fbdc2c27dac05ef00445c103b8f3
ExpoCrypto: 42485127a5968dda6f67ac5f2b42d3c0af31d7db
ExpoKeepAwake: be4cbd52d9b177cde0fd66daa1913afa3161fc1d
ExpoLocalAuthentication: 32919307c66fb3661caefa07e7811a95a7539d7b
ExpoLocalization: f26cd431ad9ea3533c5b08c4fabd879176a794bb
ExpoModulesCore: d9d45dcbb86a5dba2ec62253267720cb58516f75
ExpoModulesCore: f0581cd745335dd7a68117f6fedd22b98e2c73f0
ExpoWebBrowser: b6e56949734089d75f758f21cfe93fad02bd828c
EXSplashScreen: 5ed09ea490155ef603d007d9f194c9e04a4b7980
EXStructuredHeaders: 324cc3130571d2696357fafd8be7fd9a0b5fdf6e
@@ -938,4 +938,4 @@ SPEC CHECKSUMS:
PODFILE CHECKSUM: 90dfa5dbb6ca0103a4e49014140523aff5458f68
COCOAPODS: 1.14.3
COCOAPODS: 1.15.2

View File

@@ -1,3 +1,70 @@
// jest.config.js
const {defaults: tsjPreset} = require('ts-jest/presets');
module.exports = {
...tsjPreset,
preset: 'react-native',
setupFilesAfterEnv: ['@testing-library/jest-native/extend-expect'],
testPathIgnorePatterns: ['<rootDir>/node_modules/', '\\.snap$'],
cacheDirectory: '.jest/cache',
testEnvironment: 'jsdom',
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
globals: {
__DEV__: true,
},
transform: {
'^.+\\.jsx$': 'babel-jest',
'^.+\\.tsx?$': [
'ts-jest',
{
// TODO: Remove this to log the type mismatch errors later.
diagnostics: {
exclude: ['**'],
},
tsconfig: '<rootDir>/tsconfig.spec.json',
},
],
},
// This line should be kept even with nothing to be ignored, otherwise the transform will not take place.
// Not quite sure about the reason.
testRegex: '(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$',
transformIgnorePatterns: [
'node_modules/(?!((jest-)?react-native|@react-native(-community)?)|expo(nent)?|@expo(nent)?/.*|@expo-google-fonts/.*|react-navigation|@react-navigation/.*|@unimodules/.*|unimodules|sentry-expo|native-base|react-native-svg)',
'node_modules/(?!(@react-native|react-native|react-native-argon2|@react-navigation|react-native-elements|react-native-size-matters|react-native-ratings|expo-constants|base58-universal|@react-native-*|react-native-google-signin|react-native-linear-gradient|expo-camera|base58-universal/*|react-native-*)/).*/',
],
setupFiles: [
'<rootDir>/__mocks__/svg.mock.js',
'<rootDir>/__mocks__/jest-init.js',
'<rootDir>/__mocks__/mmkv-db-setup.js',
'<rootDir>/__mocks__/react-native.mock.js',
'<rootDir>/__mocks__/telemetry-sdk.mock.js',
'<rootDir>/__mocks__/expo-constants.mock.js',
'<rootDir>/node_modules/react-native-mmkv-storage/jest/mmkvJestSetup.js',
'<rootDir>/node_modules/@react-native-community/netinfo/jest/netinfo-mock.js',
'<rootDir>/__mocks__/react-native-argon2.mock.js',
// https://github.com/react-native-google-signin/google-signin?tab=readme-ov-file#jest-module-mock
'<rootDir>/node_modules/@react-native-google-signin/google-signin/jest/build/setup.js',
],
// TODO: enable this to also collect coverage
collectCoverage: false,
collectCoverageFrom: [
'routes/*.ts',
'screens/**',
'machines/**',
'lib/jsonld-signatures/**',
'components/**',
'machines/**',
'shared/**',
'**/*.{js,jsx}',
'!**/node_modules/**',
],
coverageDirectory: 'coverage',
moduleNameMapper: {
// https://stackoverflow.com/a/54513338
'\\.(jpg|ico|jpeg|png|gif|eot|otf|webp|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
'<rootDir>/__mocks__/fileMock.js',
'\\.(svg)$': '<rootDir>/__mocks__/svg.mock.js',
'^\\.\\/locales\\/en\\.json$': '<rootDir>/__mocks__/en.mock.json',
'^react-native-biometrics-changed$':
'<rootDir>/__mocks__/react-native-biometrics-changed.js',
},
};

View File

@@ -97,7 +97,7 @@
"offlineAuthenticationDisabled": "تفعيل لتسجيل الدخول عبر الإنترنت",
"inProgress": "في تَقَدم",
"credentialActivated": "مفعل",
"profileAuthenticated": "رمز الاستجابة السريعة تسجيل الدخول",
"profileAuthenticated": "رمز الاستجابة السريعة تسجيل الدخول"
},
"BindingVcWarningOverlay": {
"alert": "يرجى تأكيد",

View File

@@ -1,32 +1,36 @@
// This file was automatically generated. Edits will be overwritten
export interface Typegen0 {
'@@xstate/typegen': true;
internalEvents: {
'xstate.init': {type: 'xstate.init'};
};
invokeSrcNameMap: {};
missingImplementations: {
actions: never;
delays: never;
guards: never;
services: never;
};
eventsCausingActions: {
loadActivities: 'REFRESH' | 'xstate.init';
prependActivity: 'STORE_RESPONSE';
setActivities: 'STORE_RESPONSE';
storeActivity: 'LOG_ACTIVITY';
};
eventsCausingDelays: {};
eventsCausingGuards: {};
eventsCausingServices: {};
matchesStates:
| 'init'
| 'ready'
| 'ready.idle'
| 'ready.logging'
| 'ready.refreshing'
| {ready?: 'idle' | 'logging' | 'refreshing'};
tags: never;
}
// This file was automatically generated. Edits will be overwritten
export interface Typegen0 {
'@@xstate/typegen': true;
internalEvents: {
"xstate.init": { type: "xstate.init" };
};
invokeSrcNameMap: {
};
missingImplementations: {
actions: never;
delays: never;
guards: never;
services: never;
};
eventsCausingActions: {
"loadActivities": "REFRESH" | "xstate.init";
"prependActivity": "STORE_RESPONSE";
"setActivities": "STORE_RESPONSE";
"storeActivity": "LOG_ACTIVITY";
};
eventsCausingDelays: {
};
eventsCausingGuards: {
};
eventsCausingServices: {
};
matchesStates: "init" | "ready" | "ready.idle" | "ready.logging" | "ready.refreshing" | { "ready"?: "idle" | "logging" | "refreshing"; };
tags: never;
}

View File

@@ -180,7 +180,7 @@ export const authMachine = model.createMachine(
downloadFaceSdkModel: () => () => {
downloadModel();
},
generatePasscodeSalt: () => async context => {
generatePasscodeSalt: () => async () => {
const randomBytes = await generateSecureRandom(16);
return binaryToBase64(randomBytes) as string;
},
@@ -212,7 +212,7 @@ export function createAuthMachine(serviceRefs: AppServices) {
type State = StateFrom<typeof authMachine>;
export function selectPasscode(state: State) {
return state.context.passcode;
return state?.context?.passcode;
}
export function selectPasscodeSalt(state: State) {
@@ -220,11 +220,11 @@ export function selectPasscodeSalt(state: State) {
}
export function selectBiometrics(state: State) {
return state.context.biometrics;
return state?.context?.biometrics;
}
export function selectCanUseBiometrics(state: State) {
return state.context.canUseBiometrics;
return state?.context?.canUseBiometrics;
}
export function selectAuthorized(state: State) {
@@ -236,7 +236,7 @@ export function selectUnauthorized(state: State) {
}
export function selectSettingUp(state: State) {
return state.matches('settingUp');
return state?.matches('settingUp');
}
export function selectLanguagesetup(state: State) {

View File

@@ -1,65 +1,45 @@
// This file was automatically generated. Edits will be overwritten
export interface Typegen0 {
'@@xstate/typegen': true;
internalEvents: {
'': {type: ''};
'done.invoke.auth.authorized:invocation[0]': {
type: 'done.invoke.auth.authorized:invocation[0]';
data: unknown;
__tip: 'See the XState TS docs to learn how to strongly type this.';
};
'done.invoke.auth.introSlider:invocation[0]': {
type: 'done.invoke.auth.introSlider:invocation[0]';
data: unknown;
__tip: 'See the XState TS docs to learn how to strongly type this.';
};
'xstate.init': {type: 'xstate.init'};
};
invokeSrcNameMap: {
downloadFaceSdkModel: 'done.invoke.auth.authorized:invocation[0]';
generatePasscodeSalt: 'done.invoke.auth.introSlider:invocation[0]';
};
missingImplementations: {
actions: never;
delays: never;
guards: never;
services: never;
};
eventsCausingActions: {
requestStoredContext: 'xstate.init';
setBiometrics: 'SETUP_BIOMETRICS';
setContext: 'STORE_RESPONSE';
setIsToggleFromSettings: 'CHANGE_METHOD';
setLanguage: 'SETUP_BIOMETRICS' | 'SETUP_PASSCODE';
setPasscode: 'SETUP_PASSCODE';
setPasscodeSalt: 'done.invoke.auth.introSlider:invocation[0]';
storeContext:
| 'SETUP_BIOMETRICS'
| 'SETUP_PASSCODE'
| 'STORE_RESPONSE'
| 'done.invoke.auth.authorized:invocation[0]'
| 'done.invoke.auth.introSlider:invocation[0]';
};
eventsCausingDelays: {};
eventsCausingGuards: {
hasBiometricSet: '';
hasData: 'STORE_RESPONSE';
hasLanguageset: '';
hasPasscodeSet: '';
};
eventsCausingServices: {
downloadFaceSdkModel: 'LOGIN' | 'SETUP_BIOMETRICS' | 'SETUP_PASSCODE';
generatePasscodeSalt: 'SELECT';
};
matchesStates:
| 'authorized'
| 'checkingAuth'
| 'init'
| 'introSlider'
| 'languagesetup'
| 'savingDefaults'
| 'settingUp'
| 'unauthorized';
tags: never;
}
export interface Typegen0 {
'@@xstate/typegen': true;
internalEvents: {
"": { type: "" };
"done.invoke.auth.authorized:invocation[0]": { type: "done.invoke.auth.authorized:invocation[0]"; data: unknown; __tip: "See the XState TS docs to learn how to strongly type this." };
"done.invoke.auth.introSlider:invocation[0]": { type: "done.invoke.auth.introSlider:invocation[0]"; data: unknown; __tip: "See the XState TS docs to learn how to strongly type this." };
"xstate.init": { type: "xstate.init" };
};
invokeSrcNameMap: {
"downloadFaceSdkModel": "done.invoke.auth.authorized:invocation[0]";
"generatePasscodeSalt": "done.invoke.auth.introSlider:invocation[0]";
};
missingImplementations: {
actions: never;
delays: never;
guards: never;
services: never;
};
eventsCausingActions: {
"requestStoredContext": "xstate.init";
"setBiometrics": "SETUP_BIOMETRICS";
"setContext": "STORE_RESPONSE";
"setIsToggleFromSettings": "CHANGE_METHOD";
"setLanguage": "SETUP_BIOMETRICS" | "SETUP_PASSCODE";
"setPasscode": "SETUP_PASSCODE";
"setPasscodeSalt": "done.invoke.auth.introSlider:invocation[0]";
"storeContext": "SETUP_BIOMETRICS" | "SETUP_PASSCODE" | "STORE_RESPONSE" | "done.invoke.auth.authorized:invocation[0]" | "done.invoke.auth.introSlider:invocation[0]";
};
eventsCausingDelays: {
};
eventsCausingGuards: {
"hasBiometricSet": "";
"hasData": "STORE_RESPONSE";
"hasLanguageset": "";
"hasPasscodeSet": "";
};
eventsCausingServices: {
"downloadFaceSdkModel": "LOGIN" | "SETUP_BIOMETRICS" | "SETUP_PASSCODE";
"generatePasscodeSalt": "SELECT";
};
matchesStates: "authorized" | "checkingAuth" | "init" | "introSlider" | "languagesetup" | "savingDefaults" | "settingUp" | "unauthorized";
tags: never;
}

View File

@@ -1,168 +1,85 @@
// This file was automatically generated. Edits will be overwritten
export interface Typegen0 {
'@@xstate/typegen': true;
internalEvents: {
'': {type: ''};
'done.invoke.request.checkStorage:invocation[0]': {
type: 'done.invoke.request.checkStorage:invocation[0]';
data: unknown;
__tip: 'See the XState TS docs to learn how to strongly type this.';
};
'xstate.after(DESTROY_TIMEOUT)#request.clearingConnection': {
type: 'xstate.after(DESTROY_TIMEOUT)#request.clearingConnection';
};
'xstate.after(SHARING_TIMEOUT)#request.waitingForVc.inProgress': {
type: 'xstate.after(SHARING_TIMEOUT)#request.waitingForVc.inProgress';
};
'xstate.init': {type: 'xstate.init'};
};
invokeSrcNameMap: {
advertiseDevice: 'done.invoke.request.waitingForConnection:invocation[0]';
checkBluetoothService: 'done.invoke.request.checkingBluetoothService.checking:invocation[0]';
checkNearByDevicesPermission: 'done.invoke.request.checkNearbyDevicesPermission.checking:invocation[0]';
checkStorageAvailability: 'done.invoke.request.checkStorage:invocation[0]';
disconnect:
| 'done.invoke.request.clearingConnection:invocation[0]'
| 'done.invoke.request.reviewing.navigatingToHistory:invocation[0]'
| 'done.invoke.request.reviewing.navigatingToHome:invocation[0]';
monitorConnection: 'done.invoke.request:invocation[0]';
receiveVc: 'done.invoke.request.waitingForVc:invocation[0]';
requestBluetooth: 'done.invoke.request.checkingBluetoothService.requesting:invocation[0]';
requestNearByDevicesPermission: 'done.invoke.request.checkNearbyDevicesPermission.requesting:invocation[0]';
sendVcResponse:
| 'done.invoke.request.reviewing.accepted:invocation[0]'
| 'done.invoke.request.reviewing.rejected:invocation[0]'
| 'done.invoke.request.reviewing.savingFailed:invocation[0]';
};
missingImplementations: {
actions: never;
delays: never;
guards: never;
services: never;
};
eventsCausingActions: {
logReceived: 'CANCEL' | 'REJECT' | 'STORE_ERROR' | 'STORE_RESPONSE';
openAppPermission: 'GOTO_SETTINGS';
prependReceivedVcMetadata:
| 'ACCEPT'
| 'DISMISS'
| 'FACE_VALID'
| 'VC_RECEIVED';
registerLoggers:
| 'DISCONNECT'
| 'RESET'
| 'xstate.after(DESTROY_TIMEOUT)#request.clearingConnection';
removeLoggers:
| 'DISCONNECT'
| 'GOTO_HOME'
| 'RESET'
| 'SCREEN_BLUR'
| 'xstate.after(DESTROY_TIMEOUT)#request.clearingConnection'
| 'xstate.init';
removeReceivedVcMetadataFromStorage: 'STORE_ERROR';
sendBLEConnectionErrorEvent: 'BLE_ERROR';
sendVCReceiveFailedEvent: 'FACE_INVALID';
sendVCReceiveFlowTimeoutEndEvent: 'CANCEL';
sendVCReceiveRejectedEvent: 'CANCEL' | 'REJECT' | 'STORE_ERROR';
sendVCReceiveSuccessEvent: 'STORE_RESPONSE';
sendVCReceivingDisconnectedEvent: 'DISCONNECT';
sendVCReceivingStartEvent: 'CONNECTED';
sendVCReceivingTerminatedEvent: 'CANCEL';
sendVcReceived: 'STORE_RESPONSE';
setBleError: 'BLE_ERROR';
setIncomingVc: 'VC_RECEIVED';
setOpenID4VpUri: 'ADV_STARTED';
setReadyForBluetoothStateCheck: 'NEARBY_ENABLED';
setReceiveLogTypeDiscarded: 'CANCEL' | 'REJECT' | 'STORE_ERROR';
setReceiveLogTypeRegular: 'ACCEPT' | 'STORE_RESPONSE';
setReceiveLogTypeUnverified: 'FACE_INVALID';
setReceiveLogTypeVerified: 'FACE_VALID';
setReceiverInfo: 'CONNECTED';
setSenderInfo: 'CONNECTED';
storeVc: 'STORE_RESPONSE';
};
eventsCausingDelays: {
DESTROY_TIMEOUT: '' | 'DISMISS';
SHARING_TIMEOUT: 'CONNECTED';
};
eventsCausingGuards: {
isMinimumStorageLimitReached: 'done.invoke.request.checkStorage:invocation[0]';
};
eventsCausingServices: {
advertiseDevice:
| 'DISCONNECT'
| 'RESET'
| 'xstate.after(DESTROY_TIMEOUT)#request.clearingConnection';
checkBluetoothService: 'NEARBY_ENABLED';
checkNearByDevicesPermission:
| 'APP_ACTIVE'
| 'RESET'
| 'done.invoke.request.checkStorage:invocation[0]';
checkStorageAvailability: 'SCREEN_FOCUS';
disconnect: '' | 'DISMISS' | 'GOTO_HOME' | 'GO_TO_RECEIVED_VC_TAB';
monitorConnection: 'GOTO_HOME' | 'xstate.init';
receiveVc: 'CONNECTED';
requestBluetooth: 'BLUETOOTH_STATE_DISABLED';
requestNearByDevicesPermission: 'NEARBY_DISABLED';
sendVcResponse: 'CANCEL' | 'REJECT' | 'STORE_ERROR' | 'STORE_RESPONSE';
};
matchesStates:
| 'bluetoothDenied'
| 'cancelling'
| 'checkNearbyDevicesPermission'
| 'checkNearbyDevicesPermission.checking'
| 'checkNearbyDevicesPermission.requesting'
| 'checkStorage'
| 'checkingBluetoothService'
| 'checkingBluetoothService.checking'
| 'checkingBluetoothService.enabled'
| 'checkingBluetoothService.requesting'
| 'clearingConnection'
| 'disconnected'
| 'handlingBleError'
| 'inactive'
| 'nearByDevicesPermissionDenied'
| 'reviewing'
| 'reviewing.accepted'
| 'reviewing.accepting'
| 'reviewing.accepting.prependingReceivedVcMetadata'
| 'reviewing.accepting.storingVc'
| 'reviewing.displayingIncomingVC'
| 'reviewing.idle'
| 'reviewing.invalidIdentity'
| 'reviewing.navigatingToHistory'
| 'reviewing.navigatingToHome'
| 'reviewing.navigatingToReceivedCards'
| 'reviewing.rejected'
| 'reviewing.savingFailed'
| 'reviewing.savingFailed.idle'
| 'reviewing.verifyingIdentity'
| 'storageLimitReached'
| 'waitingForConnection'
| 'waitingForVc'
| 'waitingForVc.inProgress'
| 'waitingForVc.timeout'
| {
checkNearbyDevicesPermission?: 'checking' | 'requesting';
checkingBluetoothService?: 'checking' | 'enabled' | 'requesting';
reviewing?:
| 'accepted'
| 'accepting'
| 'displayingIncomingVC'
| 'idle'
| 'invalidIdentity'
| 'navigatingToHistory'
| 'navigatingToHome'
| 'navigatingToReceivedCards'
| 'rejected'
| 'savingFailed'
| 'verifyingIdentity'
| {
accepting?: 'prependingReceivedVcMetadata' | 'storingVc';
savingFailed?: 'idle';
};
waitingForVc?: 'inProgress' | 'timeout';
};
tags: never;
}
// This file was automatically generated. Edits will be overwritten
export interface Typegen0 {
'@@xstate/typegen': true;
internalEvents: {
"": { type: "" };
"done.invoke.request.checkStorage:invocation[0]": { type: "done.invoke.request.checkStorage:invocation[0]"; data: unknown; __tip: "See the XState TS docs to learn how to strongly type this." };
"xstate.after(DESTROY_TIMEOUT)#request.clearingConnection": { type: "xstate.after(DESTROY_TIMEOUT)#request.clearingConnection" };
"xstate.after(SHARING_TIMEOUT)#request.waitingForVc.inProgress": { type: "xstate.after(SHARING_TIMEOUT)#request.waitingForVc.inProgress" };
"xstate.init": { type: "xstate.init" };
};
invokeSrcNameMap: {
"advertiseDevice": "done.invoke.request.waitingForConnection:invocation[0]";
"checkBluetoothService": "done.invoke.request.checkingBluetoothService.checking:invocation[0]";
"checkNearByDevicesPermission": "done.invoke.request.checkNearbyDevicesPermission.checking:invocation[0]";
"checkStorageAvailability": "done.invoke.request.checkStorage:invocation[0]";
"disconnect": "done.invoke.request.clearingConnection:invocation[0]" | "done.invoke.request.reviewing.navigatingToHistory:invocation[0]" | "done.invoke.request.reviewing.navigatingToHome:invocation[0]";
"monitorConnection": "done.invoke.request:invocation[0]";
"receiveVc": "done.invoke.request.waitingForVc:invocation[0]";
"requestBluetooth": "done.invoke.request.checkingBluetoothService.requesting:invocation[0]";
"requestNearByDevicesPermission": "done.invoke.request.checkNearbyDevicesPermission.requesting:invocation[0]";
"sendVcResponse": "done.invoke.request.reviewing.accepted:invocation[0]" | "done.invoke.request.reviewing.rejected:invocation[0]" | "done.invoke.request.reviewing.savingFailed:invocation[0]";
};
missingImplementations: {
actions: never;
delays: never;
guards: never;
services: never;
};
eventsCausingActions: {
"logReceived": "CANCEL" | "REJECT" | "STORE_ERROR" | "STORE_RESPONSE";
"openAppPermission": "GOTO_SETTINGS";
"prependReceivedVcMetadata": "ACCEPT" | "DISMISS" | "FACE_VALID" | "VC_RECEIVED";
"registerLoggers": "DISCONNECT" | "RESET" | "xstate.after(DESTROY_TIMEOUT)#request.clearingConnection";
"removeLoggers": "DISCONNECT" | "GOTO_HOME" | "RESET" | "SCREEN_BLUR" | "xstate.after(DESTROY_TIMEOUT)#request.clearingConnection" | "xstate.init";
"removeReceivedVcMetadataFromStorage": "STORE_ERROR";
"sendBLEConnectionErrorEvent": "BLE_ERROR";
"sendVCReceiveFailedEvent": "FACE_INVALID";
"sendVCReceiveFlowTimeoutEndEvent": "CANCEL";
"sendVCReceiveRejectedEvent": "CANCEL" | "REJECT" | "STORE_ERROR";
"sendVCReceiveSuccessEvent": "STORE_RESPONSE";
"sendVCReceivingDisconnectedEvent": "DISCONNECT";
"sendVCReceivingStartEvent": "CONNECTED";
"sendVCReceivingTerminatedEvent": "CANCEL";
"sendVcReceived": "STORE_RESPONSE";
"setBleError": "BLE_ERROR";
"setIncomingVc": "VC_RECEIVED";
"setOpenID4VpUri": "ADV_STARTED";
"setReadyForBluetoothStateCheck": "NEARBY_ENABLED";
"setReceiveLogTypeDiscarded": "CANCEL" | "REJECT" | "STORE_ERROR";
"setReceiveLogTypeRegular": "ACCEPT" | "STORE_RESPONSE";
"setReceiveLogTypeUnverified": "FACE_INVALID";
"setReceiveLogTypeVerified": "FACE_VALID";
"setReceiverInfo": "CONNECTED";
"setSenderInfo": "CONNECTED";
"storeVc": "STORE_RESPONSE";
};
eventsCausingDelays: {
"DESTROY_TIMEOUT": "" | "DISMISS";
"SHARING_TIMEOUT": "CONNECTED";
};
eventsCausingGuards: {
"isMinimumStorageLimitReached": "done.invoke.request.checkStorage:invocation[0]";
};
eventsCausingServices: {
"advertiseDevice": "DISCONNECT" | "RESET" | "xstate.after(DESTROY_TIMEOUT)#request.clearingConnection";
"checkBluetoothService": "NEARBY_ENABLED";
"checkNearByDevicesPermission": "APP_ACTIVE" | "RESET" | "done.invoke.request.checkStorage:invocation[0]";
"checkStorageAvailability": "SCREEN_FOCUS";
"disconnect": "" | "DISMISS" | "GOTO_HOME" | "GO_TO_RECEIVED_VC_TAB";
"monitorConnection": "GOTO_HOME" | "xstate.init";
"receiveVc": "CONNECTED";
"requestBluetooth": "BLUETOOTH_STATE_DISABLED";
"requestNearByDevicesPermission": "NEARBY_DISABLED";
"sendVcResponse": "CANCEL" | "REJECT" | "STORE_ERROR" | "STORE_RESPONSE";
};
matchesStates: "bluetoothDenied" | "cancelling" | "checkNearbyDevicesPermission" | "checkNearbyDevicesPermission.checking" | "checkNearbyDevicesPermission.requesting" | "checkStorage" | "checkingBluetoothService" | "checkingBluetoothService.checking" | "checkingBluetoothService.enabled" | "checkingBluetoothService.requesting" | "clearingConnection" | "disconnected" | "handlingBleError" | "inactive" | "nearByDevicesPermissionDenied" | "reviewing" | "reviewing.accepted" | "reviewing.accepting" | "reviewing.accepting.prependingReceivedVcMetadata" | "reviewing.accepting.storingVc" | "reviewing.displayingIncomingVC" | "reviewing.idle" | "reviewing.invalidIdentity" | "reviewing.navigatingToHistory" | "reviewing.navigatingToHome" | "reviewing.navigatingToReceivedCards" | "reviewing.rejected" | "reviewing.savingFailed" | "reviewing.savingFailed.idle" | "reviewing.verifyingIdentity" | "storageLimitReached" | "waitingForConnection" | "waitingForVc" | "waitingForVc.inProgress" | "waitingForVc.timeout" | { "checkNearbyDevicesPermission"?: "checking" | "requesting";
"checkingBluetoothService"?: "checking" | "enabled" | "requesting";
"reviewing"?: "accepted" | "accepting" | "displayingIncomingVC" | "idle" | "invalidIdentity" | "navigatingToHistory" | "navigatingToHome" | "navigatingToReceivedCards" | "rejected" | "savingFailed" | "verifyingIdentity" | { "accepting"?: "prependingReceivedVcMetadata" | "storingVc";
"savingFailed"?: "idle"; };
"waitingForVc"?: "inProgress" | "timeout"; };
tags: never;
}

View File

@@ -1,213 +1,112 @@
// 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.';
};
'xstate.after(DESTROY_TIMEOUT)#scan.clearingConnection': {
type: 'xstate.after(DESTROY_TIMEOUT)#scan.clearingConnection';
};
'xstate.init': {type: 'xstate.init'};
};
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.checkingLocationState.checkingPermissionStatus:invocation[0]';
checkLocationStatus: 'done.invoke.scan.checkingLocationState.checkLocationService:invocation[0]';
checkNearByDevicesPermission: 'done.invoke.scan.checkNearbyDevicesPermission.checking:invocation[0]';
checkStorageAvailability: 'done.invoke.scan.checkStorage:invocation[0]';
disconnect:
| 'done.invoke.scan.clearingConnection:invocation[0]'
| 'done.invoke.scan.disconnectDevice:invocation[0]'
| 'done.invoke.scan.reviewing.disconnect: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.checkingLocationState.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: {
clearUri: 'STORE_RESPONSE';
getFaceAuthConsent:
| 'DISCONNECT'
| 'DISMISS'
| 'xstate.after(DESTROY_TIMEOUT)#scan.clearingConnection';
logFailedVerification: 'FACE_INVALID';
logShared: 'VC_ACCEPTED';
openAppPermission: 'GOTO_SETTINGS' | 'LOCATION_REQUEST';
openBluetoothSettings: 'GOTO_SETTINGS';
registerLoggers: 'STORE_RESPONSE';
removeLoggers:
| 'DISCONNECT'
| 'DISMISS'
| 'SCREEN_BLUR'
| 'STORE_RESPONSE'
| 'xstate.init';
resetFaceCaptureBannerStatus: 'ACCEPT_REQUEST' | 'CLOSE_BANNER';
resetFlowType: 'GOTO_HISTORY';
resetSelectedVc: 'GOTO_HISTORY';
sendBLEConnectionErrorEvent: 'BLE_ERROR';
sendScanData: 'SCAN';
sendVCShareFlowCancelEndEvent: 'CANCEL';
sendVCShareFlowTimeoutEndEvent: 'CANCEL' | 'RETRY';
sendVcShareSuccessEvent: 'VC_ACCEPTED';
sendVcSharingStartEvent: 'SCAN';
setBleError: 'BLE_ERROR';
setChildRef: 'STORE_RESPONSE';
setFlowType: 'SELECT_VC';
setLinkCode: 'SCAN';
setReadyForBluetoothStateCheck: 'BLUETOOTH_PERMISSION_ENABLED';
setReceiverInfo: 'CONNECTED';
setSelectedVc: 'SELECT_VC';
setSenderInfo: 'CONNECTED';
setShareLogTypeUnverified: 'ACCEPT_REQUEST' | 'CHECK_FLOW_TYPE';
setShareLogTypeVerified: 'FACE_VALID';
setShowFaceAuthConsent: 'FACE_VERIFICATION_CONSENT';
setUri: 'SCAN';
storeLoginItem: 'done.invoke.QrLogin';
storeShowFaceAuthConsent: 'FACE_VERIFICATION_CONSENT';
storingActivityLog: 'STORE_RESPONSE';
updateFaceCaptureBannerStatus: 'FACE_VALID';
updateShowFaceAuthConsent: 'STORE_RESPONSE';
};
eventsCausingDelays: {
CONNECTION_TIMEOUT: 'SCAN';
DESTROY_TIMEOUT: '' | 'DISMISS' | 'LOCATION_ENABLED' | 'RETRY';
SHARING_TIMEOUT: 'ACCEPT_REQUEST' | 'CHECK_FLOW_TYPE' | 'FACE_VALID';
};
eventsCausingGuards: {
isFlowTypeMiniViewShare: 'CHECK_FLOW_TYPE';
isFlowTypeMiniViewShareWithSelfie: 'CHECK_FLOW_TYPE';
isFlowTypeSimpleShare: 'CANCEL' | 'CHECK_FLOW_TYPE' | 'DISMISS';
isIOS: 'BLUETOOTH_STATE_DISABLED' | 'START_PERMISSION_CHECK';
isMinimumStorageRequiredForAuditEntryReached: 'done.invoke.scan.checkStorage:invocation[0]';
isOpenIdQr: 'SCAN';
isQrLogin: 'SCAN';
showFaceAuthConsentScreen: 'VERIFY_AND_ACCEPT_REQUEST';
uptoAndroid11: '' | 'START_PERMISSION_CHECK';
};
eventsCausingServices: {
QrLogin: 'SCAN';
checkBluetoothPermission:
| ''
| 'BLUETOOTH_STATE_DISABLED'
| 'NEARBY_ENABLED'
| 'START_PERMISSION_CHECK';
checkBluetoothState: '' | 'APP_ACTIVE';
checkLocationPermission: 'APP_ACTIVE' | 'LOCATION_ENABLED';
checkLocationStatus: '' | 'LOCATION_REQUEST';
checkNearByDevicesPermission: 'APP_ACTIVE' | 'START_PERMISSION_CHECK';
checkStorageAvailability: 'RESET' | 'SCREEN_FOCUS' | 'SELECT_VC';
disconnect: '' | 'DISMISS' | 'LOCATION_ENABLED' | 'RETRY' | 'SCREEN_BLUR';
monitorConnection: 'DISMISS' | 'SCREEN_BLUR' | 'xstate.init';
requestBluetooth: 'BLUETOOTH_STATE_DISABLED';
requestNearByDevicesPermission: 'NEARBY_DISABLED';
requestToEnableLocationPermission: 'LOCATION_DISABLED';
sendVc: 'ACCEPT_REQUEST' | 'CHECK_FLOW_TYPE' | 'FACE_VALID';
startConnection: 'SCAN';
};
matchesStates:
| 'bluetoothDenied'
| 'bluetoothPermissionDenied'
| 'checkBluetoothPermission'
| 'checkBluetoothPermission.checking'
| 'checkBluetoothPermission.enabled'
| 'checkBluetoothState'
| 'checkBluetoothState.checking'
| 'checkBluetoothState.enabled'
| 'checkBluetoothState.requesting'
| 'checkFaceAuthConsent'
| 'checkNearbyDevicesPermission'
| 'checkNearbyDevicesPermission.checking'
| 'checkNearbyDevicesPermission.enabled'
| 'checkNearbyDevicesPermission.requesting'
| 'checkStorage'
| 'checkingLocationState'
| 'checkingLocationState.checkLocationService'
| 'checkingLocationState.checkingPermissionStatus'
| 'checkingLocationState.denied'
| 'checkingLocationState.disabled'
| 'checkingLocationState.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.disconnect'
| 'reviewing.faceVerificationConsent'
| 'reviewing.idle'
| 'reviewing.invalidIdentity'
| 'reviewing.navigateToHistory'
| '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';
checkingLocationState?:
| 'checkLocationService'
| 'checkingPermissionStatus'
| 'denied'
| 'disabled'
| 'requestToEnableLocation';
connecting?: 'inProgress' | 'timeout';
recheckBluetoothState?: 'checking' | 'enabled';
reviewing?:
| 'accepted'
| 'cancelling'
| 'disconnect'
| 'faceVerificationConsent'
| 'idle'
| 'invalidIdentity'
| 'navigateToHistory'
| 'rejected'
| 'selectingVc'
| 'sendingVc'
| 'verifyingIdentity'
| {sendingVc?: 'inProgress' | 'sent' | 'timeout'};
showQrLogin?: 'idle' | 'navigatingToHistory' | 'storing';
};
tags: never;
}
// 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." };
"xstate.after(DESTROY_TIMEOUT)#scan.clearingConnection": { type: "xstate.after(DESTROY_TIMEOUT)#scan.clearingConnection" };
"xstate.init": { type: "xstate.init" };
};
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.checkingLocationState.checkingPermissionStatus:invocation[0]";
"checkLocationStatus": "done.invoke.scan.checkingLocationState.checkLocationService:invocation[0]";
"checkNearByDevicesPermission": "done.invoke.scan.checkNearbyDevicesPermission.checking:invocation[0]";
"checkStorageAvailability": "done.invoke.scan.checkStorage:invocation[0]";
"disconnect": "done.invoke.scan.clearingConnection:invocation[0]" | "done.invoke.scan.disconnectDevice:invocation[0]" | "done.invoke.scan.reviewing.disconnect: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.checkingLocationState.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: {
"clearUri": "STORE_RESPONSE";
"getFaceAuthConsent": "DISCONNECT" | "DISMISS" | "xstate.after(DESTROY_TIMEOUT)#scan.clearingConnection";
"logFailedVerification": "FACE_INVALID";
"logShared": "VC_ACCEPTED";
"openAppPermission": "GOTO_SETTINGS" | "LOCATION_REQUEST";
"openBluetoothSettings": "GOTO_SETTINGS";
"registerLoggers": "STORE_RESPONSE";
"removeLoggers": "DISCONNECT" | "DISMISS" | "SCREEN_BLUR" | "STORE_RESPONSE" | "xstate.init";
"resetFaceCaptureBannerStatus": "ACCEPT_REQUEST" | "CLOSE_BANNER";
"resetFlowType": "DISCONNECT" | "DISMISS" | "GOTO_HISTORY" | "SCREEN_BLUR" | "xstate.init";
"resetSelectedVc": "DISCONNECT" | "DISMISS" | "GOTO_HISTORY" | "SCREEN_BLUR" | "xstate.init";
"sendBLEConnectionErrorEvent": "BLE_ERROR";
"sendScanData": "SCAN";
"sendVCShareFlowCancelEndEvent": "CANCEL";
"sendVCShareFlowTimeoutEndEvent": "CANCEL" | "RETRY";
"sendVcShareSuccessEvent": "VC_ACCEPTED";
"sendVcSharingStartEvent": "SCAN";
"setBleError": "BLE_ERROR";
"setChildRef": "STORE_RESPONSE";
"setFlowType": "SELECT_VC";
"setLinkCode": "SCAN";
"setReadyForBluetoothStateCheck": "BLUETOOTH_PERMISSION_ENABLED";
"setReceiverInfo": "CONNECTED";
"setSelectedVc": "SELECT_VC";
"setSenderInfo": "CONNECTED";
"setShareLogTypeUnverified": "ACCEPT_REQUEST" | "CHECK_FLOW_TYPE";
"setShareLogTypeVerified": "FACE_VALID";
"setShowFaceAuthConsent": "FACE_VERIFICATION_CONSENT";
"setUri": "SCAN";
"storeLoginItem": "done.invoke.QrLogin";
"storeShowFaceAuthConsent": "FACE_VERIFICATION_CONSENT";
"storingActivityLog": "STORE_RESPONSE";
"updateFaceCaptureBannerStatus": "FACE_VALID";
"updateShowFaceAuthConsent": "STORE_RESPONSE";
};
eventsCausingDelays: {
"CONNECTION_TIMEOUT": "SCAN";
"DESTROY_TIMEOUT": "" | "DISMISS" | "LOCATION_ENABLED" | "RETRY";
"SHARING_TIMEOUT": "ACCEPT_REQUEST" | "CHECK_FLOW_TYPE" | "FACE_VALID";
};
eventsCausingGuards: {
"isFlowTypeMiniViewShare": "CHECK_FLOW_TYPE";
"isFlowTypeMiniViewShareWithSelfie": "CHECK_FLOW_TYPE";
"isFlowTypeSimpleShare": "CANCEL" | "CHECK_FLOW_TYPE" | "DISMISS";
"isIOS": "BLUETOOTH_STATE_DISABLED" | "START_PERMISSION_CHECK";
"isMinimumStorageRequiredForAuditEntryReached": "done.invoke.scan.checkStorage:invocation[0]";
"isOpenIdQr": "SCAN";
"isQrLogin": "SCAN";
"showFaceAuthConsentScreen": "VERIFY_AND_ACCEPT_REQUEST";
"uptoAndroid11": "" | "START_PERMISSION_CHECK";
};
eventsCausingServices: {
"QrLogin": "SCAN";
"checkBluetoothPermission": "" | "BLUETOOTH_STATE_DISABLED" | "NEARBY_ENABLED" | "START_PERMISSION_CHECK";
"checkBluetoothState": "" | "APP_ACTIVE";
"checkLocationPermission": "APP_ACTIVE" | "LOCATION_ENABLED";
"checkLocationStatus": "" | "LOCATION_REQUEST";
"checkNearByDevicesPermission": "APP_ACTIVE" | "START_PERMISSION_CHECK";
"checkStorageAvailability": "RESET" | "SCREEN_FOCUS" | "SELECT_VC";
"disconnect": "" | "DISMISS" | "LOCATION_ENABLED" | "RETRY" | "SCREEN_BLUR";
"monitorConnection": "DISMISS" | "SCREEN_BLUR" | "xstate.init";
"requestBluetooth": "BLUETOOTH_STATE_DISABLED";
"requestNearByDevicesPermission": "NEARBY_DISABLED";
"requestToEnableLocationPermission": "LOCATION_DISABLED";
"sendVc": "ACCEPT_REQUEST" | "CHECK_FLOW_TYPE" | "FACE_VALID";
"startConnection": "SCAN";
};
matchesStates: "bluetoothDenied" | "bluetoothPermissionDenied" | "checkBluetoothPermission" | "checkBluetoothPermission.checking" | "checkBluetoothPermission.enabled" | "checkBluetoothState" | "checkBluetoothState.checking" | "checkBluetoothState.enabled" | "checkBluetoothState.requesting" | "checkFaceAuthConsent" | "checkNearbyDevicesPermission" | "checkNearbyDevicesPermission.checking" | "checkNearbyDevicesPermission.enabled" | "checkNearbyDevicesPermission.requesting" | "checkStorage" | "checkingLocationState" | "checkingLocationState.checkLocationService" | "checkingLocationState.checkingPermissionStatus" | "checkingLocationState.denied" | "checkingLocationState.disabled" | "checkingLocationState.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.disconnect" | "reviewing.faceVerificationConsent" | "reviewing.idle" | "reviewing.invalidIdentity" | "reviewing.navigateToHistory" | "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";
"checkingLocationState"?: "checkLocationService" | "checkingPermissionStatus" | "denied" | "disabled" | "requestToEnableLocation";
"connecting"?: "inProgress" | "timeout";
"recheckBluetoothState"?: "checking" | "enabled";
"reviewing"?: "accepted" | "cancelling" | "disconnect" | "faceVerificationConsent" | "idle" | "invalidIdentity" | "navigateToHistory" | "rejected" | "selectingVc" | "sendingVc" | "verifyingIdentity" | { "sendingVc"?: "inProgress" | "sent" | "timeout"; };
"showQrLogin"?: "idle" | "navigatingToHistory" | "storing"; };
tags: never;
}

View File

@@ -332,11 +332,11 @@ function deviceSupportsHardwareKeystore() {
type State = StateFrom<typeof settingsMachine>;
export function selectName(state: State) {
return state.context.name;
return state?.context?.name;
}
export function selectAppId(state: State) {
return state.context.appId;
return state?.context?.appId;
}
/** Alerting the user when the hardware keystore not supported by device and
@@ -353,31 +353,31 @@ export function selectShowAccountSelectionConfirmation(state: State) {
}
export function selectVcLabel(state: State) {
return state.context.vcLabel;
return state?.context?.vcLabel;
}
export function selectCredentialRegistry(state: State) {
return state.context.credentialRegistry;
return state?.context?.credentialRegistry;
}
export function selectEsignetHostUrl(state: State) {
return state.context.esignetHostUrl;
return state?.context?.esignetHostUrl;
}
export function selectCredentialRegistryResponse(state: State) {
return state.context.credentialRegistryResponse;
return state?.context?.credentialRegistryResponse;
}
export function selectBiometricUnlockEnabled(state: State) {
return state.context.isBiometricUnlockEnabled;
return state?.context?.isBiometricUnlockEnabled;
}
export function selectIsResetInjiProps(state: State) {
return state.matches('resetInjiProps');
return state?.matches('resetInjiProps');
}
export function selectIsBackUpAndRestoreExplored(state: State) {
return state.context.isBackupAndRestoreExplored;
return state?.context?.isBackupAndRestoreExplored;
}
export function selectIsBiometricUnlock(state: State) {

5104
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -8,6 +8,7 @@
"build:android:mosip": "cd android && ./gradlew :app:assembleResidentappRelease && cd ..",
"lint": "eslint . --ext .js,.jsx,.ts,.tsx --fix",
"test": "jest",
"test-coverage": "jest --coverage",
"postinstall": "patch-package && npm run jetify && sh tools/talisman/talisman-precommit.sh"
},
"dependencies": {
@@ -33,7 +34,7 @@
"base64url-universal": "^1.1.0",
"buffer": "^6.0.3",
"date-fns": "^2.26.0",
"expo": "^49.0.16",
"expo": "~49.0.23",
"expo-auth-session": "^5.2.0",
"expo-barcode-scanner": "~12.3.2",
"expo-camera": "^13.6.0",
@@ -41,7 +42,7 @@
"expo-font": "~11.1.1",
"expo-local-authentication": "~13.3.0",
"expo-localization": "~14.1.1",
"expo-modules-autolinking": "^1.5.1",
"expo-modules-autolinking": "~1.5.0",
"expo-splash-screen": "^0.22.0",
"expo-updates": "^0.18.17",
"expo-web-browser": "^12.5.0",
@@ -87,6 +88,7 @@
"react-native-svg": "13.4.0",
"react-native-vector-icons": "^10.0.0",
"react-native-zip-archive": "^6.1.0",
"react-test-renderer": "^18.2.0",
"short-unique-id": "^4.4.4",
"simple-pem2jwk": "^0.2.4",
"telemetry-sdk": "git://github.com/mosip/sunbird-telemetry-sdk.git#f762be5732ee552c0c70bdd540aa4e2701554c71",
@@ -95,13 +97,19 @@
"devDependencies": {
"@babel/core": "^7.20.0",
"@babel/preset-env": "^7.20.0",
"@babel/preset-react": "^7.23.3",
"@babel/preset-typescript": "^7.23.3",
"@babel/runtime": "^7.20.0",
"@jest/globals": "^29.7.0",
"@react-native-community/eslint-config": "^3.2.0",
"@react-native/assets-registry": "^0.72.0",
"@react-navigation/devtools": "^6.0.19",
"@testing-library/jest-native": "^5.4.3",
"@testing-library/react-native": "^12.4.3",
"@tsconfig/react-native": "^2.0.2",
"@types/jest": "^29.5.11",
"@types/node-forge": "^1.3.9",
"@types/react": "^18.0.24",
"@types/react-native": "~0.64.12",
"@typescript-eslint/eslint-plugin": "^5.17.0",
"@typescript-eslint/parser": "^5.17.0",
"babel-jest": "^29.2.1",
@@ -114,6 +122,7 @@
"glob": "^8.0.1",
"husky": "^7.0.4",
"jest": "^29.2.1",
"jest-environment-jsdom": "^29.7.0",
"jetifier": "^2.0.0",
"lint-staged": "^12.3.7",
"prettier": "^2.6.1",
@@ -122,7 +131,8 @@
"react-native-svg-transformer": "^1.1.0",
"react-native-url-polyfill": "^2.0.0",
"rn-mmkv-storage-flipper": "^1.1.1",
"typescript": "^4.9.4"
"ts-jest": "^29.1.1",
"typescript": "^4.9.5"
},
"private": true,
"name": "mosip-resident-app",

View File

@@ -1,20 +1,14 @@
import React, {useEffect, useState} from 'react';
import {TFunction, useTranslation} from 'react-i18next';
import QRCode from 'react-native-qrcode-svg';
import {Centered, Button, Column, Text} from '../../components/ui';
import {Theme} from '../../components/ui/styleUtils';
import {useRequestScreen} from './RequestScreenController';
import BluetoothStateManager from 'react-native-bluetooth-state-manager';
import {Platform, View} from 'react-native';
import Storage from '../../shared/storage';
import {View} from 'react-native';
import {ErrorMessageOverlay} from '../../components/MessageOverlay';
import {
NavigationProp,
useFocusEffect,
useNavigation,
} from '@react-navigation/native';
import {MainBottomTabParamList} from '../../routes/routeTypes';
import {NavigationProp, useNavigation} from '@react-navigation/native';
import {MainBottomTabParamList} from '../../routes/main';
import {BOTTOM_TAB_ROUTES} from '../../routes/routesConstants';
import {ProgressingModal} from '../../components/ProgressingModal';
import {isIOS} from '../../shared/constants';

View File

@@ -0,0 +1,46 @@
import React from 'react';
import {SettingScreen} from './SettingScreen';
import ShallowRenderer from 'react-test-renderer/shallow';
import mockedConstants from '../../__mocks__/react-native.mock';
describe('testing the settingsScreen component in Android and IOS', () => {
beforeEach(() => {
// Mock Platform module for Android
jest.mock('expo-constants', () => {
mockedConstants.Platform.OS = 'android';
return mockedConstants;
});
});
it('renders the SettingScreen component in android', () => {
const renderer = new ShallowRenderer();
const result = renderer.render(
<SettingScreen
triggerComponent={undefined}
navigation={undefined}
route={undefined}
/>,
);
expect(result).toMatchSnapshot();
});
it('renders the SettingScreen component in IOS', () => {
// Clear the previous mock
jest.resetModules();
// Mock Platform module for IOS
jest.mock('expo-constants', () => {
mockedConstants.Platform.OS = 'ios';
return mockedConstants;
});
const renderer = new ShallowRenderer();
const result = renderer.render(
<SettingScreen
triggerComponent={undefined}
navigation={undefined}
route={undefined}
/>,
);
expect(result).toMatchSnapshot();
});
});

View File

@@ -28,15 +28,13 @@ import {
} from '../../machines/biometrics';
import {GlobalContext} from '../../shared/GlobalContext';
import {useTranslation} from 'react-i18next';
import {Platform} from 'react-native';
import {RequestRouteProps, RootRouteProps} from '../../routes';
import {REQUEST_ROUTES} from '../../routes/routesConstants';
import {isIOS} from '../../shared/constants';
export function useSettingsScreen(props: RootRouteProps & RequestRouteProps) {
const {appService} = useContext(GlobalContext);
const authService = appService.children.get('auth');
const settingsService = appService.children.get('settings');
const authService = appService?.children?.get('auth') || {};
const settingsService = appService?.children?.get('settings') || {};
const [isVisible, setIsVisible] = useState(false);
@@ -110,21 +108,27 @@ export function useSettingsScreen(props: RootRouteProps & RequestRouteProps) {
hideAlert,
isPasscodeSet,
isSettingUp,
appId: useSelector(settingsService, selectAppId),
name: useSelector(settingsService, selectName),
vcLabel: useSelector(settingsService, selectVcLabel),
credentialRegistry: useSelector(settingsService, selectCredentialRegistry),
esignetHostUrl: useSelector(settingsService, selectEsignetHostUrl),
appId: useSelector(settingsService || {}, selectAppId),
name: useSelector(settingsService || {}, selectName),
vcLabel: useSelector(settingsService || {}, selectVcLabel),
credentialRegistry: useSelector(
settingsService || {},
selectCredentialRegistry,
),
esignetHostUrl: useSelector(settingsService || {}, selectEsignetHostUrl),
credentialRegistryResponse: useSelector(
settingsService,
settingsService || {},
selectCredentialRegistryResponse,
),
isBiometricUnlockEnabled: useSelector(
settingsService,
settingsService || {},
selectBiometricUnlockEnabled,
),
isResetInjiProps: useSelector(settingsService, selectIsResetInjiProps),
canUseBiometrics: useSelector(authService, selectCanUseBiometrics),
isResetInjiProps: useSelector(
settingsService || {},
selectIsResetInjiProps,
),
canUseBiometrics: useSelector(authService || {}, selectCanUseBiometrics),
useBiometrics,
UPDATE_NAME: (name: string) =>

View File

@@ -0,0 +1,409 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`testing the settingsScreen component in Android and IOS renders the SettingScreen component in IOS 1`] = `
<React.Fragment>
<Memo(Pressable)
accessible={false}
onPress={[Function]}
/>
<BannerNotificationContainer />
<mockConstructor
accessibilityLabel="settingsScreen"
accessible={true}
>
<Layout
backgroundColor="#F8F8F8"
style={
{
"display": "flex",
}
}
>
<Text
color="#666666"
margin="10"
style={
{
"paddingTop": 3,
}
}
testID="injiAsVerifierApp"
weight="semibold"
>
injiAsVerifierApp
</Text>
<Layout
align="space-evenly"
backgroundColor="#FFFFFF"
>
<Memo(Pressable)
accessibilityLabel="receiveCardPressableArea"
accessible={true}
onPress={[Function]}
>
<Layout
align="center"
style={
{
"alignItems": "center",
"borderBottomRightRadius": 0,
"elevation": 1,
"height": 186.76000000000002,
"marginVertical": 18,
"padding": 15,
"width": 352.5,
}
}
>
<UNDEFINED
color1="#f59b4b"
color2="#e86e04"
stroke="#F2811D"
/>
<Text
margin="6"
style={
{
"paddingTop": 3,
}
}
testID="receiveCard"
weight="semibold"
>
receiveCard
</Text>
</Layout>
</Memo(Pressable)>
<ReceivedCards />
</Layout>
<Text
color="#666666"
margin="10"
style={
{
"paddingTop": 3,
}
}
weight="semibold"
>
basicSettings
</Text>
</Layout>
<Layout
fill={true}
>
<MessageOverlay
isVisible={false}
onBackdropPress={[Function]}
title=""
/>
<LanguageSetting />
<UNDEFINED
disabled={true}
topDivider={true}
>
<mockConstructor
color="#F2811D"
name="fingerprint"
size={25}
type="MaterialCommunityIcons"
/>
<Content>
<UNDEFINED
accessibilityLabel="bioUnlock"
accessible={true}
style={
{
"paddingTop": 3,
}
}
>
<Text
color="#000000"
weight="semibold"
>
bioUnlock
</Text>
</UNDEFINED>
</Content>
<UNDEFINED
accessibilityLabel="biometricToggle"
accessible={true}
color="#F2811D"
onValueChange={[Function]}
trackColor={
{
"false": "#C7C7C7",
"true": "#FDF1E6",
}
}
/>
</UNDEFINED>
<AboutInji />
<Unknown />
<UNDEFINED
bottomDivider={true}
onPress={[Function]}
topDivider={true}
>
<mockConstructor
color="#F2811D"
name="book"
size={25}
type="antdesign"
/>
<Content>
<UNDEFINED
accessibilityLabel="injiTourGuide"
accessible={true}
style={
{
"paddingTop": 3,
}
}
>
<Text
color="#000000"
weight="semibold"
>
injiTourGuide
</Text>
</UNDEFINED>
</Content>
</UNDEFINED>
<UNDEFINED
onPress={[Function]}
>
<mockConstructor
color="#F2811D"
name="logout"
size={22}
type="fontawesome"
/>
<Content>
<UNDEFINED
accessibilityLabel="logout"
accessible={true}
style={
{
"paddingTop": 3,
}
}
>
<Text
color="#000000"
weight="semibold"
>
logout
</Text>
</UNDEFINED>
</Content>
</UNDEFINED>
</Layout>
</mockConstructor>
</React.Fragment>
`;
exports[`testing the settingsScreen component in Android and IOS renders the SettingScreen component in android 1`] = `
<React.Fragment>
<Memo(Pressable)
accessible={false}
onPress={[Function]}
/>
<BannerNotificationContainer />
<mockConstructor
accessibilityLabel="settingsScreen"
accessible={true}
>
<Layout
backgroundColor="#F8F8F8"
style={
{
"display": "flex",
}
}
>
<Text
color="#666666"
margin="10"
style={
{
"paddingTop": 3,
}
}
testID="injiAsVerifierApp"
weight="semibold"
>
injiAsVerifierApp
</Text>
<Layout
align="space-evenly"
backgroundColor="#FFFFFF"
>
<Memo(Pressable)
accessibilityLabel="receiveCardPressableArea"
accessible={true}
onPress={[Function]}
>
<Layout
align="center"
style={
{
"alignItems": "center",
"borderBottomRightRadius": 0,
"elevation": 1,
"height": 186.76000000000002,
"marginVertical": 18,
"padding": 15,
"width": 352.5,
}
}
>
<UNDEFINED
color1="#f59b4b"
color2="#e86e04"
stroke="#F2811D"
/>
<Text
margin="6"
style={
{
"paddingTop": 3,
}
}
testID="receiveCard"
weight="semibold"
>
receiveCard
</Text>
</Layout>
</Memo(Pressable)>
<ReceivedCards />
</Layout>
<Text
color="#666666"
margin="10"
style={
{
"paddingTop": 3,
}
}
weight="semibold"
>
basicSettings
</Text>
</Layout>
<Layout
fill={true}
>
<MessageOverlay
isVisible={false}
onBackdropPress={[Function]}
title=""
/>
<LanguageSetting />
<UNDEFINED
disabled={true}
topDivider={true}
>
<mockConstructor
color="#F2811D"
name="fingerprint"
size={25}
type="MaterialCommunityIcons"
/>
<Content>
<UNDEFINED
accessibilityLabel="bioUnlock"
accessible={true}
style={
{
"paddingTop": 3,
}
}
>
<Text
color="#000000"
weight="semibold"
>
bioUnlock
</Text>
</UNDEFINED>
</Content>
<UNDEFINED
accessibilityLabel="biometricToggle"
accessible={true}
color="#F2811D"
onValueChange={[Function]}
trackColor={
{
"false": "#C7C7C7",
"true": "#FDF1E6",
}
}
/>
</UNDEFINED>
<AboutInji />
<Unknown />
<UNDEFINED
bottomDivider={true}
onPress={[Function]}
topDivider={true}
>
<mockConstructor
color="#F2811D"
name="book"
size={25}
type="antdesign"
/>
<Content>
<UNDEFINED
accessibilityLabel="injiTourGuide"
accessible={true}
style={
{
"paddingTop": 3,
}
}
>
<Text
color="#000000"
weight="semibold"
>
injiTourGuide
</Text>
</UNDEFINED>
</Content>
</UNDEFINED>
<UNDEFINED
onPress={[Function]}
>
<mockConstructor
color="#F2811D"
name="logout"
size={22}
type="fontawesome"
/>
<Content>
<UNDEFINED
accessibilityLabel="logout"
accessible={true}
style={
{
"paddingTop": 3,
}
}
>
<Text
color="#000000"
weight="semibold"
>
logout
</Text>
</UNDEFINED>
</Content>
</UNDEFINED>
</Layout>
</mockConstructor>
</React.Fragment>
`;

163
shared/commonUtil.test.ts Normal file
View File

@@ -0,0 +1,163 @@
import {useState} from 'react';
import testIDProps, {
bytesToMB,
faceMatchConfig,
generateBackupEncryptionKey,
generateRandomString,
getBackupFileName,
getDriveName,
getMaskedText,
getScreenHeight,
hashData,
logState,
removeWhiteSpace,
sleep,
} from './commonUtil';
import {argon2iConfig} from './constants';
describe('hashData', () => {
it('should expose a function', () => {
expect(hashData).toBeDefined();
});
it('hashData should return hashed string', async () => {
const hashedData = await hashData('1234567890', '1600', argon2iConfig);
expect(hashedData).toBe('mockedRawHashValue');
});
});
describe('generateRandomString', () => {
it('should expose a function', () => {
expect(generateRandomString).toBeDefined();
});
it('generateRandomString should return random string', async () => {
const RandomString = await generateRandomString();
expect(typeof RandomString).toBe('string');
});
});
describe('generateBackupEncryptionKey', () => {
it('should expose a function', () => {
expect(generateBackupEncryptionKey).toBeDefined();
});
it('generateBackupEncryptionKey should return Encrypted key', async () => {
const BackupEncryptionKey = generateBackupEncryptionKey(
'1234567890',
'123445',
5,
16,
);
expect(typeof BackupEncryptionKey).toBe('string');
});
});
describe('testIDProps', () => {
it('should expose a function', () => {
expect(testIDProps).toBeDefined();
});
it('testIDProps should return object with testID ', () => {
const id = 'unitTest';
const testID = testIDProps(id);
expect(typeof testID).toBe('object');
});
});
describe('removeWhiteSpace', () => {
it('should expose a function', () => {
expect(removeWhiteSpace).toBeDefined();
});
it('removeWhiteSpace should return string with out white space', () => {
const response = removeWhiteSpace('React Native Unit Testing');
expect(response).toBe('ReactNativeUnitTesting');
});
});
describe('logState', () => {
it('should expose a function', () => {
expect(logState).toBeDefined();
});
// it('logState should return expected output', () => {
// const retValue = logState(state);
// expect(retValue).toBe(String);
// });
});
describe('getMaskedText', () => {
it('should expose a function', () => {
expect(getMaskedText).toBeDefined();
});
it('getMaskedText should return MaskedText', () => {
const id = '1234567890';
const maskedTxt = getMaskedText(id);
expect(maskedTxt).toBe('******7890');
});
});
describe('faceMatchConfig', () => {
it('should expose a function', () => {
expect(faceMatchConfig).toBeDefined();
});
// it('faceMatchConfig should return expected output', () => {
// // const retValue = faceMatchConfig(resp);
// expect(false).toBeTruthy();
// });
});
describe('getBackupFileName', () => {
it('should expose a function', () => {
expect(getBackupFileName()).toMatch('backup_');
});
});
describe('bytesToMB', () => {
it('bytesToMB returns a string', () => {
expect(bytesToMB(0)).toBe('0');
});
it('10^6 bytes is 1MB', () => {
expect(bytesToMB(1e6)).toBe('1.00');
});
});
describe('getDriveName', () => {
it('should expose a function', () => {
expect(getDriveName).toBeDefined();
});
it('getDriveName should return Google Drive on Android', () => {
expect(getDriveName()).toBe('Google Drive');
});
it('getDriveName should return Google Drive on Android', () => {
expect(getDriveName()).toBe('Google Drive');
});
});
describe('sleep : The promise resolves after a certain time', () => {
it('should expose a function', () => {
expect(sleep).toBeDefined();
});
it('Should resolve after a certain time', () => {
const time = 100;
const promise = sleep(time);
expect(promise).toBeInstanceOf(Promise);
});
});
describe('getScreenHeight', () => {
it('should expose a function', () => {
expect(getScreenHeight).toBeDefined();
});
it('getScreenHeight should return screen height', () => {
const height = getScreenHeight();
expect(typeof height).toBe('object');
});
});

View File

@@ -40,7 +40,7 @@ export interface Argon2iConfig {
mode: string;
}
export default function testIDProps(id) {
export default function testIDProps(id: string) {
return isAndroid()
? {accessible: true, accessibilityLabel: id}
: {testID: id};

View File

@@ -7,8 +7,9 @@ export let MIMOTO_BASE_URL = MIMOTO_HOST;
export let ESIGNET_BASE_URL = ESIGNET_HOST;
export let DEBUG_MODE_ENABLED = DEBUG_MODE === 'true';
export const changeCrendetialRegistry = host => (MIMOTO_BASE_URL = host);
export const changeEsignetUrl = host => (ESIGNET_BASE_URL = host);
export const changeCrendetialRegistry = (host: string) =>
(MIMOTO_BASE_URL = host);
export const changeEsignetUrl = (host: string) => (ESIGNET_BASE_URL = host);
export const COMMON_PROPS_KEY: string =
'CommonPropsKey-' + '6964d04a-9268-11ed-a1eb-0242ac120002';

View File

@@ -24,7 +24,6 @@ import FileStorage, {
getFilePath,
getDirectorySize,
vcDirectoryPath,
backupDirectoryPath,
} from './fileStorage';
import {__AppId} from './GlobalVariables';
import {getErrorEventData, sendErrorEvent} from './telemetry/TelemetryUtils';

View File

@@ -1,4 +1,14 @@
{
"extends": "@tsconfig/react-native/tsconfig.json",
"include": ["src", "custom.d.ts"]
"compilerOptions": {
"outDir": "./build",
"jsx": "react",
"declaration": false
},
"include": [
"src",
"custom.d.ts",
"./types/react-native-dotenv/index.d.ts",
"./types/react-native-argon2/index.d.ts",
]
}

9
tsconfig.spec.json Normal file
View File

@@ -0,0 +1,9 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"jsx": "react"
},
"includes": ["src/**/*.spec.ts"],
"exclude": ["e2e", "examples", "website"],
"lib": ["jest"]
}

4
types/react-native-argon2/index.d.ts vendored Normal file
View File

@@ -0,0 +1,4 @@
declare module 'react-native-argon2' {
const argon2: any; // You can use a more specific type if available
export default argon2;
}