@umituz/react-native-firebase 2.4.54 → 2.4.55

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umituz/react-native-firebase",
3
- "version": "2.4.54",
3
+ "version": "2.4.55",
4
4
  "description": "Unified Firebase package for React Native apps - Auth and Firestore services using Firebase JS SDK (no native modules).",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -10,9 +10,19 @@ import {
10
10
  EmailAuthProvider,
11
11
  type User,
12
12
  } from "firebase/auth";
13
- // @ts-ignore - expo-apple-authentication is an optional peer dependency
14
- import * as AppleAuthentication from "expo-apple-authentication";
15
13
  import { Platform } from "react-native";
14
+
15
+ /**
16
+ * Lazy-loads expo-apple-authentication (optional peer dependency).
17
+ * Returns null if the package is not installed.
18
+ */
19
+ function getAppleAuthModule(): typeof import("expo-apple-authentication") | null {
20
+ try {
21
+ return require("expo-apple-authentication");
22
+ } catch {
23
+ return null;
24
+ }
25
+ }
16
26
  import { generateNonce, hashNonce } from "../../../auth/infrastructure/services/crypto.util";
17
27
  import { executeOperation, failureResultFrom, toErrorInfo, ERROR_MESSAGES } from "../../../../shared/domain/utils";
18
28
  import { isCancelledError } from "../../../../shared/domain/utils/error-handlers/error-checkers";
@@ -82,6 +92,14 @@ export async function getAppleReauthCredential(): Promise<ReauthCredentialResult
82
92
  };
83
93
  }
84
94
 
95
+ const AppleAuthentication = getAppleAuthModule();
96
+ if (!AppleAuthentication) {
97
+ return {
98
+ success: false,
99
+ error: { code: "auth/unavailable", message: "expo-apple-authentication is not installed" }
100
+ };
101
+ }
102
+
85
103
  try {
86
104
  const isAvailable = await AppleAuthentication.isAvailableAsync();
87
105
  if (!isAvailable) {