Skip to content

Commit 5a0007e

Browse files
authored
Merge branch 'main' into moo/trigger-on-nightly
2 parents 2628554 + ab9696c commit 5a0007e

9 files changed

Lines changed: 88 additions & 81 deletions

File tree

configs/e2e/native_dependencies.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"react-native-file-viewer-turbo": "0.6.0",
1717
"react-native-localize": "3.2.1",
1818
"react-native-image-picker": "7.2.3",
19-
"react-native-permissions": "4.1.5",
20-
"react-native-webview": "13.13.2"
19+
"react-native-permissions": "5.4.2",
20+
"react-native-webview": "13.13.2",
21+
"@sbaiahmed1/react-native-biometrics": "0.4.0"
2122
}

configs/jsactions/rollup-plugin-collect-dependencies.mjs

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22

33
import fg from "fast-glob";
44
import fsExtra from "fs-extra";
5-
import { existsSync, readFileSync, writeFileSync } from "fs";
5+
import { existsSync, readFileSync, writeFileSync, cpSync, lstatSync, realpathSync } from "fs";
66
import { dirname, join, parse } from "path";
7-
import copy from "recursive-copy";
87
import { promisify } from "util";
98
import resolve from "resolve";
109
import _ from "lodash";
@@ -172,15 +171,36 @@ export async function copyJsModule(moduleSourcePath, to) {
172171
if (existsSync(to)) {
173172
return;
174173
}
175-
return promisify(copy)(moduleSourcePath, to, {
176-
filter: [
177-
"**/*.*",
178-
LICENSE_GLOB,
179-
"!**/{android,ios,windows,mac,jest,github,gradle,__*__,docs,jest,example*}/**/*",
180-
"!**/*.{config,setup}.*",
181-
"!**/*.{podspec,flow}"
182-
],
183-
overwrite: true
174+
175+
// Check if the source is a symlink and resolve it to the actual path
176+
let actualSourcePath = moduleSourcePath;
177+
if (lstatSync(moduleSourcePath).isSymbolicLink()) {
178+
actualSourcePath = realpathSync(moduleSourcePath);
179+
}
180+
181+
cpSync(actualSourcePath, to, {
182+
recursive: true,
183+
dereference: true, // Follow symlinks and copy the actual files
184+
filter: (src, dest) => {
185+
const relativePath = src.replace(actualSourcePath, "").replace(/^[\\/]/, "");
186+
187+
// Skip certain directories
188+
if (relativePath.match(/[\\/](android|ios|windows|mac|jest|github|gradle|__.*__|docs|example.*)[\\/]/)) {
189+
return false;
190+
}
191+
192+
// Skip certain file types
193+
if (relativePath.match(/\.(config|setup)\.|\.podspec$|\.flow$/)) {
194+
return false;
195+
}
196+
197+
// Include LICENSE files
198+
if (relativePath.match(/license/i)) {
199+
return true;
200+
}
201+
202+
return true;
203+
}
184204
});
185205
}
186206

configs/jsactions/rollup.config.mjs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -93,17 +93,6 @@ export default async args => {
9393
}
9494
);
9595

96-
// We dynamically import react-native-schedule-exact-alarm-permission as it works only on Android
97-
// so we need to copy it here as collectDependencies won't detect it.
98-
await copyJsModule(
99-
// require returns a path to commonjs index.js file
100-
join(
101-
dirname(require.resolve("react-native-schedule-exact-alarm-permission")),
102-
"../",
103-
"../"
104-
),
105-
join(outDir, "node_modules", "react-native-schedule-exact-alarm-permission")
106-
);
10796
} else if (args.configProject === "nanoflowcommons") {
10897
// `invariant` is being used silently by @react-native-community/geolocation; it is not listed as a dependency nor peerDependency.
10998
// https://github.dev/react-native-geolocation/react-native-geolocation/blob/1786929f2be581da91082ff857c2393da5e597b3/js/implementation.native.js#L13

packages/jsActions/mobile-resources-native/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,16 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66

77
## [Unreleased]
88

9+
10+
- We updated react-native-permissions to 5.4.2.
11+
12+
- We removed react-native-schedule-exact-alarm-permission since it's no longer required.
13+
914
- Updated react-native from version 0.75.4 to 0.77.3.
1015
- We migrated from react-native-file-viewer to react-native-file-viewer-turbo for new architecture compatibility
1116
- File viewer now uses modal to display content
17+
- We migrated from react-native-biometrics to @sbaiahmed1/react-native-biometrics for new architecture compatibility
18+
1219

1320
## [10.0.0] Native Mobile Resources - 2025-3-31
1421

packages/jsActions/mobile-resources-native/package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,16 @@
2929
"@notifee/react-native": "9.1.8",
3030
"@react-native-camera-roll/camera-roll": "7.4.0",
3131
"@react-native-firebase/messaging": "17.3.0",
32+
"@sbaiahmed1/react-native-biometrics": "0.4.0",
3233
"@swan-io/react-native-browser": "0.4.1",
3334
"fbjs": "3.0.4",
3435
"mime": "3.0.0",
35-
"react-native-biometrics": "3.0.1",
3636
"react-native-blob-util": "0.21.2",
3737
"react-native-device-info": "14.0.4",
3838
"react-native-file-viewer-turbo": "0.6.0",
3939
"react-native-image-picker": "7.2.3",
4040
"react-native-localize": "3.2.1",
41-
"react-native-permissions": "4.1.5",
42-
"react-native-schedule-exact-alarm-permission": "^0.1.3",
41+
"react-native-permissions": "5.4.2",
4342
"react-native-sound": "0.11.0",
4443
"url-parse": "^1.4.7"
4544
},

