diff --git a/ios/ItaliaApp.xcodeproj/project.pbxproj b/ios/ItaliaApp.xcodeproj/project.pbxproj index 400dc0b92ec..122bc5016e3 100644 --- a/ios/ItaliaApp.xcodeproj/project.pbxproj +++ b/ios/ItaliaApp.xcodeproj/project.pbxproj @@ -530,6 +530,7 @@ "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire/Alamofire.bundle", "${PODS_CONFIGURATION_BUILD_DIR}/RCT-Folly/RCT-Folly_privacy.bundle", "${PODS_CONFIGURATION_BUILD_DIR}/RNCAsyncStorage/RNCAsyncStorage_resources.bundle", + "${PODS_CONFIGURATION_BUILD_DIR}/RNDeviceInfo/RNDeviceInfoPrivacyInfo.bundle", "${PODS_CONFIGURATION_BUILD_DIR}/React-Core/React-Core_privacy.bundle", "${PODS_CONFIGURATION_BUILD_DIR}/React-cxxreact/React-cxxreact_privacy.bundle", "${PODS_CONFIGURATION_BUILD_DIR}/Sentry/Sentry.bundle", @@ -544,6 +545,7 @@ "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Alamofire.bundle", "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/RCT-Folly_privacy.bundle", "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/RNCAsyncStorage_resources.bundle", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/RNDeviceInfoPrivacyInfo.bundle", "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/React-Core_privacy.bundle", "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/React-cxxreact_privacy.bundle", "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Sentry.bundle", @@ -600,6 +602,7 @@ "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire/Alamofire.bundle", "${PODS_CONFIGURATION_BUILD_DIR}/RCT-Folly/RCT-Folly_privacy.bundle", "${PODS_CONFIGURATION_BUILD_DIR}/RNCAsyncStorage/RNCAsyncStorage_resources.bundle", + "${PODS_CONFIGURATION_BUILD_DIR}/RNDeviceInfo/RNDeviceInfoPrivacyInfo.bundle", "${PODS_CONFIGURATION_BUILD_DIR}/React-Core/React-Core_privacy.bundle", "${PODS_CONFIGURATION_BUILD_DIR}/React-cxxreact/React-cxxreact_privacy.bundle", "${PODS_CONFIGURATION_BUILD_DIR}/Sentry/Sentry.bundle", @@ -614,6 +617,7 @@ "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Alamofire.bundle", "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/RCT-Folly_privacy.bundle", "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/RNCAsyncStorage_resources.bundle", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/RNDeviceInfoPrivacyInfo.bundle", "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/React-Core_privacy.bundle", "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/React-cxxreact_privacy.bundle", "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Sentry.bundle", diff --git a/ios/ItaliaApp/PrivacyInfo.xcprivacy b/ios/ItaliaApp/PrivacyInfo.xcprivacy index 41534c7bf66..8bf123837de 100644 --- a/ios/ItaliaApp/PrivacyInfo.xcprivacy +++ b/ios/ItaliaApp/PrivacyInfo.xcprivacy @@ -35,6 +35,7 @@ NSPrivacyAccessedAPICategoryDiskSpace NSPrivacyAccessedAPITypeReasons + 85F4.1 7D9E.1 diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 2d911670800..07ad8bbac7d 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -1818,7 +1818,7 @@ PODS: - React-Core - RNCPushNotificationIOS (1.8.0): - React-Core - - RNDeviceInfo (10.8.0): + - RNDeviceInfo (14.0.4): - React-Core - RNFlashList (1.7.0): - DoubleConversion @@ -2569,7 +2569,7 @@ SPEC CHECKSUMS: RNCAsyncStorage: 40367e8d25522dca9c3513c7b9815a184669bd97 RNCClipboard: 47593431a9e763a71950798683b28f691f16b98d RNCPushNotificationIOS: 9f3ee8e3b19b6d1941990d0e6306e89fc7610c83 - RNDeviceInfo: 55dd986d234bf6d56469fb70a5a3ae972fc59330 + RNDeviceInfo: d863506092aef7e7af3a1c350c913d867d795047 RNFlashList: 1e697d1f5c2ead424948f8b8ac01e403d77eb861 RNFS: 4f02bbb5c95d71bade3d36a1b6514305ccefc4c9 RNGestureHandler: 27a63f2218affdf1a426d56682f9b174904838b3 diff --git a/package.json b/package.json index 1220ebdbf36..cb7cb470636 100644 --- a/package.json +++ b/package.json @@ -117,7 +117,7 @@ "react-native-calendar-events": "2.2.0", "react-native-config": "^1.4.5", "react-native-crypto": "^2.1.0", - "react-native-device-info": "^10.8.0", + "react-native-device-info": "^14.0.4", "react-native-document-picker": "^9.1.1", "react-native-easing-gradient": "^1.1.1", "react-native-exception-handler": "^2.10.8", diff --git a/patches/patches.md b/patches/patches.md index da920924325..ba12b7ae610 100644 --- a/patches/patches.md +++ b/patches/patches.md @@ -22,7 +22,7 @@ FIXME: Fixed in the v2 branch [here](https://github.com/mrousavy/react-native-vi #### Reason: - This patch going to remove all codes related to `colorSpace` to fix an issue on iOS 17.0.2 that cause the crash on camera load -### react-native-device-info+8.3.3 +### react-native-device-info+14.0.4 Created on **15/12/2021** #### Reason: diff --git a/patches/react-native-device-info+10.8.0.patch b/patches/react-native-device-info+14.0.4.patch similarity index 87% rename from patches/react-native-device-info+10.8.0.patch rename to patches/react-native-device-info+14.0.4.patch index e48e6086afe..c5f0751af48 100644 --- a/patches/react-native-device-info+10.8.0.patch +++ b/patches/react-native-device-info+14.0.4.patch @@ -1,8 +1,8 @@ diff --git a/node_modules/react-native-device-info/lib/typescript/internal/privateTypes.d.ts b/node_modules/react-native-device-info/lib/typescript/internal/privateTypes.d.ts -index 782d473..0930495 100644 +index d0a848c..b9ef76c 100644 --- a/node_modules/react-native-device-info/lib/typescript/internal/privateTypes.d.ts +++ b/node_modules/react-native-device-info/lib/typescript/internal/privateTypes.d.ts -@@ -79,12 +79,8 @@ interface ExposedNativeMethods { +@@ -82,12 +82,8 @@ interface ExposedNativeMethods { getInstallReferrerSync: () => string; getInstanceId: () => Promise; getInstanceIdSync: () => string; @@ -14,12 +14,12 @@ index 782d473..0930495 100644 - getMacAddressSync: () => string; getMaxMemory: () => Promise; getMaxMemorySync: () => number; - getPhoneNumber: () => Promise; + getPreviewSdkInt: () => Promise; diff --git a/node_modules/react-native-device-info/src/index.ts b/node_modules/react-native-device-info/src/index.ts -index 4f096f6..950af63 100644 +index 6932229..3064903 100644 --- a/node_modules/react-native-device-info/src/index.ts +++ b/node_modules/react-native-device-info/src/index.ts -@@ -59,13 +59,6 @@ export const [getAndroidId, getAndroidIdSync] = getSupportedPlatformInfoFunction +@@ -60,13 +60,6 @@ export const [getAndroidId, getAndroidIdSync] = getSupportedPlatformInfoFunction defaultValue: 'unknown', }); @@ -33,7 +33,7 @@ index 4f096f6..950af63 100644 export const [isCameraPresent, isCameraPresentSync] = getSupportedPlatformInfoFunctions({ supportedPlatforms: ['android', 'windows', 'web'], getter: () => RNDeviceInfo.isCameraPresent(), -@@ -73,24 +66,6 @@ export const [isCameraPresent, isCameraPresentSync] = getSupportedPlatformInfoFu +@@ -74,24 +67,6 @@ export const [isCameraPresent, isCameraPresentSync] = getSupportedPlatformInfoFu defaultValue: false, }); @@ -58,7 +58,7 @@ index 4f096f6..950af63 100644 export const getDeviceId = () => getSupportedPlatformInfoSync({ defaultValue: 'unknown', -@@ -903,12 +878,8 @@ const DeviceInfo: DeviceInfoModule = { +@@ -981,12 +956,8 @@ const DeviceInfo: DeviceInfoModule = { getInstallReferrerSync, getInstanceId, getInstanceIdSync, @@ -72,10 +72,10 @@ index 4f096f6..950af63 100644 getManufacturerSync, getMaxMemory, diff --git a/node_modules/react-native-device-info/src/internal/privateTypes.ts b/node_modules/react-native-device-info/src/internal/privateTypes.ts -index edf2cae..cb632c6 100644 +index de65647..fc25770 100644 --- a/node_modules/react-native-device-info/src/internal/privateTypes.ts +++ b/node_modules/react-native-device-info/src/internal/privateTypes.ts -@@ -84,12 +84,8 @@ interface ExposedNativeMethods { +@@ -93,12 +93,8 @@ interface ExposedNativeMethods { getInstallReferrerSync: () => string; getInstanceId: () => Promise; getInstanceIdSync: () => string; @@ -87,4 +87,4 @@ index edf2cae..cb632c6 100644 - getMacAddressSync: () => string; getMaxMemory: () => Promise; getMaxMemorySync: () => number; - getPhoneNumber: () => Promise; + getPreviewSdkInt: () => Promise; diff --git a/ts/sagas/startup/onboarding/biometric/checkAcknowledgedFingerprintSaga.ts b/ts/sagas/startup/onboarding/biometric/checkAcknowledgedFingerprintSaga.ts index af02676b419..efe4677c0d2 100644 --- a/ts/sagas/startup/onboarding/biometric/checkAcknowledgedFingerprintSaga.ts +++ b/ts/sagas/startup/onboarding/biometric/checkAcknowledgedFingerprintSaga.ts @@ -2,8 +2,9 @@ import { call, put, select } from "typed-redux-saga/macro"; import { fingerprintAcknowledged } from "../../../../store/actions/onboarding"; import { isFingerprintAcknowledgedSelector } from "../../../../store/reducers/onboarding"; import { ReduxSagaEffect } from "../../../../types/utils"; -import { getBometricState, isDevicePinSet } from "../../../../utils/biometrics"; +import { getBometricState } from "../../../../utils/biometrics"; import { isFingerprintEnabledSelector } from "../../../../store/reducers/persistedPreferences"; +import { isScreenLockSet } from "../../../../utils/device"; import { handleBiometricAvailable, hanldeMissingDevicePin, @@ -23,7 +24,7 @@ function* onboardFingerprintIfAvailableSaga(): Generator< if (biometricState === "Available") { yield* call(handleBiometricAvailable); } else { - const isOSPinSet = yield* call(isDevicePinSet); + const isOSPinSet = yield* call(isScreenLockSet); if (!isOSPinSet) { yield* call(hanldeMissingDevicePin); return; diff --git a/ts/screens/authentication/LandingScreen.tsx b/ts/screens/authentication/LandingScreen.tsx index e1995fdc318..41ca08c4c18 100644 --- a/ts/screens/authentication/LandingScreen.tsx +++ b/ts/screens/authentication/LandingScreen.tsx @@ -22,7 +22,6 @@ import { useRef, ComponentProps } from "react"; -import DeviceInfo from "react-native-device-info"; import { useSafeAreaInsets } from "react-native-safe-area-context"; import { Alert, View } from "react-native"; import { useFocusEffect, useRoute } from "@react-navigation/native"; @@ -58,6 +57,7 @@ import { cieIDDisableTourGuide } from "../../features/cieLogin/store/actions"; import { SpidLevel } from "../../features/cieLogin/utils"; import { helpCenterHowToDoWhenSessionIsExpiredUrl } from "../../config"; import { trackHelpCenterCtaTapped } from "../../utils/analytics"; +import { isTablet } from "../../utils/device"; import { LandingSessionExpiredComponent } from "./components/LandingSessionExpiredComponent"; import { loginCieWizardSelected, @@ -441,7 +441,7 @@ export const LandingScreen = () => { if (O.isNone(isRootedOrJailbroken)) { return ; } else { - if (DeviceInfo.isTablet()) { + if (isTablet()) { displayTabletAlert(); } return ; diff --git a/ts/utils/appVersion.ts b/ts/utils/appVersion.ts index f1e3fcb5200..de4eccd58c7 100644 --- a/ts/utils/appVersion.ts +++ b/ts/utils/appVersion.ts @@ -1,10 +1,10 @@ import * as E from "fp-ts/lib/Either"; import { PatternString } from "@pagopa/ts-commons/lib/strings"; import { Platform } from "react-native"; -import DeviceInfo from "react-native-device-info"; import semver, { SemVer } from "semver"; import { pipe } from "fp-ts/lib/function"; import { NumberFromString } from "./number"; +import { getDeviceAppVersion } from "./device"; export const storeUrl = Platform.select({ ios: "itms-apps://itunes.apple.com/it/app/io/id1501681835", @@ -85,8 +85,4 @@ export const isVersionSupported = ( return semSatisfies; }; -export const getAppVersion = () => - Platform.select({ - ios: DeviceInfo.getReadableVersion(), - default: DeviceInfo.getVersion() - }); +export const getAppVersion = (): string => getDeviceAppVersion(); diff --git a/ts/utils/biometrics.ts b/ts/utils/biometrics.ts index c82551056dc..80c0c621b62 100644 --- a/ts/utils/biometrics.ts +++ b/ts/utils/biometrics.ts @@ -6,7 +6,6 @@ import FingerprintScanner, { FingerprintScannerError, Errors } from "react-native-fingerprint-scanner"; -import { isPinOrFingerprintSet } from "react-native-device-info"; import { isDebugBiometricIdentificationEnabled } from "../config"; import I18n from "../i18n"; import { mixpanelTrack } from "../mixpanel"; @@ -114,15 +113,6 @@ export const getBometricState = (): Promise => }); }); -export const isDevicePinSet = (): Promise => - new Promise(resolve => { - isPinOrFingerprintSet() - .then(value => { - resolve(value); - }) - .catch(_ => resolve(false)); - }); - export type BiometriActivationUserType = | "ACTIVATED" | "AUTH_FAILED" @@ -130,10 +120,10 @@ export type BiometriActivationUserType = | "SENSOR_ERROR"; const mayUserActivateBiometricWithDependency = ( - getBiometricsType: Promise + getBiometricsTypeInternal: Promise ): Promise => new Promise((resolve, reject) => { - getBiometricsType + getBiometricsTypeInternal .then(value => { if (value === "FACE_ID") { FingerprintScanner.authenticate({ diff --git a/ts/utils/device.ts b/ts/utils/device.ts index 375acc2dc65..7c58000e52c 100644 --- a/ts/utils/device.ts +++ b/ts/utils/device.ts @@ -2,6 +2,8 @@ * util file to expose those functions that get or set data from/to device * regardless of the specific library used */ +import { constFalse } from "fp-ts/lib/function"; +import { Platform } from "react-native"; import DeviceInfo from "react-native-device-info"; export const getDeviceId = (): string => DeviceInfo.getUniqueIdSync(); @@ -17,4 +19,12 @@ export const getFreeDiskStorage = (): number => // true if at least one screen lock method is set export const isScreenLockSet = (): Promise => - DeviceInfo.isPinOrFingerprintSet(); + DeviceInfo.isPinOrFingerprintSet().catch(constFalse); + +export const getDeviceAppVersion = (): string => + Platform.select({ + ios: DeviceInfo.getReadableVersion(), + default: DeviceInfo.getVersion() + }); + +export const isTablet = (): boolean => DeviceInfo.isTablet(); diff --git a/yarn.lock b/yarn.lock index 6ad8c61c7b2..b696e96b76f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -13782,7 +13782,7 @@ __metadata: react-native-calendar-events: 2.2.0 react-native-config: ^1.4.5 react-native-crypto: ^2.1.0 - react-native-device-info: ^10.8.0 + react-native-device-info: ^14.0.4 react-native-document-picker: ^9.1.1 react-native-easing-gradient: ^1.1.1 react-native-exception-handler: ^2.10.8 @@ -18946,12 +18946,12 @@ __metadata: languageName: node linkType: hard -"react-native-device-info@npm:^10.8.0": - version: 10.8.0 - resolution: "react-native-device-info@npm:10.8.0" +"react-native-device-info@npm:^14.0.4": + version: 14.0.4 + resolution: "react-native-device-info@npm:14.0.4" peerDependencies: react-native: "*" - checksum: 9875ad17a8b73a418befd010c4a33a5a43d5c09c2f63a445c1cec35746014c392c35dee487e81e9ff7c0568ff08fbd51ccee33f3c7bc4f71a065e7d47c205b6b + checksum: aa839dbe7df1246a4b5f9bcfeb3d4cc4be585f13a0d3ff6a03f57a0c2cfe7590291ac292dda4c51fd8765f94c870857676463e8e2f1660b057f3ae2b4335db29 languageName: node linkType: hard