Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: [IOAPPX-487] Latest version of react-native-device-info #6753

Merged
merged 4 commits into from
Feb 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions ios/ItaliaApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand Down
1 change: 1 addition & 0 deletions ios/ItaliaApp/PrivacyInfo.xcprivacy
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
<string>NSPrivacyAccessedAPICategoryDiskSpace</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>85F4.1</string>
<string>7D9E.1</string>
</array>
</dict>
Expand Down
4 changes: 2 additions & 2 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -2569,7 +2569,7 @@ SPEC CHECKSUMS:
RNCAsyncStorage: 40367e8d25522dca9c3513c7b9815a184669bd97
RNCClipboard: 47593431a9e763a71950798683b28f691f16b98d
RNCPushNotificationIOS: 9f3ee8e3b19b6d1941990d0e6306e89fc7610c83
RNDeviceInfo: 55dd986d234bf6d56469fb70a5a3ae972fc59330
RNDeviceInfo: d863506092aef7e7af3a1c350c913d867d795047
RNFlashList: 1e697d1f5c2ead424948f8b8ac01e403d77eb861
RNFS: 4f02bbb5c95d71bade3d36a1b6514305ccefc4c9
RNGestureHandler: 27a63f2218affdf1a426d56682f9b174904838b3
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion patches/patches.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
@@ -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<string>;
getInstanceIdSync: () => string;
Expand All @@ -14,12 +14,12 @@ index 782d473..0930495 100644
- getMacAddressSync: () => string;
getMaxMemory: () => Promise<number>;
getMaxMemorySync: () => number;
getPhoneNumber: () => Promise<string>;
getPreviewSdkInt: () => Promise<number>;
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',
});

Expand All @@ -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,
});

Expand All @@ -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,
Expand All @@ -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<string>;
getInstanceIdSync: () => string;
Expand All @@ -87,4 +87,4 @@ index edf2cae..cb632c6 100644
- getMacAddressSync: () => string;
getMaxMemory: () => Promise<number>;
getMaxMemorySync: () => number;
getPhoneNumber: () => Promise<string>;
getPreviewSdkInt: () => Promise<number>;
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions ts/screens/authentication/LandingScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -441,7 +441,7 @@ export const LandingScreen = () => {
if (O.isNone(isRootedOrJailbroken)) {
return <LoadingScreen />;
} else {
if (DeviceInfo.isTablet()) {
if (isTablet()) {
displayTabletAlert();
}
return <LandingScreenComponent />;
Expand Down
8 changes: 2 additions & 6 deletions ts/utils/appVersion.ts
Original file line number Diff line number Diff line change
@@ -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",
Expand Down Expand Up @@ -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();
14 changes: 2 additions & 12 deletions ts/utils/biometrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -114,26 +113,17 @@ export const getBometricState = (): Promise<biometricState> =>
});
});

export const isDevicePinSet = (): Promise<boolean> =>
new Promise(resolve => {
isPinOrFingerprintSet()
.then(value => {
resolve(value);
})
.catch(_ => resolve(false));
});

export type BiometriActivationUserType =
| "ACTIVATED"
| "AUTH_FAILED"
| "PERMISSION_DENIED"
| "SENSOR_ERROR";

const mayUserActivateBiometricWithDependency = (
getBiometricsType: Promise<BiometricsType>
getBiometricsTypeInternal: Promise<BiometricsType>
): Promise<BiometriActivationUserType> =>
new Promise((resolve, reject) => {
getBiometricsType
getBiometricsTypeInternal
.then(value => {
if (value === "FACE_ID") {
FingerprintScanner.authenticate({
Expand Down
12 changes: 11 additions & 1 deletion ts/utils/device.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -17,4 +19,12 @@ export const getFreeDiskStorage = (): number =>

// true if at least one screen lock method is set
export const isScreenLockSet = (): Promise<boolean> =>
DeviceInfo.isPinOrFingerprintSet();
DeviceInfo.isPinOrFingerprintSet().catch(constFalse);

export const getDeviceAppVersion = (): string =>
Platform.select({
ios: DeviceInfo.getReadableVersion(),
default: DeviceInfo.getVersion()
});

export const isTablet = (): boolean => DeviceInfo.isTablet();
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
Loading