packages/jsActions/mobile-resources-native/src/authentication/BiometricAuthentication.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// - the code between BEGIN USER CODE and END USER CODE
66
// - the code between BEGIN EXTRA CODE and END EXTRA CODE
77
// Other code you write will be lost the next time you deploy the project.
8-
import ReactNativeBiometrics from "react-native-biometrics";
8+
import { simplePrompt } from "@sbaiahmed1/react-native-biometrics";
99

1010
// BEGIN EXTRA CODE
1111
// END EXTRA CODE
@@ -16,13 +16,10 @@ import ReactNativeBiometrics from "react-native-biometrics";
1616
*/
1717
export async function BiometricAuthentication(reason?: string): Promise<boolean> {
1818
// BEGIN USER CODE
19-
// Documentation https://github.com/smallcase/react-native-simple-biometrics
19+
// Documentation https://github.com/sbaiahmed1/react-native-biometrics
2020

21-
const rnBiometrics = new ReactNativeBiometrics();
22-
23-
return rnBiometrics
24-
.simplePrompt({ promptMessage: reason ?? "" })
25-
.then(() => true)
21+
return simplePrompt(reason ?? "")
22+
.then(result => result.success)
2623
.catch(() => false);
2724

2825
// END USER CODE

packages/jsActions/mobile-resources-native/src/authentication/IsBiometricAuthenticationSupported.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// - the code between BEGIN USER CODE and END USER CODE
66
// - the code between BEGIN EXTRA CODE and END EXTRA CODE
77
// Other code you write will be lost the next time you deploy the project.
8-
import ReactNativeBiometrics from "react-native-biometrics";
8+
import { isSensorAvailable } from "@sbaiahmed1/react-native-biometrics";
99

1010
// BEGIN EXTRA CODE
1111
// END EXTRA CODE
@@ -15,12 +15,9 @@ import ReactNativeBiometrics from "react-native-biometrics";
1515
*/
1616
export async function IsBiometricAuthenticationSupported(): Promise<boolean> {
1717
// BEGIN USER CODE
18-
// Documentation https://github.com/smallcase/react-native-simple-biometrics
18+
// Documentation https://github.com/sbaiahmed1/react-native-biometrics
1919

20-
const rnBiometrics = new ReactNativeBiometrics();
21-
22-
return rnBiometrics
23-
.isSensorAvailable()
20+
return isSensorAvailable()
2421
.then(result => result.available)
2522
.catch(() => false);
2623

packages/jsActions/mobile-resources-native/src/permissions/RequestGenericPermission.ts

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ import {
1212
RESULTS,
1313
openSettings,
1414
Permission,
15-
PERMISSIONS as RNPermissions
15+
PERMISSIONS as RNPermissions,
16+
canScheduleExactAlarms
1617
} from "react-native-permissions";
1718
import { ANDROIDPermissionName, IOSPermissionName } from "../../typings/RequestGenericPermission";
1819

@@ -30,18 +31,26 @@ function handleBlockedPermission(permission: string): void {
3031
const permissionName = permission.replace(/_IOS|_ANDROID/, "");
3132

3233
if (permissionName === "SCHEDULE_EXACT_ALARM") {
33-
const RNExactAlarmPermission = require("react-native-schedule-exact-alarm-permission");
34-
35-
Alert.alert("", "Please allow setting alarms and reminders", [
36-
{ text: "Go to alarm settings", onPress: () => RNExactAlarmPermission.getPermission(), isPreferred: true },
37-
{ text: "Cancel", style: "cancel" }
38-
]);
39-
} else {
40-
Alert.alert("", `Please allow ${permissionName} access`, [
41-
{ text: "Go to settings", onPress: () => openSettings(), isPreferred: true },
34+
return Alert.alert("", "Please allow setting alarms and reminders", [
35+
{
36+
text: "Go to alarm settings",
37+
onPress: async () => {
38+
const canSchedule = await canScheduleExactAlarms();
39+
if (!canSchedule) {
40+
// Check if permission is already granted
41+
return openSettings("alarms");
42+
}
43+
return openSettings();
44+
},
45+
isPreferred: true
46+
},
4247
{ text: "Cancel", style: "cancel" }
4348
]);
4449
}
50+
return Alert.alert("", `Please allow ${permissionName} access`, [
51+
{ text: "Go to settings", onPress: () => openSettings(), isPreferred: true },
52+
{ text: "Cancel", style: "cancel" }
53+
]);
4554
}
4655

4756
function mapPermissionName(permissionName: string): Permission | "android.permission.SCHEDULE_EXACT_ALARM" | undefined {

pnpm-lock.yaml

Lines changed: 19 additions & 31 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)